The DaemonSet in Kubernetes
In Kubernetes, we could deploy the Boatswain pod as a DaemonSet. Unlike a Deployment which we could replicates multiple pods across different nodes, a DaemonSet makes sure that a single pod runs on the selected nodes even if the node is newly added to the cluster. It is particular useful for storage daemon, log collection and monitoring on the node.
Running Boatswain as a DaemonSet
- Create the Boatswain namespace
- Setup the Boatswain token as a secret
- Setup the config file of the Boatswain DaemonSet
- Start the Boatswain DaemonSet
Create the Boatswain namespace
Let’s create a new namespace to separate the Boatswain setup from those already exist.
kubectl create namespace boatswain
Setup the Boatswain token as a secret
kubectl create secret generic boatswain --from-literal=token=<TO_BE_REPLACED> -n boatswain
Setup the config file of the Boatswain DaemonSet
Here comes the DaemonSet configuration.
Before saving the yaml file:
- Replace the version of Boatswain at line 17.
- Set the hostname of the target node which you want to install Boatswain or remove line 37 and 38 for installation on all nodes.
Start the Boatswain DaemonSet
kubectl create -f daemon-set.yaml
Check the status of the DaemonSet.
And we could read the metrics and logs on Boatswain.
The example above shows that it is possible to use Boatswain to monitor the Kuberenetes cluster. But currently it might not able to show the network metrics (confirmed on GKE cluster above). It might be related to the security settings and so far we haven’t investigated further about this issue. Moreover, running Boatswain on all nodes does not work well as the usage will hit the 2GB data limit of the beta trial in a few hours. If you have any suggestions or thoughts, please let us know. 😀