It’s a common scenario to have a Percona Monitoring and Management (PMM) server running on Kubernetes and also desire to monitor databases that are running outside the Kubernetes cluster. The Ingress NGINX Controller is one of the most popular choices for managing the inbound traffic to K8s. It acts as a reverse proxy and load balancer and is well-known for its performance and scalability. Since PMM uses gRPC traffic for communication between the client and server, we need to make sure that it’s allowed; otherwise, we will get connection issues:

For more information on ports and protocols used by PMM (both the server and the client), check the online documentation manual:

https://docs.percona.com/percona-monitoring-and-management/setting-up/server/network.html

Installing PMM server

Installing a PMM server on K8s is as easy as executing the following commands. First, we need to create the secret:

Then add the Percona Helm repo:

Finally, issue the Helm install command:

The Helm list command should show us our PMM server correctly deployed:

For a complete guide, refer to the online documentation:

https://docs.percona.com/percona-monitoring-and-management/setting-up/server/helm.html#use-helm-to-install-pmm-server-on-kubernetes-clusters

Routing traffic to Kubernetes

A typical use case is routing traffic to a specific K8s backend service based on the hostname. The following link shows an example of this use case:

https://kubernetes.github.io/ingress-nginx/user-guide/basic-usage/

To install the ingress-nginx controller either using Helm or a YAML manifest, we can follow the below quick start guide:

https://kubernetes.github.io/ingress-nginx/deploy/#quick-start

Below, we have created the ingress-controller using the corresponding YAML file:

As a result, the ingress-nginx controller on K8s will have a load balancer service listening on ports 80 and 443 with an assigned external IP:

The PMM server will have its corresponding service:

A “DNS A” record pointing to the NGINX external IP should be added to the DNS to let NGINX route the traffic to the PMM service based on the hostname.

We’re now ready to create the Ingress to route external traffic to the PMM Server:

NGINX will automatically discover the ingress with the kubernetes.io/ingress.class: “nginx” annotation or where ingressClassName: nginx is present. The ingress object must be created inside the same namespace as the backend resource. The ingress should redirect the external IP traffic to the PMM service, which is the monitoring-service.

Additionally, the PMM ingress should have the nginx.ingress.kubernetes.io/backend-protocol: “GRPCS” annotation to ensure gRPC over HTTP/2 with TLS encryption is allowed. This will correctly route packets between the PMM client and the PMM server through the ingress-nginx controller.

Configuring the PMM client

Finally, we can configure our PMM client that is external to the K8s cluster to be monitored by the K8s PMM server:

At this point, the OS metrics exporter will be running, and we’ll start seeing new incoming metrics from this node in the PMM dashboards.

Conclusion

Since the PMM server and client communication require the use of the gRPC framework, we need to make sure that it’s enabled when adding the NGINX ingress controller to our Kubernetes setup. We can easily do so by applying the changes shown on the pmm-ingress.yaml file above.

Percona Monitoring and Management is a best-of-breed open source database monitoring solution tool for use with MySQL, PostgreSQL, MongoDB, and the servers on which they run. Monitor, manage, and improve the performance of your databases no matter where they are located or deployed.

 

Download Percona Monitoring and Management Today

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments