Kubernetes kubectl top 命令报 error: Metrics API not available
Kubernetes minikube kubectl About 4,738 words环境
minikube
错误详情
PS C:\Users\fendoudebb> kubectl top node
error: Metrics API not available
原因
未启用metrics-server
插件
查看插件列表
minikube addons list
输出:可以看到metrics-server
是disabled
状态
PS C:\Users\fendoudebb> minikube addons list
|-----------------------------|----------|--------------|--------------------------------|
| ADDON NAME | PROFILE | STATUS | MAINTAINER |
|-----------------------------|----------|--------------|--------------------------------|
| ambassador | minikube | disabled | third-party (ambassador) |
| auto-pause | minikube | disabled | google |
| csi-hostpath-driver | minikube | disabled | kubernetes |
| dashboard | minikube | enabled ✅ | kubernetes |
| default-storageclass | minikube | enabled ✅ | kubernetes |
| efk | minikube | disabled | third-party (elastic) |
| freshpod | minikube | disabled | google |
| gcp-auth | minikube | disabled | google |
| gvisor | minikube | disabled | google |
| helm-tiller | minikube | disabled | third-party (helm) |
| ingress | minikube | disabled | unknown (third-party) |
| ingress-dns | minikube | disabled | google |
| istio | minikube | disabled | third-party (istio) |
| istio-provisioner | minikube | disabled | third-party (istio) |
| kubevirt | minikube | disabled | third-party (kubevirt) |
| logviewer | minikube | disabled | unknown (third-party) |
| metallb | minikube | disabled | third-party (metallb) |
| metrics-server | minikube | disabled | kubernetes |
| nvidia-driver-installer | minikube | disabled | google |
| nvidia-gpu-device-plugin | minikube | disabled | third-party (nvidia) |
| olm | minikube | disabled | third-party (operator |
| | | | framework) |
| pod-security-policy | minikube | disabled | unknown (third-party) |
| portainer | minikube | disabled | portainer.io |
| registry | minikube | disabled | google |
| registry-aliases | minikube | disabled | unknown (third-party) |
| registry-creds | minikube | disabled | third-party (upmc enterprises) |
| storage-provisioner | minikube | enabled ✅ | google |
| storage-provisioner-gluster | minikube | disabled | unknown (third-party) |
| volumesnapshots | minikube | disabled | kubernetes |
|-----------------------------|----------|--------------|--------------------------------|
启用插件
minikube addons enable metrics-server
输出
PS C:\Users\fendoudebb> minikube addons enable metrics-server
▪ Using image registry.cn-hangzhou.aliyuncs.com/google_containers/metrics-server:v0.4.2
🌟 启动 'metrics-server' 插件
查看插件创建的控制器和服务
可以看到metrics-server
创建了名为metrics-server-96bbfd9f5-mfm7t
的Pod
和metrics-server
的Service
。
PS C:\Users\fendoudebb> kubectl get pod,svc -n kube-system
NAME READY STATUS RESTARTS AGE
pod/coredns-65c54cc984-rf6t5 1/1 Running 2 14d
pod/etcd-minikube 1/1 Running 0 2d16h
pod/kube-apiserver-minikube 1/1 Running 0 2d16h
pod/kube-controller-manager-minikube 1/1 Running 1 14d
pod/kube-proxy-t6wjm 1/1 Running 1 14d
pod/kube-scheduler-minikube 1/1 Running 1 14d
pod/metrics-server-96bbfd9f5-mfm7t 1/1 Running 0 39s
pod/storage-provisioner 1/1 Running 11 (75m ago) 14d
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/kube-dns ClusterIP 10.96.0.10 <none> 53/UDP,53/TCP,9153/TCP 14d
service/metrics-server ClusterIP 10.108.228.83 <none> 443/TCP 39s
禁用插件
minikube addons disable metrics-server
Views: 4,837 · Posted: 2022-10-29
————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb/LiteNote扫描下方二维码关注公众号和小程序↓↓↓
Loading...