-->

DEVOPSZONES

  • Recent blogs

    Kubernetes: Error from server (ServiceUnavailable): the server is currently unable to handle the request (get pods.metrics.k8s.io)

    Kubernetes: Error from server (ServiceUnavailable): the server is currently unable to handle the request 

    When I am running command kubectl top pods  i was getting the below error :

    root@k8s-master:~# kubectl top pods

    Error from server (ServiceUnavailable): the server is currently unable to handle the request (get pods.metrics.k8s.io)

    root@k8s-master:~# kubectl top nodes

    Error from server (ServiceUnavailable): the server is currently unable to handle the request (get nodes.metrics.k8s.io)

    Solution:

    We need to add following paramaters in the "metrics-server.yaml" to solve this error. 

          hostNetwork: true
          dnsPolicy: ClusterFirst

    Kubernetes: Error from server (ServiceUnavailable)
    metrics-server-for-metrics


    Then do the "kubectl apply -f components.yaml" .

    root@k8s-master:~# kubectl apply -f components.yaml
    serviceaccount/metrics-server unchanged
    clusterrole.rbac.authorization.k8s.io/system:aggregated-metrics-reader unchanged
    clusterrole.rbac.authorization.k8s.io/system:metrics-server unchanged
    rolebinding.rbac.authorization.k8s.io/metrics-server-auth-reader unchanged
    clusterrolebinding.rbac.authorization.k8s.io/metrics-server:system:auth-delegator unchanged
    clusterrolebinding.rbac.authorization.k8s.io/system:metrics-server unchanged
    service/metrics-server unchanged
    deployment.apps/metrics-server configured
    apiservice.apiregistration.k8s.io/v1beta1.metrics.k8s.io unchanged
    root@k8s-master:~#


    Check the metrics-server pod Now:

    root@k8s-master:~# kubectl get pod -l k8s-app=metrics-server -n kube-system
    NAME                              READY   STATUS    RESTARTS   AGE
    metrics-server-6ddfc9474c-8ttdp   1/1     Running   0          10m
    root@k8s-master:~#

    Check the metrics Now:

    root@k8s-master:~# kubectl top pods
    NAME       CPU(cores)   MEMORY(bytes)
    dnsutils   0m           0Mi
    root@k8s-master:~#
    root@k8s-master:~# kubectl top nodes
    NAME         CPU(cores)   CPU%   MEMORY(bytes)   MEMORY%
    k8s-master   164m         8%     974Mi           34%
    k8s-node1    43m          2%     908Mi           38%
    k8s-node2    49m          2%     640Mi           26%
    root@k8s-master:~#

    check_metrics
    check_metrics
    Sharing Is caring

    No comments