Kubernetes Monitoring with Prometheus u0026 Grafana Quiz Quiz

Challenge your understanding of Kubernetes monitoring concepts with a focus on Prometheus metrics collection and Grafana visualization. This quiz covers setup basics, metrics scraping, alerting, and dashboard configuration within a Kubernetes environment.

  1. Prometheus Metrics Scraping Configuration

    Which configuration enables Prometheus to collect metrics from a Kubernetes service on all nodes within the cluster automatically?

    1. Setting up StaticConfigs with manual target IP addresses
    2. Using a Kubernetes ServiceMonitor with appropriate label selectors
    3. Defining an AlertmanagerConfig resource for target discovery
    4. Configuring a NodeExporter DaemonSet without any scrape targets

    Explanation: A ServiceMonitor in Kubernetes allows Prometheus to automatically discover and scrape metrics from services that match specified labels across all nodes. StaticConfigs require manual IP addresses, making them less scalable and more error-prone. A NodeExporter DaemonSet by itself exposes metrics but does not configure Prometheus to scrape targets. An AlertmanagerConfig deals with alert routing and does not affect metrics scraping.

  2. Grafana Data Source Setup

    What is the primary purpose of adding a Prometheus data source in Grafana when monitoring a Kubernetes cluster?

    1. To enable alerting rules for container crashes
    2. To assign user permissions to Kubernetes pods
    3. To securely store time-series data within the dashboard
    4. To query, filter, and visualize collected metrics from Prometheus

    Explanation: Adding a Prometheus data source lets Grafana access, visualize, and analyze the collected metrics for your Kubernetes cluster. Alerting rules are configured within Prometheus or Grafana, but adding a data source is about connecting to metric data. Storing data is handled by Prometheus, not Grafana dashboards. User permissions for pods are managed elsewhere and not by adding data sources.

  3. Alerting with Prometheus

    Which mechanism allows Prometheus to automatically notify you when the CPU usage of a Kubernetes pod exceeds a defined threshold?

    1. Alerting Rules
    2. PodExporters
    3. MetricsSecretes
    4. Grafna Playlists

    Explanation: Alerting Rules in Prometheus define the conditions under which notifications are triggered, such as high CPU usage in a pod. PodExporters is not a valid concept; you might confuse this with exporters, which only expose metrics. Grafna Playlists refer to dashboard sequences and do not handle alerting. MetricsSecretes is not a recognized resource in monitoring or metrics collection.

  4. Kubernetes Metrics Visualization

    If you want to display pod memory usage trends in a Kubernetes cluster, which Grafana component should you configure?

    1. A panel within a dashboard using a Prometheus query
    2. A volumeSnapshot policy in the storage class
    3. A ServiceAccount secret annotation
    4. A kubeAdmin permission role

    Explanation: Creating a panel within Grafana, configured with an appropriate Prometheus query, allows you to visualize memory usage trends over time. VolumeSnapshot policies relate to data backup and are not used for visualization. Kubernetes permission roles like kubeAdmin control access rights, not visualization. ServiceAccount secrets handle authentication, not data visualization or dashboard panels.

  5. Securing Metrics Endpoints

    Which method is commonly used to restrict access to Prometheus and Grafana web interfaces in a Kubernetes environment?

    1. Disabling PersistentVolumeClaims for storage
    2. Allocating a separate ServiceClusterIP
    3. Increasing the replica count of metric exporter pods
    4. Implementing authentication and using network policies

    Explanation: Authentication ensures only authorized users access the interfaces, while network policies restrict traffic within the cluster. Increasing exporter replicas does not affect interface security. Disabling PersistentVolumeClaims would disrupt storage without impacting web interface access. A ServiceClusterIP manages internal service routing, not user access control or interface restriction.