{"id":372,"date":"2026-12-01T12:00:00","date_gmt":"2026-12-01T12:00:00","guid":{"rendered":"https:\/\/rezachegini.com\/?p=372"},"modified":"2026-12-01T19:32:34","modified_gmt":"2026-12-01T19:32:34","slug":"ckad-prep-part-1-building-pods-the-yaml-way","status":"publish","type":"post","link":"https:\/\/rezachegini.com\/?p=372","title":{"rendered":"CKAD Prep, Part 1: Building Pods the YAML Way"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Why I&#8217;m writing this<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Hi, I&#8217;m Reza. I usually share my projects from the beginning. This series is a little different: it&#8217;s my preparation for the CKAD exam (Certified Kubernetes Application Developer). I am a junior engineer looking for my first SRE, DevOps or Cloud job, and that is why I learn in public. You can see how I think, what breaks, and how I fix it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I practice on my own home lab: a K3s cluster on a machine called thor. I work through a set of lab scenarios, and for each one I write notes: the code line by line, the mistakes I made, and the real output.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">YAML by hand is slow, and the exam is timed. So the workflow uses both styles:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1390\" height=\"323\" src=\"https:\/\/rezachegini.com\/wp-content\/uploads\/2026\/12\/ckad-prep-part-1-workflow.png\" alt=\"Imperative to start, declarative to keep: generate a skeleton with kubectl run --dry-run=client, edit the YAML, apply it with kubectl apply -f, then verify with jsonpath, events and logs\" class=\"wp-image-371\" srcset=\"https:\/\/rezachegini.com\/wp-content\/uploads\/2026\/12\/ckad-prep-part-1-workflow.png 1390w, https:\/\/rezachegini.com\/wp-content\/uploads\/2026\/12\/ckad-prep-part-1-workflow-300x70.png 300w, https:\/\/rezachegini.com\/wp-content\/uploads\/2026\/12\/ckad-prep-part-1-workflow-1024x238.png 1024w, https:\/\/rezachegini.com\/wp-content\/uploads\/2026\/12\/ckad-prep-part-1-workflow-768x178.png 768w\" sizes=\"auto, (max-width: 1390px) 100vw, 1390px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">In this part I set up the lab, then do the first three pod scenarios: a pod with everything set (A1), command vs args (A2), and pulling facts out of a pod (A3).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Setup: a namespace and a default context<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Every lab starts the same way: a namespace for the lab, and a default context that points at it.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apiVersion: v1\nkind: Namespace\nmetadata:\n  name: core<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>apiVersion: v1<\/code> is the core API group. Namespaces, Pods, Services, ConfigMaps and Secrets all live in the same v1 group.<\/li>\n\n\n\n<li><code>kind: Namespace<\/code> is case-sensitive. <code>namespace<\/code> in lowercase gets rejected. One of the lab&#8217;s later scenarios hits the same rule with a Pod.<\/li>\n\n\n\n<li><code>name: core<\/code> must be a valid DNS label: lowercase letters, digits and <code>-<\/code>, up to 63 characters. That&#8217;s because the name ends up in the API path, and the path has to stay valid.<\/li>\n\n\n\n<li>There is no <code>metadata.namespace<\/code>. A Namespace is cluster-scoped, so it doesn&#8217;t live inside another namespace.<\/li>\n\n\n\n<li>There is no <code>spec<\/code>. A Namespace needs nothing beyond its name.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Then three commands:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo mkdir -p \/opt\/ckad\/00\/yaml &amp;&amp; sudo chown -R $USER \/opt\/ckad\nkubectl apply -f \/opt\/ckad\/00\/yaml\/00-namespace.yaml\nkubectl config set-context --current --namespace=core<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>\/opt<\/code> belongs to root, so <code>sudo<\/code> creates the folder, and <code>chown<\/code> gives it to me. Without the <code>chown<\/code>, every later command would need <code>sudo<\/code>, and the exam doesn&#8217;t work that way.<\/li>\n\n\n\n<li><code>apply<\/code> is declarative: &#8220;make the cluster match this file&#8221;. It creates the object if it&#8217;s missing, and patches it if it exists. A second apply changes nothing, and prints <code>unchanged<\/code>.<\/li>\n\n\n\n<li><code>config set-context<\/code> edits my local kubeconfig file (<code>~\/.kube\/config<\/code>). It doesn&#8217;t talk to the cluster at all, so it works even if the cluster is down.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The part that&#8217;s easy to misunderstand: <code>set-context --namespace<\/code> only changes the default for my commands. It doesn&#8217;t move anything. And it doesn&#8217;t override a <code>namespace:<\/code> written inside a YAML file.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Without this step, everything goes to default, and you need <code>-n core<\/code> on every command. Forgetting <code>-n<\/code> is the kind of mistake that costs points in a timed exam.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>kubectl config view --minify | grep namespace<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>namespace: core<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><code>--minify<\/code> prints only the current context, so <code>grep<\/code> finds that context&#8217;s namespace and nothing else. A full <code>kubectl config view<\/code> prints every context and cluster, and the <code>grep<\/code> would match the wrong lines.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">One design note: on the exam, <code>kubectl create ns core<\/code> is faster for something this small. I use YAML here so the namespace sits in the repo with the rest of the lab, and so every lab file in the same folder applies the same way.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">A1: a pod with everything set<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The task: a pod called <code>web<\/code>, with labels, an env var, a container port, and CPU and memory requests and limits. The pod runs nginx, and I check it with jsonpath.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The skeleton<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>kubectl run web --image=nginx:1.27 \\\n  --labels=app=web,tier=frontend \\\n  --env=MODE=prod \\\n  --port=80 --dry-run=client -o yaml &gt; yaml\/a1-web-pod.yaml<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>kubectl run<\/code> only makes pods. Not Deployments: <code>--replicas<\/code> was removed years ago.<\/li>\n\n\n\n<li><code>nginx:1.27<\/code> is a pinned tag. In a lab I&#8217;ll repeat, I never use <code>latest<\/code>. If the image changes, the results change, and the notes stop matching.<\/li>\n\n\n\n<li><code>--labels<\/code> is comma-separated, with no spaces. These labels matter later: <code>kubectl expose pod web<\/code> copies them onto the Service selector, and a Service with no matching labels finds no pods.<\/li>\n\n\n\n<li><code>--port=80<\/code> sets <code>containerPort: 80<\/code>. On its own, it doesn&#8217;t open anything. It&#8217;s information that Services and probes can use.<\/li>\n\n\n\n<li><code>--dry-run=client<\/code> builds the object locally and never sends it to the API server. Without it, the pod would be created right away, and I&#8217;d have nothing to edit.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">What kubectl run cant do: resources<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><code>kubectl run<\/code> can&#8217;t set resources anymore, so that part is always written by hand:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>resources:\n  requests:\n    cpu: 100m\n    memory: 64Mi\n  limits:\n    cpu: 200m\n    memory: 128Mi<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>resources<\/code> sits under the container, not under <code>spec<\/code>. Each container has its own. At pod level it fails validation.<\/li>\n\n\n\n<li><code>100m<\/code> is 100 millicores, so 0.1 of a CPU core.<\/li>\n\n\n\n<li><code>64Mi<\/code> is 64 mebibytes (1024-based). <code>64M<\/code> is megabytes (1000-based), a different number. I use <code>Mi<\/code> and <code>Gi<\/code>, never <code>M<\/code> and <code>G<\/code>.<\/li>\n\n\n\n<li>Requests are what the scheduler reserves. The pod only goes on a node with 100m CPU and 64Mi still free.<\/li>\n\n\n\n<li>Limits are the ceiling. Above 200m CPU, the container is throttled (slowed down, not killed). Above 128Mi memory, it is killed with OOMKilled.<\/li>\n\n\n\n<li>If you set limits without requests, Kubernetes copies the limits into the requests.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">A few other details in the file:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>No <code>metadata.namespace<\/code>, so the pod goes to my default namespace, <code>core<\/code>. The file stays reusable, but it only works if the context points at <code>core<\/code>.<\/li>\n\n\n\n<li>The container is named <code>web<\/code>, because <code>kubectl run<\/code> names it after the pod. Later commands like <code>kubectl logs web<\/code> use the pod name, not the container name.<\/li>\n\n\n\n<li>Env values must be strings. <code>value: 8080<\/code> without quotes is read as a number and rejected. Write <code>\"8080\"<\/code>.<\/li>\n\n\n\n<li>I removed the dry-run noise: <code>creationTimestamp: null<\/code>, <code>resources: {}<\/code> and <code>status: {}<\/code>. It&#8217;s harmless, but it hides the real content when you&#8217;re reading the file.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">QoS class<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Kubernetes gives every pod a Quality of Service class, worked out from its requests and limits:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Guaranteed: every container has requests equal to limits, for both CPU and memory.<\/li>\n\n\n\n<li>Burstable: at least one request or limit is set, but it isn&#8217;t Guaranteed. <code>web<\/code> is this one, because its requests are below its limits.<\/li>\n\n\n\n<li>BestEffort: nothing set. These pods are evicted first when a node runs out of memory.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Problem: jsonpath printed two blank lines<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">To check the QoS class, I ran:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>kubectl get pods -o jsonpath='{.spec.containers[0].resources}{\"\\n\"}{.status.qosClass}{\"\\n\"}'<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">It printed two empty lines. No error, just nothing.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The cause: <code>kubectl get pods<\/code>, with no name, returns a List. Its top level is <code>{\"kind\":\"List\",\"items\":[...]}<\/code>, so <code>.spec<\/code> and <code>.status<\/code> don&#8217;t exist there. jsonpath doesn&#8217;t error on a missing path. It prints nothing.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>kubectl get pod web -o jsonpath='{.spec.containers[0].resources}{\"\\n\"}{.status.qosClass}{\"\\n\"}'<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Or, to list them, go through <code>items<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>kubectl get pods -o jsonpath='{range .items[*]}{.metadata.name}{\"\\t\"}{.status.qosClass}{\"\\n\"}{end}'<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The rule I&#8217;m keeping: one object, start with <code>.spec<\/code>. A list, start with <code>.items[*]<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Result<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>NAME   READY   STATUS    RESTARTS   AGE   LABELS\nweb    1\/1     Running   0          35s   app=web,tier=frontend<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><code>prod<\/code> comes from <code>kubectl exec web -- printenv MODE<\/code>. Labels, env, port and resources: all four are the same in the file and on the running pod.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">A2: command vs args<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This one confuses a lot of people, so here is the short version first:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>command<\/code> replaces the image&#8217;s ENTRYPOINT (the program).<\/li>\n\n\n\n<li><code>args<\/code> replaces the image&#8217;s CMD (the arguments to that program).<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The task: two busybox pods. <code>sleeper<\/code> sets only <code>command<\/code>. <code>printer<\/code> sets <code>command<\/code> and <code>args<\/code>, and its logs give a line to save.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The skeletons, and what &#8212; means<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>kubectl run sleeper --image=busybox:1.36 --command --dry-run=client -o yaml -- sleep 3600\nkubectl run printer --image=busybox:1.36 --dry-run=client -o yaml -- sh -c \"echo hello; sleep 3600\"<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>--<\/code> ends kubectl&#8217;s own flags. Everything after it goes into the container. Without <code>--<\/code>, kubectl would try to read <code>sleep<\/code> as its own flag, and fail.<\/li>\n\n\n\n<li>With <code>--command<\/code>, what comes after <code>--<\/code> becomes the command.<\/li>\n\n\n\n<li>Without <code>--command<\/code>, it becomes args. That works with busybox, because busybox has no ENTRYPOINT, so the first arg becomes the program to run.<\/li>\n\n\n\n<li>The quotes keep <code>\"echo hello; sleep 3600\"<\/code> as one argument. Without them, my own shell would split it into words before kubectl ever saw it.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">sleeper<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>apiVersion: v1\nkind: Pod\nmetadata:\n  name: sleeper\nspec:\n  containers:\n  - name: sleeper\n    image: busybox:1.36\n    command: [\"sleep\", \"3600\"]<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>One list item per argument. <code>\"3600\"<\/code> is quoted, because every item must be a string. The number <code>3600<\/code> gets rejected.<\/li>\n\n\n\n<li><code>command: [\"sleep 3600\"]<\/code> as one string would look for a program literally called <code>sleep 3600<\/code>, and fail with executable file not found.<\/li>\n\n\n\n<li>Why a command at all? busybox&#8217;s default is CMD <code>[\"sh\"]<\/code>. Without a terminal, <code>sh<\/code> exits straight away, and the pod goes into CrashLoopBackOff. <code>sleep 3600<\/code> keeps the container alive for an hour. That&#8217;s the standard trick for a debug pod.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">printer<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>---\napiVersion: v1\nkind: Pod\nmetadata:\n  name: printer\nspec:\n  containers:\n  - name: printer\n    image: busybox:1.36\n    command: [\"sh\", \"-c\"]\n    args: [\"echo hello; sleep 3600\"]<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>---<\/code> separates YAML documents. Both pods are in one file, because they belong to the same scenario. One <code>apply<\/code> creates both.<\/li>\n\n\n\n<li><code>sh -c<\/code> runs the next argument as a script. The <code>args<\/code> item is that script, as one string.<\/li>\n\n\n\n<li>A shell is needed because <code>;<\/code> is shell syntax. Without <code>sh -c<\/code>, <code>command: [\"echo\", \"hello;\", \"sleep\", \"3600\"]<\/code> would just print hello; sleep 3600 and exit.<\/li>\n\n\n\n<li>The final argv is <code>command<\/code> + <code>args<\/code>, joined. <code>command: [\"sh\", \"-c\", \"echo hello; sleep 3600\"]<\/code> does exactly the same thing. I split it only to show both fields side by side.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">The four combinations<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Neither set: the image&#8217;s ENTRYPOINT + the image&#8217;s CMD.<\/li>\n\n\n\n<li>Only args: the image&#8217;s ENTRYPOINT + your args.<\/li>\n\n\n\n<li>Only command: your command, and the image&#8217;s CMD is ignored.<\/li>\n\n\n\n<li>Both: your command + your args.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">busybox has an empty ENTRYPOINT and CMD <code>[\"sh\"]<\/code>, which is why cases 2 and 3 both work here. Try nginx, and case 3 runs the command with no arguments at all, because nginx&#8217;s CMD is a set of flags, not a shell.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Saving the logs, and a wrong path<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>kubectl wait --for=condition=Ready pod\/printer --timeout=60s\nkubectl logs printer &gt; \/opt\/ckad\/00\/printer.txt<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><code>kubectl wait<\/code> blocks until the pod is Ready. Without it, <code>kubectl logs<\/code> right after <code>apply<\/code> can hit a container that hasn&#8217;t started yet.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">My first try was <code>kubectl logs printer &gt; printer.txt<\/code>. That wrote to my home folder, but the lab checks <code>\/opt\/ckad\/00\/printer.txt<\/code>. On the exam, a correct answer in the wrong path scores zero. I fixed it with <code>mv<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I also had a typo in a jsonpath check: a stray <code>\"<\/code> printed <code>[\"sleep\",\"3600\"]\"<\/code>. jsonpath prints any text outside <code>{}<\/code> as it is. Harmless here, but in an answer file it would make the answer wrong.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Result<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>NAME      READY   STATUS    RESTARTS   AGE\nsleeper   1\/1     Running   0          3m43s\nprinter   1\/1     Running   0          93s<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">A3: pull facts out of a pod<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The task: write <code>web<\/code>&#8216;s IP, node name and image to <code>\/opt\/ckad\/00\/web-info.txt<\/code>, one per line. One jsonpath call writes all three lines.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>kubectl get pod web -o jsonpath='{.status.podIP}{\"\\n\"}{.spec.nodeName}{\"\\n\"}{.spec.containers[0].image}{\"\\n\"}' &gt; \/opt\/ckad\/00\/web-info.txt<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>get pod web<\/code> names one object, so the jsonpath root is the Pod itself. That&#8217;s the A1 lesson again.<\/li>\n\n\n\n<li>Single quotes stop bash from touching <code>{<\/code>, <code>}<\/code>, <code>\"<\/code> and <code>$<\/code> inside the expression.<\/li>\n\n\n\n<li><code>{\"\\n\"}<\/code> is a literal newline. Without it, the output would be <code>10.42.1.33thornginx:1.27<\/code>, all on one line.<\/li>\n\n\n\n<li><code>&gt;<\/code> overwrites the file. <code>&gt;&gt;<\/code> would append, so a second run would duplicate the lines.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Where each value lives: spec vs status<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This is the part I want to remember. Two values are in <code>spec<\/code>, and one is in <code>status<\/code>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>.status.podIP<\/code>: the CNI (Flannel, on K3s) hands out the IP when the pod starts. It&#8217;s something the cluster assigns, not something I set.<\/li>\n\n\n\n<li><code>.spec.nodeName<\/code>: the scheduler writes this when it binds the pod to a node. It&#8217;s an assignment, not a request.<\/li>\n\n\n\n<li><code>.spec.containers[0].image<\/code>: the image you asked for. The image actually running, with its digest, is <code>.status.containerStatuses[0].imageID<\/code>.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Every Kubernetes object works like this. <code>spec<\/code> is the desired state, written by you or a controller. <code>status<\/code> is the observed state, written back by the cluster.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Finding a field path<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Two ways, with no memorizing:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>kubectl get pod web -o yaml<\/code>: read the indentation, then join the keys with <code>.<\/code>.<\/li>\n\n\n\n<li><code>kubectl explain pod.status.podIP<\/code>: shows the field&#8217;s documentation, and proves the path exists.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Preview first, then redirect<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">I ran the command once without <code>&gt;<\/code>, checked the three lines, then ran it again with <code>&gt; file<\/code>. It costs a second, and it saves a wrong file.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">And why jsonpath instead of copying from <code>kubectl get pods -o wide<\/code> by hand? Typing values by hand risks a typo in an IP, and the checker compares exact strings.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Result<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>10.42.1.33\nthor\nnginx:1.27<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">It matches the IP and NODE columns of <code>kubectl get pods -o wide<\/code>. All three pods are on 10.42.1.x, because K3s puts all the pods on the same node network.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What I learned<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Skeleton first, then edit. <code>kubectl run --dry-run=client -o yaml<\/code> gives correct YAML indentation in seconds.<\/li>\n\n\n\n<li><code>set-context --namespace<\/code> only changes the default. It moves nothing, and a <code>namespace:<\/code> in a file still wins.<\/li>\n\n\n\n<li>One object, <code>.spec<\/code>. A list, <code>.items[*]<\/code>. jsonpath doesn&#8217;t fail on a wrong path. It prints nothing.<\/li>\n\n\n\n<li><code>command<\/code> is ENTRYPOINT, <code>args<\/code> is CMD. After <code>--<\/code> in <code>kubectl run<\/code>, it&#8217;s args, unless you add <code>--command<\/code>.<\/li>\n\n\n\n<li>Every list item in <code>command<\/code> and <code>args<\/code> is a string, and one string is one argument.<\/li>\n\n\n\n<li><code>spec<\/code> is what you asked for. <code>status<\/code> is what the cluster saw.<\/li>\n\n\n\n<li>Check the path of every answer file. A right answer in the wrong place scores zero.<\/li>\n\n\n\n<li>Preview a query before you redirect it to a file.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">What is next<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In Part 2, I break things on purpose. I change an image on a running pod (that works) and a CPU limit (that fails). I also learn why some fields are immutable, and how to recover when I change the wrong one.<\/p>\n\n","protected":false},"excerpt":{"rendered":"<p>Why I&#8217;m writing this Hi, I&#8217;m Reza. I usually share my projects from the beginning. This series is a little different: it&#8217;s&hellip;<\/p>\n","protected":false},"author":2,"featured_media":370,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_rezaops_part":"1","_rezaops_linkedin_url":"https:\/\/www.linkedin.com\/pulse\/ckad-prep-part-1-building-pods-yaml-way-reza-chegini-itvbc\/","footnotes":""},"categories":[10,62,9,74],"tags":[224,225,68,5,3,4,6],"series":[226],"class_list":["post-372","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops","category-home-lab","category-kubernetes","category-linux","tag-ckad","tag-jsonpath","tag-k3s","tag-kubectl","tag-kubernetes","tag-pods","tag-yaml","series-ckad-prep"],"jetpack_featured_media_url":"https:\/\/rezachegini.com\/wp-content\/uploads\/2026\/12\/ckad-prep-part-1-cover.png","_links":{"self":[{"href":"https:\/\/rezachegini.com\/index.php?rest_route=\/wp\/v2\/posts\/372","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rezachegini.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rezachegini.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rezachegini.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/rezachegini.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=372"}],"version-history":[{"count":1,"href":"https:\/\/rezachegini.com\/index.php?rest_route=\/wp\/v2\/posts\/372\/revisions"}],"predecessor-version":[{"id":373,"href":"https:\/\/rezachegini.com\/index.php?rest_route=\/wp\/v2\/posts\/372\/revisions\/373"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/rezachegini.com\/index.php?rest_route=\/wp\/v2\/media\/370"}],"wp:attachment":[{"href":"https:\/\/rezachegini.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=372"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rezachegini.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=372"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rezachegini.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=372"},{"taxonomy":"series","embeddable":true,"href":"https:\/\/rezachegini.com\/index.php?rest_route=%2Fwp%2Fv2%2Fseries&post=372"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}