Knaph

The Pod Nobody's Watching

lesson-04-doodle-01.png

There's another command that creates something running on your cluster: kubectl run. It looks like a cousin of kubectl create deployment — similar syntax, same --image flag, same kind of result on screen. You might think it's just a shortcut for kubectl create deployment — fewer keystrokes, same result. That's a reasonable guess; both commands end with a Pod running your container, and both feel equally "correct" the first time you type them. But they don't create the same thing. kubectl create deployment creates a Deployment, which creates a ReplicaSet, which creates a Pod — the chain you saw back when you ran kubectl get all. kubectl run skips all of that and creates a bare Pod, directly, with nothing behind it.

That difference sounds small right now. It isn't. It's the difference between a Pod something is watching over, and a Pod that's entirely on its own.

Try it yourself

Create a second Pod, this time with kubectl run:

kubectl run lonely-pod --image=nginx

Now check what actually got created:

kubectl get all

Output:

NAME                             READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/hello-web        1/1     1            1           25m
 
NAME                                        DESIRED   CURRENT   READY   AGE
replicaset.apps/hello-web-7d9f8c9d6b        1         1         1       25m
 
NAME                                READY   STATUS    RESTARTS   AGE
pod/hello-web-7d9f8c9d6b-x2k4p      1/1     Running   0          25m
pod/lonely-pod                      1/1     Running   0          8s

Look closely at lonely-pod. Unlike hello-web-7d9f8c9d6b-x2k4p, its name has no random suffix tacked onto it — because nothing generated it from a template. There's no ReplicaSet above it, and no Deployment above that. It showed up in the Pod list and nowhere else. Compare that to the three-layer chain sitting right above it for hello-web, created by one call to kubectl create deployment back in the last lesson.

Same kind of object. Completely different amount of company.

Why this matters

A Deployment doesn't just create a Pod once and walk away — it keeps watching. If that Pod disappears, the Deployment (through its ReplicaSet) notices and creates a replacement. lonely-pod has no Deployment, so it has no one watching. If it disappears, it just… disappears. Nothing is checking whether it's supposed to still be there.

Right now, lonely-pod is sitting there running, indistinguishable from hello-web's Pod if you only look at kubectl get pods. Both say Running. Both look equally healthy.

Takeaways

  • kubectl run and kubectl create deployment both produce a running Pod, but they are not shortcuts for each other.
  • kubectl create deployment builds the full chain: Deployment → ReplicaSet → Pod. kubectl run creates a bare Pod with nothing above it.
  • A bare Pod looks identical to a Deployment-managed Pod in kubectl get pods — the difference only shows up in kubectl get all, where you can see what (if anything) owns it.
  • "Nothing owns this Pod" isn't a technicality. It determines what happens next if the Pod ever goes away.

Sign in to track your progress through this course.

Ask an AI

Open a ready-made prompt in ChatGPT or Claude — just press Enter.

SummarizeChatGPTClaude
Ask me questionsChatGPTClaude
Let's learn togetherChatGPTClaude