SRE Newsletter

Share this post
Kubernetes Pods without the Kubernetes API
sreblog.substack.com

Kubernetes Pods without the Kubernetes API

Vitalie Brinza
May 21
Share this post
Kubernetes Pods without the Kubernetes API
sreblog.substack.com

I recently worked on my Kubernetes preparation and found out an interesting capability - the Static Pods.

It’s interesting to find something new about a technology after about 4 years of working with it in production environments.

The Static Pods are managed directly by the kubelet on a specific node without the Kubernetes API.

What is the use of this capability?

Let’s imagine you are a PaaS and the process of scaling of the Kuberentes cluster you offer needs to check something on the nodes before its added to the Kubernetes Control Plane. This could be done with a solution like Static Pods by launching a component on the node directly and doing the checks.

To demo it I will use 2 nodes: Worker Node 1 and Control Plane Node

1. On the Worker Node 1 create the following file:

$ sudo vi /etc/kubernetes/manifests/diagnostic.yml

2. Add the following into the file and save it :

apiVersion: v1

kind: Pod

metadata:

name: beebox-diagnostic

spec:

containers:

- name: beebox-diagnostic

image: acgorg/beebox-diagnostic:1

ports:

- containerPort: 80

3. On the Control Plane Node we will see a so called mirror Pod which is automatically created by kubelet , it’s visible to the API server and can’t be controlled by it.

Bellow you can see how I can delete the mirror pod from the Control Plane, it gets deleted but then it immediately is created back.

user@k8s-control:~$ kubectl get po

NAME READY STATUS RESTARTS AGE

diagnostic-k8s-worker1 1/1 Running 0 20s

user@k8s-control:~$ kubectl delete po diagnostic-k8s-worker1

pod "diagnostic-k8s-worker1" deleted

user@k8s-control:~$ kubectl get po

NAME READY STATUS RESTARTS AGE

diagnostic-k8s-worker1 0/1 Pending 0 2s

user@k8s-control:~$ kubectl get po

NAME READY STATUS RESTARTS AGE

diagnostic-k8s-worker1 1/1 Running 0 23s

user@k8s-control:~$

Sign up now so you don’t miss the next issue.

In the meantime, tell your friends!

Share this post
Kubernetes Pods without the Kubernetes API
sreblog.substack.com
Comments

Create your profile

0 subscriptions will be displayed on your profile (edit)

Skip for now

Only paid subscribers can comment on this post

Already a paid subscriber? Sign in

Check your email

For your security, we need to re-authenticate you.

Click the link we sent to , or click here to sign in.

TopNew

No posts

Ready for more?

© 2022 Vitalie Brinza
Privacy ∙ Terms ∙ Collection notice
Publish on Substack Get the app
Substack is the home for great writing