0
0
Kubernetesdevops~10 mins

Metrics Server installation in Kubernetes - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - Metrics Server installation
Download Metrics Server YAML
Apply YAML to cluster
Metrics Server Pods start
Check Pod status
Metrics Server running
kubectl top nodes/pods works
This flow shows downloading the Metrics Server setup file, applying it to the cluster, starting pods, checking their status, and verifying metrics availability.
Execution Sample
Kubernetes
kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
kubectl get pods -n kube-system
kubectl top nodes
These commands install Metrics Server, check pod status, and display node metrics.
Process Table
StepCommandActionResult/Output
1kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yamlApply Metrics Server manifestsdeployment.apps/metrics-server created serviceaccount/metrics-server created clusterrole.rbac.authorization.k8s.io/metrics-server created ...
2kubectl get pods -n kube-systemCheck Metrics Server pod statusNAME READY STATUS RESTARTS AGE metrics-server-abcdef123-xyz 1/1 Running 0 30s
3kubectl top nodesQuery node metricsNAME CPU(cores) MEMORY(bytes) worker-node1 100m 200Mi
4kubectl top podsQuery pod metricsNAME CPU(cores) MEMORY(bytes) metrics-server-abcdef123-xyz 5m 20Mi
5kubectl get pods -n kube-systemIf pod not readyNAME READY STATUS RESTARTS AGE metrics-server-abcdef123-xyz 0/1 CrashLoopBackOff 3 2m
6Troubleshoot logsCheck pod logsError: unable to fetch metrics from Kubelet
7Fix args in deploymentAdd --kubelet-insecure-tls flagPod restarts and becomes Ready
8kubectl top nodesVerify metrics after fixNAME CPU(cores) MEMORY(bytes) worker-node1 100m 200Mi
💡 Metrics Server pod is running and metrics commands return data successfully
Status Tracker
VariableStartAfter Step 1After Step 2After Step 3After Step 7Final
Metrics Server Pod StatusNot createdCreatingRunning (1/1)Running (1/1)Restarting with fixRunning (1/1)
Metrics AvailabilityNo metricsNo metricsNo metricsNo metricsMetrics shownMetrics shown
Key Moments - 3 Insights
Why does 'kubectl top nodes' show no metrics right after installation?
Because the Metrics Server pod may not be fully running yet (see step 2 in execution_table), so metrics are not available until pod is Ready.
What does it mean if the Metrics Server pod is in CrashLoopBackOff?
It means the pod is repeatedly failing to start, often due to TLS or permission issues. See step 5 and 6 for troubleshooting logs.
Why add the --kubelet-insecure-tls flag in the deployment?
This flag allows Metrics Server to connect to kubelets without strict TLS verification, fixing common connection errors shown in step 6.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, at which step does the Metrics Server pod first show as Running?
AStep 2
BStep 1
CStep 5
DStep 7
💡 Hint
Check the 'Result/Output' column for pod status in step 2.
According to variable_tracker, what is the Metrics Availability state after Step 3?
AMetrics shown
BPod not created
CNo metrics
DPod crashing
💡 Hint
Look at the 'Metrics Availability' row under 'After Step 3' column.
If the Metrics Server pod is in CrashLoopBackOff, what should you do next according to the execution_table?
ARun 'kubectl top nodes' again
BCheck pod logs and fix deployment args
CDelete the pod and reinstall Kubernetes
DIgnore and wait
💡 Hint
See steps 5 and 6 for pod status and logs, and step 7 for the fix.
Concept Snapshot
Metrics Server installation:
1. Download and apply Metrics Server YAML.
2. Check pod status in kube-system namespace.
3. Use 'kubectl top' to view metrics.
4. Troubleshoot pod issues with logs.
5. Add --kubelet-insecure-tls if TLS errors occur.
6. Confirm metrics availability after pod is Ready.
Full Transcript
To install Metrics Server in Kubernetes, first download and apply the official YAML manifest. This creates the Metrics Server deployment and related resources. Next, check the pod status in the kube-system namespace to ensure the pod is running. If the pod is not ready or crashes, check the pod logs for errors such as TLS connection issues. A common fix is to add the --kubelet-insecure-tls flag to the deployment arguments to allow insecure TLS connections to kubelets. Once the pod is running, use 'kubectl top nodes' and 'kubectl top pods' to verify metrics are available. This process ensures Metrics Server is properly installed and functional.