π§ The Internal Process Behind βAPIβ in Kubernetes (Made Human-Friendly)¶
π Scenario: You create a Pod using a YAML file¶
You write this YAML:¶
apiVersion: v1
kind: Pod
metadata:
name: myapp
spec:
containers:
- name: app
image: nginx
Whatβs really happening?
π Step-by-Step Breakdown¶
| Step | Action | Behind the Scenes |
|---|---|---|
| 1οΈβ£ | You run: kubectl apply -f pod.yaml | kubectl reads the YAML file |
| 2οΈβ£ | kubectl converts YAML into an API request | It forms an HTTP POST request |
| 3οΈβ£ | It sends this request to the Kubernetes API Server | The API server is the cluster's control center |
| 4οΈβ£ | API Server checks your YAML matches a known API Object (Pod) | This is an "API Object" β basically, a data structure Kubernetes understands |
| 5οΈβ£ | If itβs valid, API Server stores the object in etcd (database) | This is how Kubernetes remembers what to run |
| 6οΈβ£ | Then, Scheduler sees there's a new Pod β assigns a node | This starts actual container creation |
| β | Container runtime runs the Pod | Your app is live on a node |
π§© Understanding API Components Now¶
πΉ API Object:¶
- A type of resource you want Kubernetes to manage (like Pod, Service, Deployment)
- Each one has a schema (rules, properties)
- Defined in YAML and recognized by the Kubernetes API
πΉ API Request:¶
- The actual HTTP message (like
POST,GET) sent to the API Server - Created automatically by
kubectl, Helm, or the dashboard
πΉ API Endpoint:¶
-
A URL path on the API server like:
POST /api/v1/namespaces/default/pods -
Think of this like:
www.kubernetes-cluster.com/api/v1/...
π¬ kubeadm API?¶
kubeadmβs API isnβt an HTTP one. Instead, it defines config object types like:
InitConfigurationClusterConfiguration
When you write kubeadm-config.yaml, kubeadm reads it β interprets it β and makes the right decisions to initialize or join the cluster.
Same principle, just not over HTTP.
π¦ Conclusion¶
Your YAML β gets converted into β API Object
kubectl β sends it as β API Request
API server β receives it on β API Endpoint
Then cluster starts reacting to it.
π€ Whatβs Next?¶
Click here to learn more about Kubernetes API and how to interact with it in simple way. This is a great resource to learn more about Kubernetes API in-depth.