Snap_k8s for Kubernetes
Snap_k8s is a Daemon used for monitoring Kubernetes nodes. The Docker image on the manifest is designed to be deployed into Kubernetes as a DaemonSet ...
...causing it to run on every node in the cluster and returning useful performance statistics to a Graphite output.
- Make sure your kubectl command line is configured to the context/cluster that you wish to monitor. Using AWS as an example, you would configure a context using this command:
kubectl config use-context arn:aws:eks:<region>:<account-id>:cluster/<cluster-name>
- Confirm you are in the correct context with this command:
kubectl config get-contextsand if you need help, you can read more about this in the AWS kubeconfig docs.
- Create a file with the .yml extension. In this example, we are naming the file snap_ds.yml. Copy/paste the following code block into the new file:
- name: snap
- mountPath: /sys/fs/cgroup
- mountPath: /var/run/docker.sock
- mountPath: /var/lib/docker
- mountPath: /usr/local/bin/docker
- mountPath: /proc_host
- mountPath: /opt/snap/tasks
- containerPort: 8181
- name: PROCFS_MOUNT
- name: dev
- name: cgroup
- name: docker-sock
- name: fs-stats
- name: docker
- name: proc
- name: snap-tasks
- Update the prefix and server lines at the end of the file, and save. Your API-KEY and ACCOUNT-UID can be located in your Hosted Graphite account => Send Metrics button.
- Then use this command to run the file and start the daemon:
kubectl create -f snap_ds.yml
- Confirm the daemon is running with this command
kubectl getpod to see a similar output:
NAME READY STATUS RESTARTS AGE
snap-dblx2 1/1 Running 0 56m
You should now be able to see metrics coming into your Hosted Graphite account with the snap prefix.
Check out the following repositories to learn more about the types of performance metrics that are collected with the Snap_k8s daemon:
Disclaimer: this agent collects a fairly large number of metrics, approximately 1,000 per node in each Kubernetes cluster it’s deployed into. If you wish to reduce the number of metrics collected, you could remove metric patterns from the ‘metrics’ section of the config.