Bird
Raised Fist0
Kubernetesdevops~20 mins

Metrics Server installation in Kubernetes - Practice Problems & Coding Challenges

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Challenge - 5 Problems
🎖️
Metrics Server Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
Check Metrics Server pods status after installation
You installed Metrics Server in your Kubernetes cluster. What is the output of the command kubectl get pods -n kube-system -l k8s-app=metrics-server if the installation was successful and pods are running?
Kubernetes
kubectl get pods -n kube-system -l k8s-app=metrics-server
AError from server (NotFound): pods "metrics-server" not found
BNo resources found in kube-system namespace.
C
NAME                            READY   STATUS           RESTARTS   AGE
metrics-server-abcdef123-xyz12  0/1     CrashLoopBackOff 3          5m
D
NAME                            READY   STATUS    RESTARTS   AGE
metrics-server-abcdef123-xyz12  1/1     Running   0          5m
Attempts:
2 left
💡 Hint
Look for pods labeled with k8s-app=metrics-server in the kube-system namespace and check their status.
🧠 Conceptual
intermediate
1:30remaining
Purpose of Metrics Server in Kubernetes
What is the primary purpose of the Metrics Server in a Kubernetes cluster?
ATo collect resource usage data like CPU and memory from nodes and pods for autoscaling and monitoring.
BTo store persistent logs of all cluster events for auditing purposes.
CTo manage network policies and firewall rules between pods.
DTo schedule pods onto nodes based on resource availability.
Attempts:
2 left
💡 Hint
Think about what data autoscalers need to function.
Troubleshoot
advanced
2:00remaining
Diagnosing Metrics Server API access failure
After installing Metrics Server, you run kubectl top nodes but get the error: error: metrics API not available. Which of the following is the most likely cause?
AMetrics Server pod is not running or crashed.
Bkubectl client version is outdated and incompatible.
CThe kubelet service on nodes is disabled.
DThe cluster has no nodes registered.
Attempts:
2 left
💡 Hint
Check the status of Metrics Server pods first.
Configuration
advanced
2:00remaining
Correct flag to enable insecure TLS for Metrics Server
You want to deploy Metrics Server but your cluster uses self-signed certificates causing TLS errors. Which flag should you add to the Metrics Server deployment args to allow insecure TLS communication?
A--allow-insecure-connections
B--disable-tls-verification
C--kubelet-insecure-tls
D--skip-tls-check
Attempts:
2 left
💡 Hint
Look for the official flag documented for kubelet TLS issues.
🔀 Workflow
expert
3:00remaining
Order the steps to install Metrics Server correctly
Arrange the following steps in the correct order to install Metrics Server on a Kubernetes cluster:
A3,1,2,4
B1,2,3,4
C1,3,2,4
D2,1,3,4
Attempts:
2 left
💡 Hint
Think about the logical order: get files, apply, check pods, then test metrics.

Practice

(1/5)
1. What is the primary purpose of the Kubernetes Metrics Server?
easy
A. To schedule pods on specific nodes
B. To collect live CPU and memory usage data from cluster nodes and pods
C. To store persistent data for applications
D. To manage network policies between pods

Solution

  1. Step 1: Understand Metrics Server role

    The Metrics Server collects resource usage data like CPU and memory from nodes and pods in the cluster.
  2. Step 2: Differentiate from other components

    It does not manage network policies, store data, or schedule pods, which are handled by other Kubernetes components.
  3. Final Answer:

    To collect live CPU and memory usage data from cluster nodes and pods -> Option B
  4. Quick Check:

    Metrics Server = resource usage data collection [OK]
Hint: Metrics Server = live resource data collector [OK]
Common Mistakes:
  • Confusing Metrics Server with network or storage components
  • Thinking it schedules pods
  • Assuming it stores persistent data
2. Which command correctly installs the Metrics Server in a Kubernetes cluster?
easy
A. kubectl run metrics-server --image=metrics-server:latest
B. kubectl create deployment metrics-server
C. kubectl install metrics-server
D. kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml

Solution

  1. Step 1: Identify official installation method

    The Metrics Server is installed by applying the official components.yaml manifest from the Kubernetes SIGs GitHub repository using kubectl apply.
  2. Step 2: Check command correctness

    Only kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml uses kubectl apply with the correct URL. Other options use incorrect commands or methods.
  3. Final Answer:

    kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml -> Option D
  4. Quick Check:

    Install Metrics Server = kubectl apply official manifest [OK]
Hint: Use kubectl apply with official components.yaml URL [OK]
Common Mistakes:
  • Using kubectl create or run instead of apply
  • Missing the full URL to the manifest
  • Trying to install with a non-existent command
3. After installing Metrics Server, what is the expected output of kubectl top nodes?
medium
A. A list showing CPU and memory usage for each node
B. An error saying Metrics Server is not found
C. A list of pods running on each node
D. No output, command does nothing

Solution

  1. Step 1: Understand kubectl top nodes command

    This command shows current CPU and memory usage metrics for each node in the cluster, provided Metrics Server is installed and working.
  2. Step 2: Identify expected output

    With Metrics Server installed, it returns a table listing nodes with their CPU and memory usage. Errors or empty output indicate installation or connectivity issues.
  3. Final Answer:

    A list showing CPU and memory usage for each node -> Option A
  4. Quick Check:

    kubectl top nodes = node resource usage list [OK]
Hint: kubectl top nodes shows node CPU/memory usage [OK]
Common Mistakes:
  • Expecting pod lists instead of metrics
  • Assuming command fails after installation
  • Confusing with other kubectl commands
4. You installed Metrics Server but kubectl top pods returns an error. What is the most likely cause?
medium
A. Metrics Server is not running or has permission issues
B. kubectl top pods command is deprecated
C. You need to restart the Kubernetes cluster
D. Pods do not have resource limits set

Solution

  1. Step 1: Analyze error cause

    If kubectl top pods fails, it usually means Metrics Server is not running properly or lacks permissions to gather metrics.
  2. Step 2: Rule out other options

    The command is not deprecated, cluster restart is rarely needed, and missing resource limits does not cause this error.
  3. Final Answer:

    Metrics Server is not running or has permission issues -> Option A
  4. Quick Check:

    kubectl top pods error = Metrics Server problem [OK]
Hint: Check Metrics Server pod status and permissions first [OK]
Common Mistakes:
  • Assuming kubectl top pods is deprecated
  • Restarting cluster unnecessarily
  • Thinking resource limits cause command failure
5. You want to install Metrics Server but your cluster nodes use self-signed certificates causing TLS errors. What is the best way to fix this during installation?
hard
A. Disable TLS on all cluster nodes
B. Install Metrics Server without any changes; it will auto-fix TLS
C. Edit the Metrics Server deployment to add --kubelet-insecure-tls argument
D. Use a different monitoring tool that does not require TLS

Solution

  1. Step 1: Identify TLS issue cause

    Self-signed certificates cause TLS verification errors when Metrics Server connects to kubelets.
  2. Step 2: Apply correct fix

    Adding the --kubelet-insecure-tls flag to Metrics Server deployment disables strict TLS verification, allowing it to work with self-signed certs.
  3. Step 3: Rule out unsafe or incorrect options

    Disabling TLS cluster-wide is unsafe, Metrics Server does not auto-fix TLS, and switching tools is unnecessary.
  4. Final Answer:

    Edit the Metrics Server deployment to add --kubelet-insecure-tls argument -> Option C
  5. Quick Check:

    Self-signed certs fix = add --kubelet-insecure-tls [OK]
Hint: Add --kubelet-insecure-tls flag for self-signed certs [OK]
Common Mistakes:
  • Disabling TLS on nodes (unsafe)
  • Expecting Metrics Server to auto-fix TLS
  • Ignoring TLS errors and proceeding