Skip to content

Latest commit

 

History

History
38 lines (26 loc) · 1.48 KB

README.adoc

File metadata and controls

38 lines (26 loc) · 1.48 KB

Daemon Service

In this example, we learn how to create a Daemon Service for allowing to run infrastructure-focused Pods on specific nodes.

This example assumes a Kubernetes installation is available. In this case, it’s best played through with Minikube, as we need some support for PVs. Check the INSTALL documentation for installing Minikube.

This example used our random-generator application for periodically seeding /dev/random by writing 100000 random numbers every time to /dev/random.

This daemon service is a makeup example that should never be used for any application, as the generated random number is not entirely random.

Note
You could achieve a similar effect with a Periodic Job and appropriate nodeSelector. However, a Daemon Service is still safer for such a task, as it works without changes for nodes that will be added later.

Nevertheless, let’s create a DaemonSet with

kubectl apply -f https://k8spatterns.io/DaemonService/daemonset.yml

You can now check the generated pods with

kubectl get pods

You see one Pod per node of your cluster. For Minikube, it should be a single pod, and you can check the logs as usual.