As previously stated, a pod is the most fundamental and smallest unit in kubernetes. We'll look at how to use kubectl to interact with a Kubernetes cluster and work with pods in this post.
So let's begin by creating our first pod.
1. To create pod use the below command
kubectl run nginx --image=nginx
In the above example, the pod name could be anything, however the image name has to be the name of the image available at the docker hub or any other container registry.
2. To check the pods status
kubectl get pods
In the output, you'll see name of the pod, nginx in this case. Ready column shows the number of containers in ready state. Age shows how long the pod has been running. Restarts shows how many times the container has restarted.
3. We can get more information related to pod, by running below command
kubectl describe pod nginx
It provides lot more information as compared to the get command, like the name of the POD, Label that has been assigned to pod, time when it was started, IP of the node it's assigned to and so on.
4. Additional details regarding pods can be viewed by using below command
kubectl get pods -o wide
I hope you found this helpful.
Thank you for reading!
*** Explore | Share | Grow ***
Comments