1.部署Metrics Server节点监控
1.1 在任意k8s-master节点上下载Metrics Server的创建文件
https://github.com/kubernetes-sigs/metrics-server/releases
wget https://github.com/kubernetes-sigs/metrics-server/releases/download/v0.7.1/components.yaml
1.2 修改单机版配置文件
sed -i "s#10250#10350#g" components.yaml
sed -i "s#registry.k8s.io/metrics-server/#registry.aliyuncs.com/google_containers/#g" components.yaml
# 144行
args:
- --cert-dir=/tmp
- --secure-port=10350
- --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname
- --kubelet-use-node-status-port
- --metric-resolution=15s 在此行下添加
- --kubelet-insecure-tls
- --requestheader-client-ca-file=/etc/kubernetes/pki/ca.pem
- --requestheader-username-headers=X-Remote-User
- --requestheader-group-headers=X-Remote-Group
- --requestheader-extra-headers-prefix=X-Remote-Extra-
# 191行
volumeMounts:
- mountPath: /tmp
name: tmp-dir 在此行下添加
- name: ca-ssl
mountPath: /etc/kubernetes/pki
# 200行
volumes:
- emptyDir: {}
name: tmp-dir 在此行下添加
- name: ca-ssl
hostPath:
path: /etc/kubernetes/pki
1.3 在任意k8s-master节点应用Metrics Server的components.yaml文件
# kubectl create -f components.yaml
serviceaccount/metrics-server created
clusterrole.rbac.authorization.k8s.io/system:aggregated-metrics-reader created
clusterrole.rbac.authorization.k8s.io/system:metrics-server created
rolebinding.rbac.authorization.k8s.io/metrics-server-auth-reader created
clusterrolebinding.rbac.authorization.k8s.io/metrics-server:system:auth-delegator created
clusterrolebinding.rbac.authorization.k8s.io/system:metrics-server created
service/metrics-server created
deployment.apps/metrics-server created
apiservice.apiregistration.k8s.io/v1beta1.metrics.k8s.io created
# kubectl get pods -n kube-system | grep metrics
metrics-server-676df5658c-tmxff 1/1 Running 0 33m
2.1
标签:Kubernetes,created,--,Server,server,metrics,io,k8s From: https://www.cnblogs.com/cn-jasonho/p/18279810