Creating and managing DaemonSets
In order to demonstrate how DaemonSets work, we will use nginx
running in a Pod container that returns simple information about the Node IP address where it is currently scheduled. The IP address will be provided to the container using an environment variable and based on that, a modified version of index.html
in /usr/share/nginx/html
will be created. To access the DaemonSet endpoints, we will use a headless service, similar to what we did for StatefulSet
in Chapter 12, StatefulSet – Deploy Stateful Applications. Most of the real use cases of DaemonSets are rather complex and involve mounting various system resources to the Pods. We will keep our DaemonSet example as simple as possible to show the principles.
Important note
If you would like to work on a real example of a DaemonSet, we have provided a working version of Prometheus node-exporter
deployed as a DaemonSet behind a headless Service: https://github.com/PacktPublishing/Kubernetes...