Using Geerlingguy's K8s cluster and trying to install the metrics-server has some little snowflakes, following is how they got solved for me.
- get the metrics server
git clone https://github.com/kubernetes-sigs/metrics-server.git metrics-server
- label the nodes according to the metrics-server node affinity to ensure it works, original labelling was in my case
beta.kubernetes.io/arch=amd64
kubectl label node master kubernetes.io/arch=amd64
kubectl label node node1 kubernetes.io/arch=amd64
kubectl label node node2 kubernetes.io/arch=amd64
- Fix the scrapping and allow inscecure tls by adding this the following command with the two options based on this answer and the ones above.
command:
- /metrics-server
- --kubelet-insecure-tls
- --kubelet-preferred-address-types=InternalIP,Hostname,InternalDNS,ExternalDNS,ExternalIP
just after those lines
containers:
- name: metrics-server
image: k8s.gcr.io/metrics-server-amd64:v0.3.6
- Based on this answer, enable the hostnetwork by adding
hostNetwork: true
just after those lines
spec:
serviceAccountName: metrics-server
How I've done the debugging
- Inspect the nodes
kubectl describe node node1
- Inspect the pod
kubectl describe -n kube-system $(kubectl get po -n kube-system | grep metrics-server | \awk '{print $1;}')
to get the affinity and the logs. - Increase the logs by using max (10) verbosity, according to the README
command:
- /metrics-server
- --v=10
- --kubelet-insecure-tls
- --kubelet-preferred-address-types=InternalIP,Hostname,InternalDNS,ExternalDNS,ExternalIP
- Run
kubectl top pods
orkubectl top nodes
orkubectl get --raw /apis/metrics.k8s.io/v1beta1
- Run
kubectl get apiservice v1beta1.metrics.k8s.io -o yaml
to get further info about the APIService status, based on this answer.