Configure Kubernetes Monitoring with Grafana Kubernetes Monitoring Helm chart
Note
Configuration with the Grafana Kubernetes Monitoring Helm chart is recommended for use. However, you can also configure with Grafana Agent or Grafana Agent Operator manually.
To learn how the Helm chart configuration works, refer to Helm chart overview.
Before you begin
To deploy Kubernetes Monitoring with Grafana Kubernetes Monitoring Helm chart, you need:
- The Admin role to install alerts
- A Kubernetes Cluster, environment, or fleet you want to monitor
- The
kubectl
and Helm command-line tools - Appropriate versions of items related to:
- kube-state-metrics: Uses
client-go
to communicate with Clusters. For Kubernetes client-go version compatibility and any other related details, refer to kube-state-metrics. - OpenCost: Requires Kubernetes 1.8+ clusters.
- kube-state-metrics: Uses
Configuration process
The Grafana Kubernetes Monitoring Helm chart configuration includes the following steps:
- Navigate to Kubernetes Monitoring.
- Begin sending data.
- Connect your data sources for metrics and logs.
- Install alert and recording rules.
- Deploy the Helm chart with the Helm client or Terraform to begin scraping your data.
- Install integrations.
Navigate to Kubernetes Monitoring
Navigate to your stack and choose Kubernetes Monitoring.
Send data
Click the Start sending data button.
Kubernetes Monitoring displays the Configuration menu item in the Settings tab.
Connect data sources
In the Data sources section of the Settings tab, select the data sources you want for Kubernetes Monitoring.
Install alert and recording rules
Within the Backend installation section, click Install to install the preconfigured alert and recording rules.
Configure with Grafana Kubernetes Monitoring Helm chart
Click the Cluster configuration tab, and complete each section of the instructions.
Prerequisites
Make sure you have met the prerequisites required for these configuration steps.
Select features and enter Cluster information
In the Cluster name box, enter the name of your Cluster.
In the Namespace box, replace
default
with the namespace where you want to deploy your monitoring infrastructure.Select the platform you are using (for example, Kubernetes, OpenShift, EKS on Fargate, and so on).
Switch on or off the data you want to collect, including:
- Metrics
- Cost metrics
- Cluster events
- Pod logs
- OTLP receivers
- Zipkin receiver
Use a Grafana.com Access Policy Token
You can create a new access policy token or use an existing token. Refer to Grafana Cloud Access Policies for more information.
To use an existing token:
Click Use an existing token.
Paste the token into the Access policy token name box.
To create a new token:
Click Create a new token.
In the box for Access Policy Token name, enter the name of your token.
In the expiration date box, select an option for the expiration date.
The permission scope for the token appears.
Click Create token.
The token generates and appears in the token box. This token is automatically copied into the ConfigMap file.
Click the copy icon in the token box to copy the token. Make sure to save it in a secure place. It will not be shown again.
Deploy monitoring resources using Helm chart
Use the Helm client to deploy the Kubernetes Monitoring Helm chart to the Cluster.
Copy the command.
Paste and run it in your terminal.
Deploy monitoring resources using Terraform
Use Terraform to deploy the Kubernetes Monitoring Helm chart to the Cluster.
Copy, modify, and save the following files to your Terraform system set up using Terraform:
provider.tf
grafana-k8s-monitoring.tf
vars.tf
Deploy by using the commands
terraform init
andterraform apply
.
Configure application instrumentation
If you chose to include receivers in the Select features and enter cluster information section, a list of endpoints appear that you can use to configure the OTLP or Zipkin address of your applications that generate metrics, logs, and or traces.
Done
Click the Metrics status tab to view the status of data collection. Your data becomes populated as the system components begin scraping and sending data to Grafana Cloud. This view shows the health of the different sources of metrics, Pod logs, and Cluster events, as well as any applicable version numbers.
If any box shows “Offline”, it can be any of the following:
- The feature was not selected during Cluster configuration.
- The system is not running correctly.
- Alloy was not able to gather data correctly.
Install any integrations
You can use Grafana integrations to monitor the health and status of services and applications running in your Kubernetes clusters.
To install a Kubernetes integration to begin scraping metrics:
Click the Integrations tab.
Select the integration for the service you want to monitor.
Select your preferred deployment method (Helm Chart, Agent, or Agent Operator).
Add the provided code snippet to the ConfigMap, or deploy the provided Operator Object. Make sure to replace any template fields with values specific to your service.
Click Install integration. Installed integrations display a green checkmark on their tile.
If you want to use an integration not currently listed on the page, you can use embedded Agent exporters and integrations by configuring them manually. To learn how, refer to integrations_config.