diff --git a/ee/ucp/admin/configure/collect-cluster-metrics.md b/ee/ucp/admin/configure/collect-cluster-metrics.md index 953e3f21e6..e0adf0c0a5 100644 --- a/ee/ucp/admin/configure/collect-cluster-metrics.md +++ b/ee/ucp/admin/configure/collect-cluster-metrics.md @@ -39,5 +39,126 @@ ucp-metrics-hvkr7 3/3 Running 0 4h 192.168.80.66 3a7 ``` $ kubectl label node 3a724a-1 ucp-metrics= -node "noah-3a724a-1" labeled +node "test-3a724a-1" labeled +``` + +4. Patch the ucp-metrics DaemonSet's nodeSelector using the same key and value used for the node label. Here we again use the key “ucp-metrics” and the value “”. + +``` +$ kubectl -n kube-system patch daemonset ucp-metrics --type json -p '[{"op": "replace", "path": "/spec/template/spec/nodeSelector", "value": {"ucp-metrics": ""}}]' +daemonset "ucp-metrics" patched +``` + +5. Observe that ucp-metrics pods are running only on the labeled workers. + +``` +$ kubectl -n kube-system get pods -l k8s-app=ucp-metrics -o wide +NAME READY STATUS RESTARTS AGE IP NODE +ucp-metrics-88lzx 3/3 Running 0 12s 192.168.83.1 3a724a-1 +ucp-metrics-hvkr7 3/3 Terminating 0 4h 192.168.80.66 3a724a-0 +``` + +## Configure external Prometheus to scrape Prometheus metrics from UCP + +To configure your external Prometheus server to scrape metrics from Prometheus in UCP: + +1. Begin by sourcing an admin bundle. + +2. Create a Kubernetes secret containing your bundle’s TLS material. + +``` +(cd $DOCKER_CERT_PATH && kubectl create secret generic prometheus --from-file=ca.pem --from-file=cert.pem --from-file=key.pem) +``` + +3. Apply some YAML to create a Prometheus deployment and ClusterIP service. On AWS with Kube’s cloud provider configured, you could replace `ClusterIP` with `LoadBalancer` in the service YAML and then access the service through the load balancer. If you are running Prometheus external to UCP, change the following domain for inventory container in the Prometheus deployment from ucp-controller.kube-system.svc.cluster.local to a external domain for UCP accessible from the Prometheus node. + +``` +kubectl apply -f - <