Monitoring

The Monitoring add-on provides metrics collection, dashboards, and alerting capabilities for MKE 4k clusters. It is built on the kube-prometheus-stack, and includes such components as Prometheus, Grafana, cAdvisor, and supporting exporters.

Configurable parameters

While a number of components are always enabled as they are required for core monitoring, you can enable and disable others through configuration flags under the monitoring section of the mke4.yaml configuration file.

ParameterTypeDefaultDescription
enableGrafanabool (optional)trueEnables and disables Grafana deployment.
grafana.ingress.enabledboolfalseCreates an Ingress resource to expose Grafana (path /grafana).

Effective only if enableGrafana is set to true.
enableCAdvisorboolfalseControls how cAdvisor metrics are scraped.
false
Prometheus scrapes cAdvisor metrics through kubelet.
true
Kubelet scraping is disabled; assumes that a standalone cAdvisor service is available.
prometheus.nodeSelectormap[string]string{}Node selector labels applied to Prometheus Pods to control scheduling. For example, pinning Prometheus to dedicated monitoring nodes.

Example mke4.yaml configuration file:

monitoring:
    enableGrafana: true
    grafana:
      ingress:
        enabled: false
    enableCAdvisor: false
    prometheus: {}
  • enableGrafana: true → Grafana is deployed by default.
  • grafana.ingress.enabled: false → Grafana is not exposed through Ingress by default.
  • enableCAdvisor: false → Prometheus scrapes cAdvisor metrics through kubelet.
  • prometheus: {} → Prometheus runs with default settings, as a nodeSelector is not applied.

Stack components

The following tables offer detail for the components deployed by the MKE 4k monitoring stack:

Always enabled

ComponentDescription
PrometheusCore metrics collection engine.
Prometheus OperatorManages Prometheus, AlertManager, and related CRDs.
Kube State MetricsExposes Kubernetes object and cluster state metrics.
Node ExporterProvides node-level metrics.

Optional

Optional stack components are exposed in the monitoring section of the mke4.yaml configuration file.

ComponentDescription
GrafanaDashboarding and visualization. Controlled by the enableGrafana parameter. Ingress exposure is controlled by the grafana.ingress.enabled parameter.
Kubelet cAdvisor metricsEnabled by default; disabled if enableCAdvisor is set to true.
ℹ️
If disabled, MKE 4k expects a standalone cAdvisor service.

Component Detail

ComponentEnabled / DisabledNotesHow to Toggle
Prometheus✅ Always enabledIncludes an additional ServiceMonitor for k0s-observability pushgateway. Configured to discover ServiceMonitors across all namespaces.Not applicable. Always on.
PrometheusOperator✅ Always enabledManages Prometheus and AlertManager CRDs. Admission webhook patch job also tolerates master taints.Not applicable. Always on.
KubeStateMetrics✅ Always enabledExposes cluster state metrics. Runs with tolerations for master node taints.Not applicable. Always on.
Node Exporter✅ Always enabledDeployed as a DaemonSet (monitoring-prometheus-node-exporter-*), one Pod per node. Provides node-level metrics (CPU, memory, filesystem, network). Scraped by Prometheus.Not applicable. Always on.
Grafana➡️ Controlled by monitoring.enableGrafanaProvides dashboards. If enabled, tolerates master taints. Ingress can also be enabled separately.monitoring.enableGrafana: true/false monitoring.grafana.ingress.enabled: true/false
Kubelet ServiceMonitor (cAdvisor)✅ Enabled by default.
❌ Disabled when monitoring.enableCAdvisor is true.
Uses the cAdvisor built into kubelet, unless an external standalone cAdvisor service is enabled.monitoring.enableCAdvisor: true/false

Access Prometheus

Prometheus is an open-source monitoring and alerting toolkit, designed for reliability and scalability, that collects and stores metrics as time series data. It offers powerful query capabilities and a flexible alerting system.

The Prometheus API is available at https://<mke4_url>/prometheus/

To access the Prometheus dashboard:

  1. Port forward Prometheus:

    kubectl --namespace mke port-forward svc/prometheus-operated 9090
  2. Navigate to http://localhost:9090.

Access Grafana

Grafana is an open-source monitoring platform that provides a rich set of tools for visualizing time-series data. It includes a variety of graph types and dashboards.

Grafana is enabled in MKE 4k by default and may be disabled through the mke4.yaml configuration file:

monitoring:
  enableGrafana: true

To access the Grafana dashboard:

  1. Obtain the admin user password for the Grafana dashboard from the monitoring-grafana secret in the mke namespace.

    kubectl get secret monitoring-grafana -n mke -o jsonpath="{.data.admin-password}" | base64 --decode
  2. Port forward Grafana:

    kubectl --namespace mke port-forward svc/monitoring-grafana 3000:80
  3. Navigate to http://localhost:3000 to access the Welcome to Grafana login page.

  4. Enter the default username admin into the Email or username field and type the password you retrieved from the monitoring-grafana secret into the Password field.

  5. Click Log In.

cAdvisor

cAdvisor is an open-source tool that collects, aggregates, processes, and exports information in reference to running containers.

cAdvisor is disabled in MKE 4k by default. You can enable the tool through the mke4.yaml configuration file:

monitoring:
  enableCAdvisor: true

MKE version comparison: Configuration parameters

MKE 3 parameterMKE 4k
cluster_config.node_exporter_portNot supported
cluster_config.prometheus_memory_limitNot supported
cluster_config.prometheus_memory_requestNot supported
cluster_config.metrics_scrape_intervalNot supported
cluster_config.metrics_retention_timeNot supported
Last updated on