In Kubernetes, what is the primary purpose of setting resource requests and limits for containers?
Think about how Kubernetes decides where to put pods and how it avoids one pod using too much resource.
Resource requests tell Kubernetes the minimum resources a container needs, which helps the scheduler decide where to place pods. Limits set the maximum resources a container can use to prevent it from affecting other containers.
What is the output of the following command if the pod web-server-1 is using 150m CPU and 200Mi memory?
kubectl top pod web-server-1
Look at the units kubectl top uses for CPU and memory.
The kubectl top pod command shows CPU in millicores (m) and memory in mebibytes (Mi) with a header row.
Which sequence of steps correctly describes setting up Prometheus to monitor Kubernetes cluster metrics?
Think about deploying the operator first, then defining what to monitor, then configuring Prometheus, and finally viewing metrics.
First, deploy the Prometheus Operator. Then create ServiceMonitors to tell Prometheus what to scrape. Next, configure Prometheus to use those ServiceMonitors. Finally, access the UI to see metrics.
You installed Prometheus in your Kubernetes cluster, but no metrics appear for your application pods. Which is the most likely cause?
Think about how Prometheus knows which pods to monitor.
Prometheus uses ServiceMonitor resources to find and scrape metrics from pods. If these are missing or wrong, no metrics will be collected.
What is the best practice for setting alerts on CPU and memory usage in a Kubernetes cluster to avoid false alarms?
Think about how to balance alert sensitivity and noise.
Using historical data to set thresholds and adding a duration (e.g., alert if usage is high for 5 minutes) helps reduce false alarms caused by brief spikes.