Configuring prometheus using helm onto a specific node in kubernetes

4/27/2021

I am trying to configure Prometheus using Helm in Kubernetes and I have tried to execute the command as below and the deployment was successful.

$ helm install prometheus prometheus-community/prometheus --namespace prometheus --set 
nodeSelector.nodetype=infra
NAME: prometheus
LAST DEPLOYED: Tue Apr 27 22:47:20 2021
NAMESPACE: prometheus
STATUS: deployed

However, when I try to describe the pods created, I am unable to see the nodeSelector value as "nodetype=infra". Can someone please point me out as to where I am missing out.

$ kubectl get pods -n prometheus                              
NAME                                             READY   STATUS    RESTARTS   AGE
prometheus-alertmanager-7f86c968db-vln2x         2/2     Running   0          61m
prometheus-kube-state-metrics-6bfcd6f648-6cdbw   1/1     Running   0          61m
prometheus-node-exporter-7q9lh                   1/1     Running   0          61m
prometheus-pushgateway-54576f7765-6kjt5          1/1     Running   0          61m
prometheus-server-7c9b8dbfcd-9x48b               2/2     Running   0          61m

$ kubectl describe pod prometheus-alertmanager-7f86c968db-vln2x -n prometheus
Name:         prometheus-alertmanager-6bc84b9455-4g9mw
Namespace:    prometheus
Priority:     0
..
QoS Class:       BestEffort
Node-Selectors:  <none> --> This is the field I'm expecting to have "nodetype=infra"

Tolerations:     node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                 node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
-- Bhargav Mg
kubernetes
kubernetes-helm
prometheus

1 Answer

4/27/2021

You need to configure the nodeSelector for each component

alertmanager:
   nodeSelector:
      nodetype: infra
nodeExporter:
   nodeSelector:
      nodetype: infra
server:
   nodeSelector:
      nodetype: infra
pushgateway:
   nodeSelector:
      nodetype: infra

You can fin all the values here

-- XciD
Source: StackOverflow