"The Prometheus Operator for Kubernetes provides easy monitoring definitions for Kubernetes services and deployment and management of Prometheus instances."
Bitnami kindly provided/maintained a Helm Chart of Prometheus Operator make it easy to start/deploy the Prometheus Operator in Kubernetes Cluster. Today, we will walk through the steps to get it running in your Kubernetes cluster.- Set up Helm and add Bitnami Helm Repo
- You need have a Kubernetes cluster ready to deploy the Prometheus Operator on, I am using the docker-desktop cluster running on Windows 10.
- You need do "helm init" to install the Tiller to your running K8S cluster.
- You need run "helm repo add bitnami https://charts.bitnami.com/bitnami" to add Bitnami Helm Repo.
- Create the secret that contains your Additional Scrape Configuration
- Create a local file named: additional-scrape-configs.yaml with content looks like:
- Run the following command to make a secret out of the configuration file:
- Apply the secret file to create the secret in your Kubernetes Cluster:
- Install the bitnami/prometheus-operator Helm chart
- Port forwarding for the prometheus to access it from your host machine
- If everything went well, you should be able to access the prometheus from you host's web browser at http://localhost:9090
- Last, you can start your prometheus instrumented app on your host to let the prometheus scrape some data.
- You can go to the Targets on http://localhost:9090 to verify that the static target(s) configured Additional Scrape Configuration is UP.
If you don't have the correct named secret created or the format is malformed, the prometheus pod will not be started, and it is pretty hard to understand what is going on. Luckily you can watch the log from your svc/prometheus-operator-operator by using the following command to diagnose:
- kubectl logs -f svc/prometheus-operator-operator