|NO.Z.00038|——————————|^^ 部署 ^^|——|KuberNetes&二進位制部署.V16|5臺Server|---------------------------------------|kubernetes元件|metrics-server|
阿新 • • 發佈:2022-03-29
[CloudNative:KuberNetes&二進位制部署.V16] [Applications.KuberNetes] [|DevOps|k8s|**5節點**|二進位制1.20|kubernetes元件|metrics-server|]
一、部署Metrics Server
### --- metrics server概述 ~~~ 在新版的Kubernetes中系統資源的採集均使用Metrics-server, ~~~ 可以通過Metrics採集節點和Pod的記憶體、磁碟、CPU和網路的使用率。
二、部署metrics server
### --- 部署metrics server
~~~ # 切換到metrics-server安裝目錄下
[root@k8s-master01 k8s-ha-install]# cd /root/k8s-ha-install/metrics-server-0.4.x/
~~~ # 部署metrics-server [root@k8s-master01 metrics-server-0.4.x]# kubectl create -f . ~~~ 注:輸出結果 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
三、檢視服務狀態### --- 等待metrics server啟動然後檢視狀態 ~~~ # 檢視metrics-server.pod狀態 [root@k8s-master01 metrics-server-0.4.x]# kubectl get po -n kube-system NAME READY STATUS RESTARTS AGE calico-kube-controllers-5f6d4b864b-6clrl 1/1 Running 0 24m calico-node-6hbtl 1/1 Running 0 24m calico-node-77c2f 1/1 Running 3 24m calico-node-hrqpt 1/1 Running 0 24m calico-node-trkhw 1/1 Running 0 24m calico-node-z4gkj 1/1 Running 0 24m coredns-867d46bfc6-sk5dp 1/1 Running 0 3m58s metrics-server-595f65d8d5-slhtd 0/1 Running 0 51s
### --- 檢視metrics-server監控到pod資源的狀態
~~~ # 檢視metrics監控狀態
[root@k8s-master01 metrics-server-0.4.x]# kubectl top node
NAME CPU(cores) CPU% MEMORY(bytes) MEMORY%
k8s-master01 483m 24% 1163Mi 62%
k8s-master02 440m 22% 1083Mi 58%
k8s-master03 1090m 54% 1168Mi 62%
k8s-node01 170m 17% 475Mi 55%
k8s-node02 137m 13% 489Mi 56%
### --- 檢視metrics監控狀態.pod
[root@k8s-master01 metrics-server-0.4.x]# kubectl top po -A
NAMESPACE NAME CPU(cores) MEMORY(bytes)
kube-system calico-kube-controllers-5f6d4b864b-6clrl 5m 14Mi
kube-system calico-node-6hbtl 58m 53Mi
kube-system calico-node-77c2f 58m 49Mi
kube-system calico-node-hrqpt 35m 52Mi
kube-system calico-node-trkhw 95m 55Mi
kube-system calico-node-z4gkj 27m 55Mi
kube-system coredns-867d46bfc6-sk5dp 5m 9Mi
kube-system metrics-server-595f65d8d5-slhtd 7m 14Mi
===============================END===============================
Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart ——W.S.Landor
來自為知筆記(Wiz)