metrics-server 安裝和報錯 Kubernetes metrics-server: kubectl top nodes Error from server (ServiceUnavailable)


安裝過程參考https://blog.csdn.net/qq_40460909/article/details/93321945

git clone https://github.com/kubernetes-incubator/metrics-server.git

cd metrics-server/deploy/1.8+/

sed -i 's#k8s.gcr.io/metrics-server-amd64:v0.3.3#lanvv/metrics-server-amd64:v0.3.3#' metrics-server-deployment.yaml

sed -i '32a \
args: \
- --kubelet-insecure-tls \
- --kubelet-preferred-address-types=InternalIP,Hostname,InternalDNS,ExternalDNS,ExternalIP \
- --metric-resolution=30s' metrics-server-deployment.yaml

 kubectl create -f .

驗證:

 kubectl -n kube-system get pods

安裝通過如上命令check  pod 是running,但是kubectl  top pod 報錯:metrics-server: kubectl top nodes Error from server (ServiceUnavailable)

通過descibe pod 顯示一切正常,通過kubectl  logs  -f    pod/podname    -c    metrics-server 查看:serve.go:96] Serving securely on [::]:443

網上搜索,無果。

kubectl  get  pod  -n  kube-system   發現coredns沒起來,通過describe pod發現: "cni0" already has an IP address different from ...

解決辦法:

kubeadm reset
systemctl stop kubelet
systemctl stop docker
rm -rf /var/lib/cni/
rm -rf /var/lib/kubelet/*
rm -rf /etc/cni/
ifconfig cni0 down
ifconfig flannel.1 down
ifconfig docker0 down
ip link delete cni0
ip link delete flannel.1
systemctl start docker

kubeadm init --pod-network-cidr=10.244.0.0/16 --apiserver-advertise-address=[IP地址]   --kubernetes-version=v1.15.2
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/62e44c867a2846fefb68bd5f178daf4da3095ccb/Documentation/kube-flannel.ym

重新init   master,加網絡,join worker,確認coredns正常,然后再起metrices-server,ok

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM