Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Troubleshooting with Kubectl

Troubleshooting is a systematic approach to solving a problem. The goal of troubleshooting is to determine why something does not work as expected and how to resolve the problem.

Kubectl Command-Line Interface

You can use the following Kubectl commands to troubleshoot cRPD:

  • kubectl get: Lists the resources.

  • kubectl describe : Display detailed information about a resource.

  • kubectl logs: Display the logs from a container in a pod.

  • kubectl exec: Execute a command on a container in a pod.

Viewing Pods

A Pod is a Kubernetes abstraction that represents a group of one or more application containers (such as Docker or rkt), and some shared resources for those containers.

Those resources include:

  • Shared storage, as Volumes

  • Networking, as a unique cluster IP address

  • Information about how to run each container, such as the container image version or specific ports to use

When we create a Deployment on Kubernetes, that Deployment creates Pods with containers inside them (as opposed to creating containers directly). Each Pod is tied to the Node where it is scheduled, and remains there until termination (according to restart policy) or deletion. In case of a Node failure, identical Pods are scheduled on other available Nodes in the cluster. Summary: Pods Nodes Kubectl main commands A Pod is a group of one or more application containers (such as Docker or rkt) and includes shared storage (volumes), IP address and information about how to run them.

Run the following command to view pods:

root@ubuntu-vm18:~# kubectl get pods

Viewing Container Logs

Purpose

Anything that the application sends to STDOUT becomes logs for the container within the Pod.

Action

To view the logs:

  1. Run the following command to retrieve the logs:

    root@ubuntu-vm18$ kubectl logs $POD_NAME