...
Additionally, should you choose to use the metrics data to configure auto-scaling for EC Deployments, you need to install a Prometheus adapter along with your Prometheus server.
If you have not installed the Prometheus server, proceed with the steps from prerequisites until the very end.
If you have already installed the Prometheus server, you can skip ahead to the steps for installing the Prometheus adapter here https://infozone.atlassian.net/wiki/spaces/UEPE4D/pages/edit-v2/303827024#Install-Prometheus-Adapter .
For more information about EC Deployments, refer to see Execution Context Deployments (ECDs) (4.3.0).
...
Note!
Only one instance of Prometheus is required in a Kubernetes cluster. This single Prometheus server will monitor and scrape for metrics from all the different namespaces in your Kubernetes cluster.
Prerequisite
You will need to install Helm3 first before installing Prometheus following the examples listed below. If you already have helm installed from when you installed Usage Engine, then you can skip this step.
...
The following steps show how to install the Prometheus server without the use of persistence. Be aware that your metrics data will not be retained should your deployment be brought down. We do not recommend deploying Prometheus without persistence into a production environment.
Add the helm repo for Prometheus.
Code Block helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
Install Prometheus using the helm install command. For this example, we opted to install the Prometheus server in its own namespace called prometheus. Enter the value of the port you want the Prometheus server node port to be configured with
Code Block helm install -n <namespace> prometheus prometheus-community/prometheus \ --set server.persistentVolume.enabled=false \ --set server.service.type=NodePort \ --set server.service.nodePort=<port> \ --set alertmanager.persistentVolume.enabled=false
Info |
---|
...
Example |
...
- helm install Prometheus
|
Installing Prometheus with Persistence
The following steps show how to install the Prometheus server with the use of persistence volumes on your Kubernetes cluster.
Create a yaml file and describe the Persistent Volume and Persistent Volume Claim for your Prometheus server. The example used here creates the persistent volume on an NFS file server that is mounted onto the cluster. The value set in nfs.path is the directory on the NFS file server that stores the metrics data.
Info |
---|
...
Example |
...
- Persistence for Prometheus
|
After creating the yaml file, run this command:
Code Block kubectl apply -f <persistent volume yaml> -n <namespace>
Add the helm repo for Prometheus.
Code Block helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
Install Prometheus using the helm install command. For this example, we opted to install the Prometheus server in its own namespace called prometheus. Enter the value of the port you want the Prometheus server node port to be configured with and set the name of the Persistent Volume Claim that you have created in the steps before.
Code Block helm install -n <namespace> prometheus prometheus-community/prometheus \ --set server.persistentVolume.enabled=true \ --set server.persistentVolume.accessModes=ReadWriteMany \ --set server.persistentVolume.existingClaim="prometheus-persistent" \ --set server.service.type=NodePort \ --set server.service.nodePort=<port> \ --set alertmanager.persistentVolume.enabled=false
Info |
---|
...
Example |
...
- helm install Prometheus - with |
...
Persistence
|
Verify the Prometheus Installation
This step will have you check that your Prometheus is deployed correctly.
After installing the Prometheus server, you will be given an export command to use to acquire the URL and the Port for the Prometheus server. The command can look something like this:
Code Block export NODE_PORT=$(kubectl get --namespace <namespace> -o jsonpath="{.spec.ports[0].nodePort}" services prometheus-server) export NODE_IP=$(kubectl get nodes --namespace <namespace> -o jsonpath="{.items[0].status.addresses[0].address}")
Info |
---|
...
Example |
...
- Exporting the |
...
Value for Prometheus Node IP and Node Port
|
To generate the URL from the result of the two export commands above, use this echo command. Then copy the result to your browser.
Code Block echo http://$NODE_IP:$NODE_PORT
Info |
---|
...
Example |
...
- Url for Prometheus GUI
|
Install Prometheus Adapter
...
...
For simplicity, there is a sample configuration file called prom-adapter-values.yaml. This file is configured with the rule to make all com.digitalroute related metrics available in Kubernetes. To find the url and port, you can use the export NODE_PORT command as shown on the verify the Prometheus installation steps above.
...
Note!
If you have installed your Prometheus server in its own namespace, make sure that the Prometheus adapter has access to your Prometheus server.
...
prom-adapter-values.yaml
Code Block |
---|
prometheus: url: http://192.168.52.26 port: 31010 logLevel: 6 rules: custom: - seriesQuery: '{__name__=~"^com_digitalroute.*"}' resources: overrides: namespace: {resource: "namespace"} pod: {resource: "pod"} name: matches: ^(.*) as: "" metricsQuery: sum(<<.Series>>{<<.LabelMatchers>>}) by (<<.GroupBy>>) |
...
Code Block |
---|
helm install -n <namespace> prometheus-adapter prometheus-community/prometheus-adapter -f <Prometheus adapter configuration file> |
Info | |||||
---|---|---|---|---|---|
title | Example | : - helm install Prometheus | adapterAdapter
|
...