Kubernetes 101 DaemonSets #5
Hello all , So today we will take a little look at daemonsets(DS) in Kubernetes, the idea behind DS is to ensure that all nodes (or some, depending on the selector) are running a copy of a given pod.
A good question would be when to use these , and the documentation refer to things that you might want to run forcefully and all nodes:
- Log Aggregation and collection
- Storage Clusters
- Monitoring
They’re described in yaml files like:
I’m using nginx as an image just to keep it simple , so let’s create it :)
So all looking good , the question is why we get nothing current or ready?
Daemonsets operate on selectors “app=logging-node” that means that for this pod (through a DS) to land copy of pods in nodes, there’s got to be a label in the node to match with the selector of the DS.
So let’s add or replace the label
kubectl label node minikube app=logging-node --overwrite
So there it is , a copy of the pod has landed in the node whose label matches the node selector , simple stuff right?
You could update images on the running DS for example with:
kubectl set image ds/logging webserver=nginx-1.2.3.4
Pretty cool stuff.
Next time let’s try to look into how to autoscale pods depending on various metrics? Hopefully i can make it work in minikube!
Thanks guys for all the reads and followings!