metrics-server- 提示the server is currently unable to handle the request -解决方式
安装完metrics-server -v0.5.2版后,# kubectl top nodesError from server (ServiceUnavailable): the server is currently unable to handle the request (get nodes.metrics.k8s.io)解决方式,修改yaml文件kind: Deploymentspec:
·
安装完metrics-server -v0.5.2版后,
# kubectl top nodes
Error from server (ServiceUnavailable): the server is currently unable to handle the request (get nodes.metrics.k8s.io)
解决方式,修改yaml文件
kind: Deployment
spec:
template:
spec:
nodeName: k8s-master ##第一次改动,新增此行
containers:
- args:
.....
- --secure-port=4430 ##第三次改动,原4443改成4430
......
- --kubelet-insecure-tls ##第二次改动,新增此行
.......
ports:
- containerPort: 4430 ##第三次改动,原4443改成4430
改完看看下效果
# kubectl top pods -A
NAMESPACE NAME CPU(cores) MEMORY(bytes)
default mongo-75f59d57f4-f5s24 23m 81Mi
kube-system coredns-7d89d9b6b8-mtk84 4m 18Mi
kube-system coredns-7d89d9b6b8-x864t 2m 14Mi
kube-system etcd-k8s-master 32m 86Mi
kube-system kube-apiserver-k8s-master 127m 337Mi
kube-system kube-controller-manager-k8s-master 54m 54Mi
kube-system kube-flannel-ds-f467b 6m 36Mi
kube-system kube-flannel-ds-xb8lh 4m 31Mi
kube-system kube-proxy-2z76m 3m 17Mi
kube-system kube-proxy-6wkrd 1m 18Mi
kube-system kube-scheduler-k8s-master 15m 21Mi
kube-system metrics-server-7f965c6c96-c96xh 8m 21Mi
kubernetes-dashboard dashboard-metrics-scraper-856586f554-r2zfp 1m 15Mi
kubernetes-dashboard kubernetes-dashboard-67484c44f6-4wpw7 1m 16Mi
# kubectl top nodes
NAME CPU(cores) CPU% MEMORY(bytes) MEMORY%
k8s-master 555m 27% 1503Mi 40%
k8s-node1 141m 7% 725Mi 19%
OK,搞定。
好久没玩k8s了,最近装了1.28版,于次安装metrics-server
# wget https://github.com/kubernetes-sigs/metrics-server/releases/download/v0.7.1/components.yaml -O metrics-server-v071.yaml
# diff metrics-server-v0.5.2.yaml metrics-server-v071.yaml
38a39,44
> - nodes/metrics
> verbs:
> - get
> - apiGroups:
> - ""
> resources:
41,43d46
< - nodes/stats
< - namespaces
< - configmaps
130d132
< nodeName: k8s-master
134c136
< - --secure-port=4430
---
> - --secure-port=10250
138,139c140
< - --kubelet-insecure-tls
< image: registry.cn-hangzhou.aliyuncs.com/ivesgdidf/metrics-server:v0.5.2
---
> image: registry.k8s.io/metrics-server/metrics-server:v0.7.1
150c151
< - containerPort: 4430
---
> - containerPort: 10250
165a167,170
> allowPrivilegeEscalation: false
> capabilities:
> drop:
> - ALL
168a174,175
> seccompProfile:
> type: RuntimeDefault
大体上没有太多变化
# kubectl apply -f metrics-server-v071.yaml
# kubectl get pods -A
NAMESPACE NAME READY STATUS RESTARTS AGE
。。。。。。
kube-system metrics-server-6d94bc8694-dzfpd 0/1 ImagePullBackOff 0 3m2s
# kubectl describe pod metrics-server-6d94bc8694-dzfpd -n kube-system
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 9m30s default-scheduler Successfully assigned kube-system/metrics-server-6d94bc8694-dzfpd to k8s-node01
Normal SandboxChanged 8m51s kubelet Pod sandbox changed, it will be killed and re-created.
Warning Failed 7m25s kubelet Failed to pull image "registry.k8s.io/metrics-server/metrics-server:v0.7.1": Error response from daemon: Head "https://us-west2-docker.pkg.dev/v2/k8s-artifacts-prod/images/metrics-server/metrics-server/manifests/v0.7.1": dial tcp 64.233.188.82:443: connect: connection refused
Warning Failed 6m51s (x6 over 8m50s) kubelet Error: ImagePullBackOff
Normal Pulling 6m40s (x4 over 9m14s) kubelet Pulling image "registry.k8s.io/metrics-server/metrics-server:v0.7.1"
Warning Failed 6m17s (x3 over 8m51s) kubelet Failed to pull image "registry.k8s.io/metrics-server/metrics-server:v0.7.1": Error response from daemon: Head "https://asia-east1-docker.pkg.dev/v2/k8s-artifacts-prod/images/metrics-server/metrics-server/manifests/v0.7.1": dial tcp 64.233.188.82:443: connect: connection refused
Warning Failed 6m17s (x4 over 8m51s) kubelet Error: ErrImagePull
Normal BackOff 4m5s (x13 over 8m50s) kubelet Back-off pulling image "registry.k8s.io/metrics-server/metrics-server:v0.7.1"
# grep -n image metrics-server-v071.yaml
140: image: registry.k8s.io/metrics-server/metrics-server:v0.7.1
141: imagePullPolicy: IfNotPresent
镜像卡了,下不来。。网络不好。。。有空再处理
更多推荐
已为社区贡献1条内容
所有评论(0)