You ran kubectl run and got a Pod, not a container. That is the rule: Kubernetes never runs a container on its own.
The Pod
A Pod is the smallest thing Kubernetes runs. It wraps one or more containers and gives them:
- one name,
- one IP address, shared by every container inside,
- one life: when the Pod goes, its containers go.
namespace default
- podlingWebsite
Most Pods hold exactly one container. Chapter 7 shows when two make sense. Until then, think "one Pod, one container".
Make one
learner@shallows:~$ kubectl run podling --image=nginx
pod/podling createdrun makes a Pod named podling from the image nginx. The name is yours. Two Pods cannot share a name:
learner@shallows:~$ kubectl run podling --image=nginx
Error from server (AlreadyExists): pods "podling" already existsSee more columns
learner@shallows:~$ kubectl get pods -o wide
NAME READY STATUS RESTARTS AGE IP NODE
podling 1/1 Running 0 5s 10.42.0.8 shallows-node-1-o wide adds the Pod's IP and the NODE, the computer it runs on. This cluster has one node. Chapter 2 is about it.
Remove one
learner@shallows:~$ kubectl delete pod podling
pod "podling" deletedThe Pod and its container are gone. Nothing brings them back; the lesson "Pods Don't Come Back" explains why that matters.