Skip to main content

Helm Charts and Kubernetes Monitoring: The Sane Way

· 3 min read
Max Kaido
Architect

After spending days fighting with Kubernetes metrics collection and experiencing the pain of manual configuration, we've learned some valuable lessons. This post explains what Helm charts are, why they're essential for Kubernetes management, and how to use UI tools like Lens and Rancher for monitoring.

What the Hell are Helm Charts?

Helm is essentially a package manager for Kubernetes - think of it as apt/yum/brew but for K8s applications. Helm charts are pre-configured packages of Kubernetes resources that can be installed with a single command.

Why Helm Charts Matter

After our recent adventure trying to manually configure Prometheus and metrics collection in Kubernetes, we can confidently say: never do this manually if you value your sanity. Here's why Helm charts are superior:

  1. Pre-configured best practices: Charts are maintained by experts who understand the application's requirements
  2. Simplified installation: One command instead of dozens of YAML files
  3. Consistent upgrades: Easy version management and updates
  4. Dependency management: Charts can depend on other charts, handling complex deployments
  5. Customization: Values files allow you to customize without touching the templates

Basic Helm Commands

# Add a repository
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts

# Update repositories
helm repo update

# Search for charts
helm search repo prometheus

# Install a chart
helm install prometheus prometheus-community/kube-prometheus-stack

# Customize installation with values
helm install prometheus prometheus-community/kube-prometheus-stack -f my-values.yaml

# Upgrade a release
helm upgrade prometheus prometheus-community/kube-prometheus-stack

# List installed releases
helm list

# Uninstall a release
helm uninstall prometheus

The kube-prometheus-stack Chart

This is the chart we should have used from the beginning. It includes:

  • Prometheus server
  • Alertmanager
  • Grafana
  • Node exporter
  • Kube state metrics
  • Prometheus operator
  • ServiceMonitor and PodMonitor CRDs

Installing it is as simple as:

helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
helm install prometheus prometheus-community/kube-prometheus-stack

This would have saved us days of troubleshooting and configuration headaches.

Monitoring Through UI Tools

While command-line tools are powerful, UI tools can significantly simplify Kubernetes management, especially for monitoring.

Lens: The Kubernetes IDE

Lens is a desktop application that provides a comprehensive UI for managing Kubernetes clusters.

Built-in Prometheus/Grafana Support in Lens

Lens has excellent integration with Prometheus and Grafana:

  1. Metrics Explorer: Built directly into Lens, using Prometheus as the backend

    • Navigate to your cluster in Lens
    • Click on "Metrics" in the left sidebar
    • View CPU, memory, network, and storage metrics without leaving Lens
  2. Prometheus Integration:

    • Go to Lens → Settings → Extensions
    • Install the Prometheus extension
    • Configure the Prometheus URL (typically http://prometheus-server.monitoring:9090)
    • Access Prometheus queries and alerts directly in Lens
  3. Grafana Integration:

    • Go to Lens → Settings → Extensions
    • Install the Grafana extension
    • Configure the Grafana URL (typically http://grafana.monitoring:3000)
    • Access all your Grafana dashboards within Lens
  4. Metrics Visualization:

    • Right-click on any workload (pod, deployment, etc.)
    • Select "View Metrics" to see resource usage
    • Customize time ranges and metrics displayed

Rancher: Kubernetes Management Platform

Rancher is a complete container management platform that makes managing Kubernetes clusters easier.

Monitoring in Rancher

Rancher has built-in support for Prometheus and Grafana:

  1. Installing Monitoring:

    • In Rancher UI, go to your cluster
    • Click on "Apps & Marketplace"
    • Find and install "Monitoring" (powered by Prometheus and Grafana)
    • Follow the wizard to configure monitoring
  2. Accessing Grafana:

    • After installation, go to the cluster dashboard
    • Click on "Monitoring" in the left sidebar
    • Select "Grafana" to access the Grafana UI
    • Default dashboards are already set up for cluster monitoring
  3. Customizing Alerts:

    • In the Monitoring section, click on "Alerting"
    • Create and manage alert rules
    • Configure notification channels (email, Slack, etc.)
  4. Viewing Metrics:

    • Rancher provides a simplified metrics view for each workload
    • Click on any workload, then select the "Metrics" tab
    • View CPU, memory, network, and storage metrics

Lessons Learned

After our painful experience with manual Kubernetes metrics configuration, here are our key takeaways:

  1. Use Helm charts for complex applications - especially for monitoring stacks
  2. Leverage UI tools like Lens and Rancher for easier management
  3. Don't reinvent the wheel - use established patterns and tools
  4. Avoid manual RBAC configuration when possible - it's error-prone and complex
  5. Document cluster-specific quirks for future reference

Conclusion

Kubernetes is powerful but complex. Using Helm charts and UI tools like Lens and Rancher can significantly reduce this complexity, especially for monitoring. The next time you need to set up Prometheus and Grafana in Kubernetes, save yourself days of frustration and use the kube-prometheus-stack Helm chart along with a good UI tool.

Remember: life is too short to manually configure Kubernetes YAML files when better options exist.