Alright, next up is "Evicted! All the Ways Kubernetes Kills Your Pods (and How To Avoid Them)" by Ahmet Alp Balkan (of kubectx/kubens fame)
Alright, next up is "Evicted! All the Ways Kubernetes Kills Your Pods (and How To Avoid Them)" by Ahmet Alp Balkan (of kubectx/kubens fame)
What's the most important kubernetes component for reliability? Is it apiserver? core-dns? kubelet?
....
Nope.
Rather, it's a property: inertia. Objects that are running should stay running.
"Kubernetes was not designed with stateful systems in mind."
Shhhhhh Ahmet you're not supposed to say that part out loud!!!
There are extremely few knobs in Kubernetes to manage evictions, and most of them are "on/off" knobs, you don't get any fine-grained policies or configs around disruption.
(AND half the core kubernetes controllers ignore the controls that exist in the first place, 😡 )
First way to evict a pod is the pod delete API. Kubernetes didn't terminate your pod, you terminated your pod!
It doesn't do PDB checks!!!! Deployment controller uses this, so rollouts don't even check this!
Second way to evict a pod is the pod eviction API, which does respect PDBs.
This is the last time you will hear about the eviction API. Nobody uses it. Which is a real &$*%ing shame because everything should.
Can you write a webhook for the eviction API?
🤔
We're going to come back to this.
Node pressure evictions: (disk/memory/inodes/PIDs)
Kubelet starts killing pods before the node/OS/kernel does, hopefully to save things.
Kubelet dgaf about your PDB.
When a pod gets terminated state (e.g. by kubelet) it's stuck there. Ain't nobody going to restart your pod.
Deployment controller, replicaset controller don't restart your pod, they create a new pod somewhere else.
Next mode is kubelet local storage evictions: rather new feature in Kubernetes. If you set ephemeral storage constraints on your pods, kubelet will evict your pod.
Again, no PDBs here.
Kubelet is the honey badger of Kubernetes. It DGAF.
Next eviction path is the scheduler: if there's no room in the cluster, it will evict lower-priority pods to make room for higher-priority pods.
It DOES actually take PDBs into account, but it's BEST EFFORT. It will still pre-empt lower priority pods even if it would violate a PDB.
"Who here has accidentally deleted all your pods?"
drmorr raises his hand.
PodGC controller is the next eviction path: the pods are orphaned and something needs to clean them up.
Example: if you delete the node object (not the physical node, but the node object in etcd), the pods become orphaned and the podgc controller will clean up the pods (even if they're still actually running).
Actions you can take:
- look into kubelet eviction threshold settings
- disaster recovery drills
- tolerations for stateful apps
- admission controls for evictions
- understand what happens when a pod fails
> the information is not accurate and therefore miss leading.
Sorry, what information do you think is inaccurate? I can confirm that all of the things I mentioned in the thread are in fact ways that kubernetes might evict a pod.