Issue:-
When installing the metricserver in the kubernetes getting the following error.
Error:-
Error from server (ServiceUnavailable): the server is currently unable to handle the request (get nodes.metrics.k8s.io)
Effect:-
Due to the above error the metricserver will not work
[centos@kubemaster dashboard]$ kubectl top nodes
W0529 10:18:25.234815 13218 top_node.go:119] Using json format to get metrics. Next release will switch to protocol-buffers, switch early by passing --use-protocol-buffers flag
Error from server (ServiceUnavailable): the server is currently unable to handle the request (get nodes.metrics.k8s.io)
Resolution:-
Follow the steps mentioned below to install the metric server
1. sudo yum install -y wget
2. wget https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
3. vim components.yaml
4. you need to add the following 1 arguments with the command
# kubectl edit deployment -n kube-system metrics-server
- --kubelet-insecure-tls
- --kubelet-preferred-address-types=InternalIP
Now if you again go to the sublime editor where we have opened the components.yaml file and look fir the containers definition i.e. just search containers with
control+f
Replace
containers:
- args:
- --cert-dir=/tmp
- --secure-port=443
- --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname
- --kubelet-use-node-status-port
- --metric-resolution=15s
With
containers:
- args:
- --cert-dir=/tmp
- --secure-port=443
- --kubelet-preferred-address-types=InternalIP (#this one was added)
- --kubelet-insecure-tls (#this one was added)
- --kubelet-use-node-status-port
- --metric-resolution=15s
5. Now when you will execute the command it should be successful
[centos@kubemaster dashboard]$ kubectl top nodes --use-protocol-buffers
NAME CPU(cores) CPU% MEMORY(bytes) MEMORY%
kubemaster.unixcloudfusion.in 189m 9% 2087Mi 56%
kubenode1.unixcloudfusion.in 77m 3% 904Mi 24%
kubenode2.unixcloudfusion.in 90m 4% 1163Mi 31%
Explanation:-
The hostname resolution in this case was happening through the internal DNS system which have pods/service entries but not cluster node entries.
0 comments:
Post a Comment