監(jiān)控資源指標(biāo)管道 Metrics API(Metrics Server)
專業(yè)領(lǐng)域包括成都做網(wǎng)站、成都網(wǎng)站建設(shè)、成都外貿(mào)網(wǎng)站建設(shè)、商城網(wǎng)站定制開(kāi)發(fā)、微信營(yíng)銷、系統(tǒng)平臺(tái)開(kāi)發(fā), 與其他網(wǎng)站設(shè)計(jì)及系統(tǒng)開(kāi)發(fā)公司不同,創(chuàng)新互聯(lián)建站的整合解決方案結(jié)合了幫做網(wǎng)絡(luò)品牌建設(shè)經(jīng)驗(yàn)和互聯(lián)網(wǎng)整合營(yíng)銷的理念,并將策略和執(zhí)行緊密結(jié)合,為客戶提供全網(wǎng)互聯(lián)網(wǎng)整合方案。
在Kubernetes集群中部署 Metrics API(Metrics Server)
[root@node1 metrics]# ll
total 24
-rw-r--r-- 1 root root 398 Feb 28 03:30 auth-delegator.yaml
-rw-r--r-- 1 root root 419 Feb 28 03:30 auth-reader.yaml
-rw-r--r-- 1 root root 388 Feb 28 03:30 metrics-apiservice.yaml
-rw-r--r-- 1 root root 3252 Feb 28 03:30 metrics-server-deployment.yaml
-rw-r--r-- 1 root root 336 Feb 28 03:30 metrics-server-service.yaml
-rw-r--r-- 1 root root 795 Feb 28 03:30 resource-reader.yaml
[root@node1 metrics]#
command: //此處修改
- /metrics-server
- --metric-resolution=30s
# These are needed for GKE, which doesn't support secure communication yet.
# Remove these lines for non-GKE clusters, and when GKE supports token-based auth.
- --kubelet-port=10250
#- --deprecated-kubelet-completely-insecure=true
- --kubelet-preferred-address-types=InternalIP,Hostname,InternalDNS,ExternalDNS,ExternalIP
command: //此處修改
- /pod_nanny
- --config-dir=/etc/config
- --cpu=5m
- --extra-cpu=0.5m
- --memory=80Mi
- --extra-memory=8Mi
- --threshold=5
- --deployment=metrics-server-v0.3.6
- --container=metrics-server
- --poll-period=300000
- --estimator=exponential
# Specifies the smallest cluster (defined in number of nodes)
# resources will be scaled to.
#- --minClusterSize={{ metrics_server_min_cluster_size }}
rules:
- apiGroups:
- ""
resources:
- pods
- nodes
- namespaces
- nodes/stats
[root@node2 ~]# cat pull-metrics.sh
#!/bin/bash
#
docker pull registry.cn-hangzhou.aliyuncs.com/google_containers/metrics-server-amd64:v0.3.6
docker pull registry.cn-hangzhou.aliyuncs.com/google_containers/addon-resizer:1.8.7
docker tag registry.cn-hangzhou.aliyuncs.com/google_containers/metrics-server-amd64:v0.3.6 k8s.gcr.io/metrics-server-amd64:v0.3.6
docker tag registry.cn-hangzhou.aliyuncs.com/google_containers/addon-resizer:1.8.7 k8s.gcr.io/addon-resizer:1.8.7
docker rmi registry.cn-hangzhou.aliyuncs.com/google_containers/metrics-server-amd64:v0.3.6
docker rmi registry.cn-hangzhou.aliyuncs.com/google_containers/addon-resizer:1.8.7
[root@node2 ~]#
[root@node1 metrics]# kubectl apply -f ./
clusterrolebinding.rbac.authorization.k8s.io/metrics-server:system:auth-delegator created
rolebinding.rbac.authorization.k8s.io/metrics-server-auth-reader created
apiservice.apiregistration.k8s.io/v1beta1.metrics.k8s.io created
serviceaccount/metrics-server created
configmap/metrics-server-config created
deployment.apps/metrics-server-v0.3.6 created
service/metrics-server created
clusterrole.rbac.authorization.k8s.io/system:metrics-server created
clusterrolebinding.rbac.authorization.k8s.io/system:metrics-server created
[root@node1 metrics]#
[root@node1 ~]# kubectl get pods -n kube-system
NAME READY STATUS RESTARTS AGE
metrics-server-v0.3.6-cf56dfd4-mj7p2 2/2 Running 0 22s
[root@node1 ~]# kubectl top nodes
NAME CPU(cores) CPU% MEMORY(bytes) MEMORY%
node1 137m 6% 1043Mi 69%
node2 21m 2% 333Mi 20%
node3 23m 2% 343Mi 28%
查看node資源指標(biāo)
[root@node1 metrics]# kubectl get --raw "/apis/metrics.k8s.io/v1beta1/nodes" | jq | less
查看pods資源指標(biāo)
[root@node1 metrics]# kubectl get --raw "/apis/metrics.k8s.io/v1beta1/pods" | jq | less
其它方式在Kubernetes 上部署Metrics Server的方法
此方法要比以上部署要容易許多,可參考之
github kubernetes-sigs
文章名稱:KubernetesMetricsAPI(MetricsServer)-創(chuàng)新互聯(lián)
網(wǎng)站地址:http://jinyejixie.com/article16/dpssgg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站排名、軟件開(kāi)發(fā)、網(wǎng)站制作、微信小程序、App開(kāi)發(fā)、網(wǎng)站維護(hù)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容