Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Grafana for visualization
📖 Scenario: You are working in a team that manages a Kubernetes cluster. You want to visualize the cluster's CPU usage using Grafana. To do this, you will deploy Grafana in the cluster and configure it to display CPU metrics.
🎯 Goal: Deploy Grafana on Kubernetes and configure it to visualize CPU usage metrics.
📋 What You'll Learn
Create a Kubernetes deployment for Grafana with the exact name grafana-deployment.
Create a Kubernetes service named grafana-service to expose Grafana on port 3000.
Add a ConfigMap named grafana-config with a basic Grafana configuration.
Print the command to get the Grafana service URL.
💡 Why This Matters
🌍 Real World
Grafana is widely used to visualize metrics from Kubernetes clusters and other systems. This project shows how to deploy and expose Grafana in a Kubernetes environment.
💼 Career
Understanding how to deploy monitoring tools like Grafana on Kubernetes is a key skill for DevOps engineers and site reliability engineers.
Progress0 / 4 steps
1
Create Grafana Deployment
Create a Kubernetes deployment named grafana-deployment with one replica. Use the image grafana/grafana:latest. Set the container port to 3000.
Kubernetes
Hint
Use kind: Deployment and specify replicas: 1. Set the container image and port exactly as instructed.
2
Create Grafana Service
Create a Kubernetes service named grafana-service of type NodePort that exposes port 3000 and targets the deployment with label app: grafana.
Kubernetes
Hint
Use kind: Service with type: NodePort. Match the selector label to the deployment's label.
3
Add Grafana ConfigMap
Create a ConfigMap named grafana-config with a key grafana.ini containing the text [server]\nhttp_port = 3000.
Kubernetes
Hint
Use kind: ConfigMap and add the key grafana.ini with the exact content.
4
Display Grafana Service URL
Write the command to get the NodePort of the grafana-service and print the full URL assuming the cluster node IP is 192.168.99.100. The output should be exactly: http://192.168.99.100:PORT where PORT is the NodePort number.
Kubernetes
Hint
Use kubectl get service grafana-service -o jsonpath={.spec.ports[0].nodePort} to get the NodePort. Then print the URL with the given IP.
Practice
(1/5)
1. What is the main purpose of Grafana in a Kubernetes environment?
easy
A. To visualize and monitor data from Kubernetes clusters
B. To deploy applications automatically
C. To manage Kubernetes user permissions
D. To store container images
Solution
Step 1: Understand Grafana's role
Grafana is a tool designed to create visual dashboards from data sources.
Step 2: Connect Grafana to Kubernetes data
In Kubernetes, Grafana connects to metrics sources to visualize cluster health and performance.
Final Answer:
To visualize and monitor data from Kubernetes clusters -> Option A
Quick Check:
Grafana = Visualization and Monitoring [OK]
Hint: Grafana = Visualize data, not deploy or store [OK]
Common Mistakes:
Confusing Grafana with deployment tools
Thinking Grafana manages permissions
Assuming Grafana stores images
2. Which Kubernetes resource is commonly used to deploy Grafana?
easy
A. Pod
B. Deployment
C. ConfigMap
D. ServiceAccount
Solution
Step 1: Identify deployment method
Grafana runs as an application that needs to be managed and scaled.
Step 2: Choose Kubernetes resource for managing apps
Deployments manage pods and allow updates and scaling.
Final Answer:
Deployment -> Option B
Quick Check:
Deployments = Manage app lifecycle [OK]
Hint: Use Deployment to run and scale Grafana pods [OK]
Common Mistakes:
Using Pod directly without Deployment
Confusing ConfigMap with deployment
Thinking ServiceAccount deploys apps
3. Given this snippet of a Grafana dashboard JSON, what type of visualization will it create?