Thursday, September 21, 2023
HomeSoftware EngineeringThe best way to Deploy a Metrics Server in Kubernetes

The best way to Deploy a Metrics Server in Kubernetes


If you want to deploy a Metrics Server in Kubernetes, then you definitely first have to create a namespace for it to dwell it, adopted by putting in the precise metrics server.

Step 1 – Set up the Metrics Server

Utilizing kubectl

kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/obtain/v0.5.0/parts.yaml

Utilizing helm

kubectl create namespace metrics

helm set up metrics-server 
    secure/metrics-server 
    --version 2.9.0 
    --namepsace metrics

Step 2 – Get the Metrics Server Standing

If you happen to used kubectl above, then you need to be capable to run:

kubectl get apiservice v1beta1.metrics.k8s.io -o json | jq '.standing'

In any other case with helm, run:

kubectl describe hpa

Step 3 – Verifying the Metrics Server Setup

If you happen to get the next output, then it simply means the server will not be prepared but, wait a second longer:

{
  "circumstances": [
    {
      "lastTransitionTime": "2022-04-13T13:26:45Z",
      "message": "endpoints for service/metrics-server in "kube-system" have no addresses with port name "https"",
      "reason": "MissingEndpoints",
      "status": "False",
      "type": "Available"
    }
  ]
}

When the Metrics Server is prepared, you’re going to get a response as follows:

{
  "circumstances": [
    {
      "lastTransitionTime": "2022-04-13T13:27:08Z",
      "message": "all checks passed",
      "reason": "Passed",
      "status": "True",
      "type": "Available"
    }
  ]
}

Step 4 – A tip to be alerted when prepared

You possibly can at all times watch the above command as an alternative of working the identical command again and again above, whereas ready for the server to change into obtainable:

watch -n1 "kubectl get apiservice v1beta1.metrics.k8s.io -o json | jq '.standing'"
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments