An introduction to Kubernetes pods
Civo Academy - Kubernetes Pod Explained
Discover what a pod whilst beginning to understand how and when you can create and use pods within your clusters.
Working with a pod
If we want to see the pod logs, we will use the
kubectl logs -f demo command. The
-f parameter helps follow the logs, and the demo is the pod's name. The output is just the logs that are coming off the container. If we want to view the events of the pod, then we'll use the describe command. Hence, the command will be
kubectl describe pod demo. The output will contain the description and the events. If anything goes wrong, the first thing that usually we see in the Kubernetes world is we describe the Kubernetes object. Then, we get to see the number of events. In the events, we can see the successful assigning of the node, successfully pulling the image along with creating the container and starting the container. All the things that are happening from the Kubelet scheduler come in the event section. We'll discuss other sections in the future videos, like the taints and annotations, the toleration node selectors, the keywords class, and even the readiness probes.
Next, what we have is if we want to delete the pod, we'll just simply use the
kubectl delete pod demo command. The pod gets deleted. Now, if I do
kubectl get pods, I'll see only one pod that is running. If we want to exec into the pod, just like the docker exec, we'll use the
kubectl exec -it [POD_NAME] bash command. With this, you can see I'm now inside the running pod.
For this lecture, we have seen a few of the commands to create a pod from the YAML file, creation through the imperative way, and how to interact with the pod. We have also seen the logs and how we can delete a pod, exec it, and describe it. Thanks for watching, see you in the next lecture.