Wednesday, July 3, 2024
HomeServerMonitoring & ManagementHow To Install Netdata on Kubernetes using Helm

How To Install Netdata on Kubernetes using Helm

install netdata on kubernetes using helm 1

Netdata is an opensource solution for monitoring and troubleshooting systems. It can be used to monitor a kubernetes cluster and display information about your cluster including node memory usage, CPU, network and many more.

Netdata dashboard gives you a broad view of your Kubernetes cluster including the services and pods running on each node.

In this post, we shall cover how to deploy Netdata on a Kubernetes cluster using Helm chart. This kind of installation deploys one parent pod on the master and child pods on each worker node.

The child pods collects metrics from the nodes they run on, kube-proxy, kubelet and cgroup metrics from the nodes.

The child nodes also use a generic prometheus collector and service discovery to deliver the metrics.

Pre-requisites

Before we can install Netdata on our cluster, you need to meet the following conditions:

  • A fully functional Kubernetes cluster, v1.9 and above.
  • Kubectl command-line tool
  • Helm package manager, version 3.0.0 and above.

Install Netdata on Kubernetes using Helm

Use the steps below to install Netdata in your Kubernetes Cluster using Helm chart.

Step 1 – Install Helm on Linux | macOS

These are the steps you’ll use to install Helm on a Linux | macOS system.

  • Download Helm package from this link
  • Extract the package using tar -xvzf <downloaded-package>
  • Move the binary file to usr/local/bin/helm

We will use installation script which automates above steps.

curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
chmod 700 get_helm.sh
sudo ./get_helm.sh

macOS users can also use brew package management tool.

$ brew install helm

Once installed confirm by checking the current version:

$ helm version
version.BuildInfo{Version:"v3.9.0", GitCommit:"7ceeda6c585217a19a1131663d8cd1f7d641b2a7", GitTreeState:"clean", GoVersion:"go1.17.5"}

  • Add helm chart repository then update helm
$ helm repo add stable https://charts.helm.sh/stable
$ helm repo update
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "stable" chart repository
Update Complete. ⎈Happy Helming!⎈

Step 2 – Install Netdata using Helm chart

You can install Helm chart using two methods:

  1. Install from Netdata’s Helm repository
  2. Clone Netdata Git repository.

We shall explore both methods

Option 1: Install from Helm repository

Add Netdata’s Helm repository then install Helm chart

helm repo add netdata https://netdata.github.io/helmchart/
helm install netdata netdata/netdata

Check the list of configurable parameters of the netdata chart and their default values. In below example we’re setting StorageClass name:

$ kubectl get sc
NAME              PROVISIONER                     RECLAIMPOLICY   VOLUMEBINDINGMODE   ALLOWVOLUMEEXPANSION   AGE
rook-ceph-block   rook-ceph.rbd.csi.ceph.com      Delete          Immediate           true                   227d
rook-cephfs       rook-ceph.cephfs.csi.ceph.com   Delete          Immediate           true                   227d

#Deploy Netdata while using rook-cephfs
$ helm install netdata netdata/netdata \
  --set parent.database.storageclass="rook-cephfs" \
  --set parent.alarms.storageclass="rook-cephfs"

#Give it sometime then check PVCs created
$ kubectl get pvc
NAME                      STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   AGE
netdata-parent-alarms     Bound    pvc-14b6b1ec-128c-4c73-a9ac-84e2019faed7   1Gi        RWO            rook-cephfs    37s
netdata-parent-database   Bound    pvc-1faa198f-b8e1-4361-a1af-bbb20a38c8f2   2Gi        RWO            rook-cephfs    37s

To uninstall/delete netdata deployment, run:

helm delete netdata

Option 2: Clone Github repository

You can also clone repo from Github and install helm chart. But first, make sure you have git installed to your system

Clone git repository locally

git clone https://github.com/netdata/helmchart.git netdata-helmchart

Install the chart

helm install netdata ./netdata-helmchart/charts/netdata

You can now see the helm deployments by:

$ helm list
NAME   	NAMESPACE	REVISION	UPDATED                                	STATUS  	CHART         	APP VERSION
netdata	wikijs   	1       	2022-06-02 17:14:57.522097888 +0300 EAT	deployed	netdata-3.7.18	v1.34.1

To check if the parent pod and the child pods have been successfully deployed:

$ kubectl get pods
NAME                              READY   STATUS    RESTARTS   AGE
netdata-child-fgh5c               2/2     Running   0          16h
netdata-child-qzhjp               2/2     Running   0          16h
netdata-child-ssmhp               2/2     Running   0          16h
netdata-parent-55d88fc784-x66ss   1/1     Running   0          16h

Step 3: Expose Netdata-parent with NodePort

In this guide, we will expose the netdata deployment using NodePort

Netdata is configured to run on port 19999 by default.

To expose the port, use the command below:

kubectl expose  deployment netdata-parent --type="NodePort" --port 19999

You can now check the port that service has been exposed use the kubectl get service command:

$ kubectl get service
NAME             TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)           AGE
kubernetes       ClusterIP   10.96.0.1       <none>        443/TCP           21h
netdata          ClusterIP   10.99.202.135   <none>        19999/TCP         17h
netdata-parent   NodePort    10.97.24.181    <none>        19999:30939/TCP   16h

In our deployment, netdata-parent service has been exposed to port 30939.

You can now access the netdata dashboard in your browser by http://<yourmaster-IP>:NodePort

e.g http://172.16.1.4:30939 is the url for our dashboard.

install netdata on kubernetes using helm1 1

You can check the metrics of all the nodes which are listed on the left pane as in the screenshot below.

install netdata on kubernetes using helm2

Then you can choose any node to check the stats:

install netdata on kubernetes using helm3.png

Conclusion

We have successfully installed Netdata on our Kubernetes cluster using Helm command-line tool.

Check out some of the related articles below:

Thapelo Manthata
I’m a desktop support specialist transitioning into a SharePoint developer role by day and Software Engineering student by night. My superpowers include customer service, coding, the Microsoft office 365 suite including SharePoint and power platform.
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments