Skip to content

Kepler Operator on Kind


Before you start make sure you have:

  • kubectl installed
  • Clone the kepler-operatorrepository
  • You’ll need a Kubernetes cluster to run against. You can use KIND to get a local cluster for testing, or run against a remote cluster. Note: Your controller will automatically use the current context in your kubeconfig file (i.e. whatever cluster kubectl cluster-info shows).
  • Signed in as kubeadmin or a user with cluster-admin role

Run a kind cluster locally

cd kepler-operator
make cluster-up CLUSTER_PROVIDER='kind' CI_DEPLOY=true GRAFANA_ENABLE=true

kubectl get pods -n monitoring

grafana-b88df6989-km7c6                1/1     Running   0          48m
prometheus-k8s-0                       2/2     Running   0          46m
prometheus-operator-6bd88c8bdf-9f69h   2/2     Running   0          48m

Run kepler-operator

  • You can use the image from to deploy kepler-operator.
make deploy
kubectl config set-context --current --namespace=monitoring
kubectl apply -k config/samples/
  • Verify kepler-exporter pods using the command kubectl get pods -n monitoring

Set up Grafana Dashboard

Using GRAFANA_ENABLE=true configured the kube-prometheus monitoring stack in the namespace monitoring. To access the Grafana Console locally on the browser port-forward on 3000 using the following command:

kubectl port-forward svc/grafana 3000:3000 -n monitoring

Note: Grafana Console can be accessed on http://localhost:3000

Service Monitor

For kube-prometheus to scrape kepler-exporter service endpoint you need to configure a service monitor.

Note: By default kube-prometheus does not let you scrape services deployed in namespaces other than monitoring. So if you are running kepler outside monitoring follow this to set up prometheus to scrape all namespaces.

kubectl apply -n monitoring -f - <<
kind: ServiceMonitor
  labels: exporter kepler-exporter kepler
  name: monitor-kepler-exporter
  - interval: 3s
    port: http
    - action: replace
      regex: (.*)
      replacement: $1
      - __meta_kubernetes_pod_node_name
      targetLabel: instance
    scheme: http
    any: true
    matchLabels: exporter kepler-exporter

Grafana Dashboard

To set up the grafana dashboard follow these steps:

Uninstall the operator

To delete the CRDs from the cluster:

make undeploy

To run Kepler operator on a kind cluster follow


Scrape all namespaces

kube-prometheus by default does not let you scrape services in namespaces outside monitoring. This is controlled by RBAC. The clusterrole prometheus-k8s should have below policy to scrape services in all namespaces.

oc describe clusterrole prometheus-k8s
Name:         prometheus-k8s
Annotations:  <none>
  Resources                    Non-Resource URLs  Resource Names  Verbs
  ---------                    -----------------  --------------  -----
  endpoints                    []                 []              [get list watch]
  pods                         []                 []              [get list watch]
  services                     []                 []              [get list watch]  []                 []              [get list watch]
                               [/metrics]         []              [get]
  nodes/metrics                []                 []              [get]

Copyright Contributors to the Kepler's project.

The Linux Foundation® (TLF) has registered trademarks and uses trademarks. For a list of TLF trademarks, see Trademark Usage.