KCNA Monitoring and Logging 4 — Questions and Answers
Question 1: What does the PromQL function `rate()` calculate?
- The maximum value of a counter over a range
- The per-second average rate of increase of a counter over a time range (Correct answer)
- The difference between the first and last values of a gauge
- The total sum of a histogram's observations
Correct answer: The per-second average rate of increase of a counter over a time range
rate() calculates the per-second average increase rate of a counter over the specified time range, accounting for counter resets.
Question 2: In Kubernetes, which field in a pod spec controls the maximum number of log lines retained per container when using the json-file log driver?
- spec.logRotation
- annotations.log-max-size
- hostPath log configuration
- Container runtime log configuration on the node (Correct answer)
Correct answer: Container runtime log configuration on the node
Log rotation limits (max file size, max files) are configured at the container runtime level on each node, not within the pod spec itself.
Question 3: What is Loki's primary design difference from Elasticsearch for log storage?
- Loki indexes all log content for full-text search
- Loki only indexes log labels/metadata, not log content (Correct answer)
- Loki stores logs in a relational database
- Loki requires a dedicated agent on every node
Correct answer: Loki only indexes log labels/metadata, not log content
Loki indexes only the labels (metadata) attached to log streams, not the log content itself, making it more cost-efficient for storage and ingestion.
Question 4: Which CNCF project is the de facto standard for distributed tracing, providing SDKs, a collector, and a UI?
- Zipkin
- Jaeger (Correct answer)
- Tempo
- OpenTelemetry Collector
Correct answer: Jaeger
Jaeger is a CNCF graduated project purpose-built for distributed tracing, offering client libraries, a collector, a query service, and a web UI.
Question 5: What is the function of a Prometheus 'recording rule'?
- Send alerts when a threshold is breached
- Pre-compute expensive PromQL queries and store results as new time series (Correct answer)
- Define which targets Prometheus should scrape
- Configure how long raw metrics are retained
Correct answer: Pre-compute expensive PromQL queries and store results as new time series
Recording rules allow you to pre-compute frequently used or expensive PromQL expressions and save their results as new time series for faster querying.
Question 6: In the context of cloud-native observability, what are the 'Three Pillars of Observability'?
- CPU, Memory, and Network metrics
- Logs, Metrics, and Traces (Correct answer)
- Alerting, Dashboards, and Reporting
- Scraping, Storing, and Querying
Correct answer: Logs, Metrics, and Traces
The three pillars of observability are Logs (event records), Metrics (numeric measurements over time), and Traces (request flows across services).
Question 7: Which Kubernetes API allows external monitoring tools to retrieve resource usage metrics (CPU, memory) from pods and nodes?
- Custom Metrics API
- Resource Metrics API (Correct answer)
- External Metrics API
- Aggregation API
Correct answer: Resource Metrics API
The Resource Metrics API (metrics.k8s.io) exposes CPU and memory usage for pods and nodes, typically served by metrics-server.
What does the PromQL function `rate()` calculate?