Pods

The smallest thing Kubernetes runs.

A Kubernetes practice simulator runs inside your browser tab. It behaves like the real commands for what the lessons teach, and it is labelled as a simulation.

A pod runs your container

Kubernetes runs containers for you across a group of machines called a cluster. You tell it what you want with the kubectl command, and it does the work.

The smallest thing it runs is a pod: one running copy of your program, usually one container.

kubectl run starts a pod from an image. kubectl get pods lists them. This terminal is a simulation of a cluster.

Example
kubectl run web --image=nginx
kubectl get pods

Reading a pod's status

The STATUS column tells you how a pod is doing. Running with 1/1 under READY means it is up.

ImagePullBackOff means Kubernetes could not download the image, most often because the name is misspelt. The pod stays stuck until it is fixed.

kubectl logs shows what a running pod has printed.

Example
kubectl run web --image=nginx
kubectl logs web

Your turn: start a pod

Write one command per line, press Run to try it, then press Check.

Practice task

Start a pod named cache from the redis image.

Your answer is run and checked in the lesson. Try it now.

Deleting a pod

kubectl delete pod removes a pod. A pod you started with kubectl run is simply gone: nothing brings it back.

That is why pods are rarely started on their own in real work. The next topic shows the usual way.

Example
kubectl run web --image=nginx
kubectl delete pod web
kubectl get pods

Your turn: fix a stuck pod

A pod named api is stuck here because its image name is misspelt. Run kubectl get pods to see it.

Practice task

Delete the pod api and start it again with the correct image, nginx.

Your answer is run and checked in the lesson. Try it now.