...
NAME READY UP-TO-DATE AVAILABLE AGE
metrics-server 1/1 1 1 6d20h
Step 3: Installing and Setting Up the Prometheus Software and Adapter
You must install and set up the Prometheus Adapter software and adapter to track custom metrics. SnapLogic uses the kube-prometheus-stack
package from the following sources:
...
Installing the Prometheus Software
- Install Prometheus Adapter software by deploying the following Helm Create the custom_values.yaml file.
Code Block prometheus: service: type: LoadBalancer port: 80 # AWS EKS specific setting annotations: service.beta.kubernetes.io/aws-load-balancer-internal: "true" prometheusSpec: # Expose additional targets which can be discovered by Prometheus additionalScrapeConfigs: - job_name: 'snaplogic-snaplex-hpa-jcc-autoscale-metrics'title custom_values.yaml The following example shows custom_values.yaml chart.
Code Block
(Optional) Create your own namespace by adding the namespace entry into the following field.NAME_SPACE=monitoring PROMETHEUS_VERSION=14.0.1 PROM_RELEASE_NAME=prometheus # create namespace kubectl create namespace $NAME_SPACE # install Prometheus helm repo add prometheus-community https://prometheus-community.github.io/helm-charts helm install $PROM_RELEASE_NAME prometheus-community/kube-prometheus-stack --version $PROMETHEUS_VERSION --namespace $NAME_SPACE -f custom_values.yaml
prometheusSpec.additionalScrapeConfigs.kubernetes_sd_configs.namespaces.names
The following example shows custom_values.yaml chart.title custom_values.yaml prometheus: service: type: LoadBalancer port: 80 # AWS EKS specific setting annotations: service.beta.kubernetes.io/aws-load-balancer-internal: "true" prometheusSpec: # Expose additional targets which can be discovered by Prometheus additionalScrapeConfigs: - job_name: 'snaplogic-snaplex-hpa-jcc-autoscale-metrics' scrape_interval: 15s metrics_path: '/autoscale_metrics' # default is metrics kubernetes_sd_configs: - role: pod namespaces: names: - default # If you install the Snaplex in your own namespace, you have to provide here. # - snaplogic scheme: https tls_config: insecure_skip_verify: true relabel_configs: - source_labels: [__meta_kubernetes_namespace] action: replace target_label: namespace - source_labels: [__meta_kubernetes_pod_name] action: replace target_label: pod - source_labels: [__address__] action: replace regex: ([^:]+)(?::\d+)? replacement: ${1}:8081 target_label: __address__ - source_labels: [__meta_kubernetes_pod_label_app_kubernetes_io_type] action: keep regex: jcc # Name for the Pod to match grafana: # set 'enabled: true' if you want to enable the Grafana dashboard enabled: false service: type: LoadBalancer port: 80 # AWS EKS specific setting annotations: service.beta.kubernetes.io/aws-load-balancer-internal: "true" alertmanager: enabled: false
Create your own namespace by adding the namespace entry into the following field.
prometheusSpec.additionalScrapeConfigs.kubernetes_sd_configs.namespaces.names
In the custom_values.yaml Helm chart, the namespace is snaplogic; however, it is commented out in the chart. To use SnapLogic as your namespace, uncomment those lines:Code Block # If you install the Snaplex in your own namespace, you have to provide here. # - snaplogic
Install Prometheus software by deploying the following Helm chart.
Code Block NAME_SPACE=monitoring PROMETHEUS_VERSION=14.0.1 PROM_RELEASE_NAME=prometheus # create namespace kubectl create namespace $NAME_SPACE # install Prometheus helm repo add prometheus-community https://prometheus-community.github.io/helm-charts helm install $PROM_RELEASE_NAME prometheus-community/kube-prometheus-stack --version $PROMETHEUS_VERSION --namespace $NAME_SPACE -f custom_values.yaml
- Verify that the Prometheus and Grafana services by running the following command.
$ kubectl get all -n monitoring
Verify that the Prometheus and Grafana services by running the following command.Code Block NAME READY STATUS RESTARTS AGE pod/alertmanager-prometheus-kube-prometheus-alertmanager-0 2/2 Running 0 19m pod/prometheus-grafana-6f5448f95b-68zdt 2/2 Running 0 19m pod/prometheus-kube-prometheus-operator-8556f58759-tlxb8 1/1 Running 0 19m pod/prometheus-kube-state-metrics-6bfcd6f648-ckzf6 1/1 Running 0 19m pod/prometheus-prometheus-kube-prometheus-prometheus-0 2/2 Running 1 19m pod/prometheus-prometheus-node-exporter-fgc5x 1/1 Running 0 19m pod/prometheus-prometheus-node-exporter-r7dgf 1/1 Running 0 19m pod/prometheus-prometheus-node-exporter-rd8pz 1/1 Running 0 19m NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE service/alertmanager-operated ClusterIP None <none> 9093/TCP,9094/TCP,9094/UDP 19m service/prometheus-grafana LoadBalancer 10.100.153.99 internal-xxxx.us-west-2.elb.amazonaws.com 80:30324/TCP 19m service/prometheus-kube-prometheus-operator ClusterIP 10.100.234.140 <none> 443/TCP 19m service/prometheus-kube-prometheus-prometheus LoadBalancer 10.100.20.88 internal-xxxx.us-west-2.elb.amazonaws.com 80:31644/TCP 19m service/prometheus-kube-state-metrics ClusterIP 10.100.184.76 <none> 8080/TCP 19m service/prometheus-operated ClusterIP None <none> 9090/TCP 19m service/prometheus-prometheus-node-exporter ClusterIP 10.100.216.232 <none> 9100/TCP 19m NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE daemonset.apps/prometheus-prometheus-node-exporter 3 3 3 3 3 <none> 19m NAME scrape_interval: 15s READY metrics_path: '/autoscale_metrics' # default is metrics UP-TO-DATE AVAILABLE AGE deployment.apps/prometheus-grafana kubernetes_sd_configs: - role: pod 1/1 1 namespaces: 1 names: 19m deployment.apps/prometheus-kube-prometheus-operator 1/1 1 - default 1 19m # If you install the Snaplex in your own namespace, you have to provide here.deployment.apps/prometheus-kube-state-metrics 1/1 1 1 # - snaplogic 19m NAME scheme: https tls_config: insecure_skip_verify: true relabel_configs: - source_labels: [__meta_kubernetes_namespace] action: replace DESIRED CURRENT READY target_label: namespaceAGE replicaset.apps/prometheus-grafana-6f5448f95b - source_labels: [__meta_kubernetes_pod_name] 1 action: replace 1 target_label: pod 1 - source_labels: [__address__]19m replicaset.apps/prometheus-kube-prometheus-operator-8556f58759 1 action: replace1 1 regex: ([^:]+)(?::\d+)? 19m replicaset.apps/prometheus-kube-state-metrics-6bfcd6f648 replacement: ${1}:8081 1 target_label: __address__1 1 - source_labels: [__meta_kubernetes_pod_label_app_kubernetes_io_type] 19m NAME action: keep regex: jcc # Name for the Pod to match grafana: # set 'enabled: true' if you want to enable the Grafana dashboard enabled: false service: type: LoadBalancer port: 80 READY # AWS EKS specific settingAGE statefulset.apps/alertmanager-prometheus-kube-prometheus-alertmanager 1/1 annotations:19m statefulset.apps/prometheus-prometheus-kube-prometheus-prometheus service.beta.kubernetes.io/aws-load-balancer-internal: "true" alertmanager: enabled: false
$ kubectl get all -n monitoring1/1 19m
- Access the Prometheus and Grafana UIs with the respective IP addresses under the EXTERNAL-IP column.
Installing the Prometheus Adapter
...