kubernetes之-metrics-server

1.下载软件

git clone https://github.com/kubernetes-incubator/metrics-server

2.修改deployment文件

vim metrics-server/deploy/kubernetes/metrics-server-deployment.yaml

apiVersion: v1
kind: ServiceAccount
metadata:
  name: metrics-server
  namespace: kube-system
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: metrics-server
  namespace: kube-system
  labels:
    k8s-app: metrics-server
......
containers
      - name: tmp-dir
        emptyDir: {}
      containers:
      - name: metrics-server
        image: k8s.gcr.io/metrics-server-amd64:v0.3.6
        command: #adding lines
        - /metrics-server
        - --kubelet-insecure-tls
        - --kubelet-preferred-address-types=InternalIP
        imagePullPolicy: IfNotPresent
        ......
    

3.应用配置文件

kubectl apply -f metrics-server/deploy/kubernetes/

4.查看结果

kubectl get pod -n kube-system -owide
NAME                                       READY   STATUS    RESTARTS   AGE     IP                NODE         NOMINATED NODE   READINESS GATES
calico-kube-controllers-68dc4cf88f-vnlds   1/1     Running   0          22h     172.244.235.195   k8s-master   <none>           <none>
......
metrics-server-7d89945f47-zjzq2            1/1     Running   0          4h20m   172.244.169.129   k8s-node2    <none>   
kubectl get apiservices
NAME                                   SERVICE                      AVAILABLE   AGE
v1.                                    Local                        True        23h
......
v1beta1.metrics.k8s.io                 kube-system/metrics-server   True        4h22m
......
v1beta1.storage.k8s.io                 Local                        True        23h
v2beta1.autoscaling                    Local                        True        23h
v2beta2.autoscaling                    Local                        True        23h
kubectl top node
NAME         CPU(cores)   CPU%   MEMORY(bytes)   MEMORY%   
k8s-master   119m         5%     1544Mi          41%       
k8s-node1    128m         6%     774Mi           20%       
k8s-node2    127m         6%     764Mi           20%       
k8s-node3    62m          3%     766Mi           20%       
kubectl top pods -n kube-system
NAME                                       CPU(cores)   MEMORY(bytes)   
calico-kube-controllers-68dc4cf88f-vnlds   1m           12Mi            
calico-node-4hc6v                          35m          43Mi            
calico-node-8f7gb                          38m          40Mi            
calico-node-db5p8                          14m          49Mi            
calico-node-s9lmx                          18m          41Mi            
coredns-9d85f5447-mn42z                    2m           13Mi            
coredns-9d85f5447-xz8p9                    1m           14Mi            
etcd-k8s-master                            11m          172Mi           
kube-apiserver-k8s-master                  19m          317Mi           
kube-controller-manager-k8s-master         6m           43Mi            
kube-proxy-cbgvv                           1m           14Mi            
kube-proxy-dp6dj                           2m           14Mi            
kube-proxy-j9td8                           1m           14Mi            
kube-proxy-jf2zq                           1m           14Mi            
kube-scheduler-k8s-master                  2m           18Mi            
metrics-server-7d89945f47-zjzq2            1m           11Mi            
上一篇:建议收藏!深度剖析RabbitMQ可靠性消息投递以及实践方案


下一篇:SpringCloud-Hystrix配置说明