metrics-server

hubanbei00的家园 2020-02-16

[ k8s]# pwd
/data/k8s
[-k8s-master01 k8s]# cd metrics/
[-k8s-master01 metrics]# ls
[-k8s-master01 metrics]# git clone https://github.com/kubernetes-incubator/metrics-server.git

[-k8s-master01 metrics]# ls
metrics-server
[-k8s-master01 metrics]# cd metrics-server/
cmd/    deploy/ .git/   hack/   pkg/    test/   
[-k8s-master01 metrics]# cd metrics-server/deploy/
1.7/      1.8+/     docker/   minikube/ 
[-k8s-master01 metrics]# cd metrics-server/deploy/1.8+/
[-k8s-master01 1.8+]# ls
aggregated-metrics-reader.yaml  auth-reader.yaml         metrics-server-deployment.yaml  resource-reader.yaml
auth-delegator.yaml             metrics-apiservice.yaml  metrics-server-service.yaml

[-k8s-master01 1.8+]# cp metrics-server-deployment.yaml{,.b
[-k8s-master01 1.8+]# vim metrics-server-deployment.yaml
[-k8s-master01 1.8+]# vim metrics-server-deployment.yaml
[-k8s-master01 1.8+]# cat metrics-server-deployment.yaml | 
      # mount in tmp so we can safely use from-scratch images and/
        image: k8s.gcr.io/metrics-server-amd64:v0.3.6
        imagePullPolicy: Always
[-k8s-master01 1.8+]# vim metrics-server-deployment.yaml
[-k8s-master01 1.8+]# vim metrics-server-deployment.yaml
[-k8s-master01 1.8+]# diff metrics-server-deployment.yaml{,.bak} 
32,37c32
<         image: registry.cn-hangzhou.aliyuncs.com/google_containers/metrics-server-amd64:v0.3.6
<         command:
<           - /metrics-server
<           - --metric-resolution=30s
<           - --kubelet-insecure-tls
<           - --kubelet-preferred-address-types=InternalIP,Hostname,InternalDNS,ExternalDNS,ExternalIP
---
>         image: k8s.gcr.io/metrics-server-amd64:v0.3.6
47c42
<           runAsNonRoot: false
---
>           runAsNonRoot: true
49c44
<         imagePullPolicy: IfNotPresent
---
>         imagePullPolicy: Always

[-k8s-master01 1.8+]# kubectl create -f .
clusterrole.rbac.authorization.k8s.io/system:aggregated-metrics-reader created
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
deployment.apps/metrics-server created
service/metrics-server created
clusterrole.rbac.authorization.k8s.io/system:metrics-server created
clusterrolebinding.rbac.authorization.k8s.io/system:metrics-server created

[-k8s-master01 1.8+]# kubectl top nodes
NAME              CPU(cores)   CPU%   MEMORY(bytes)   MEMORY%   
bs-k8s-master02   702m         17%    1151Mi          40%       
bs-k8s-master03   848m         21%    1183Mi          41%       
bs-k8s-node01     455m         11%    574Mi           20%       
bs-k8s-node02     480m         12%    641Mi           22%       
bs-k8s-node03     401m         10%    584Mi           20%       
hs-k8s-master01   606m         15%    1293Mi          45%       

[-k8s-master01 1.8+]# kubectl top pods -n kube-system
NAME                                      CPU(cores)   MEMORY(bytes)   
calico-node-bjtbm                         149m         79Mi            
calico-node-m5vz7                         142m         42Mi            
etcd-bs-k8s-master02                      264m         106Mi           
etcd-hs-k8s-master01                      115m         98Mi            
kube-apiserver-bs-k8s-master02            221m         292Mi           
kube-apiserver-hs-k8s-master01            183m         283Mi           
kube-controller-manager-bs-k8s-master02   98m          49Mi            
kube-controller-manager-hs-k8s-master01   28m          22Mi            
kube-proxy-78mmw                          1m           27Mi            
kube-proxy-qtbr6                          46m          26Mi            
kube-scheduler-bs-k8s-master02            25m          22Mi            
kube-scheduler-hs-k8s-master01            36m          23Mi

相关推荐