Urgent.News

What's breaking now, across thousands of outlets.

Tech

What Actually Happens When You Run kubectl apply

You type kubectl apply -f deployment.yaml , it says created , and a few seconds later your app is running. It feels like magic, and because it feels like magic, most people never learn what happens in between, which is exactly the knowledge that makes Kubernetes debugging possible. Let me trace the whole journey from your terminal to a running pod, step by step. Once you can follow this path,…

When you execute the command "kubectl apply -f deployment.yaml", Kubernetes creates an API request on your machine after parsing and validating the YAML file. This request must be authenticated and authorized by the API server, otherwise it will be rejected with a "forbidden" error. Admission controllers may further validate or modify the request, and then the object is stored in etcd, representing the desired state.

The controllers monitor for discrepancies between the desired and actual state, creating objects like ReplicaSets and Pods to match the desired state. The scheduler assigns these Pods to worker nodes based on resource availability and constraints. The kubelet on each node pulls the container images and starts the containers. Probes such as liveness and readiness determine when the Pod receives traffic.

Understanding this entire process enables effective debugging of common Kubernetes issues, as each error typically corresponds to a specific step in this journey.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

More from Saturday 26 September →