k8s 1.20.x安装metrics-server

1、下载yaml文件

wget https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml

2、添加--kubelet-insecure-tls参数

  • Metric Server 支持一个参数 --kubelet-insecure-tls,可以跳过这一检查,然而官方也明确说了,这种方式不推荐生产使用
[root@master ~]# egrep -C 5 'kubelet-insecure-tls'  components.yaml 
    spec:
      containers:
      - args:
        - --cert-dir=/tmp
        - --secure-port=4443
        - --kubelet-insecure-tls
        - --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname
        - --kubelet-use-node-status-port
        image: registry.cn-hangzhou.aliyuncs.com/ks8_kk/metrics-server:v0.4.2
        imagePullPolicy: IfNotPresent
        livenessProbe:

3、导入

kubectl apply -f  components.yaml  -n kube-system

4、查看

[root@master ~]# kubectl  get pod -n kube-system|grep   metrics-server
metrics-server-6f4b85fc8-hxjcj             1/1     Running   0          6m30s
[root@master ~]# kubectl  top node 
NAME     CPU(cores)   CPU%   MEMORY(bytes)   MEMORY%   
master   179m         8%     2195Mi          61%       
node1    125m         6%     2137Mi          60%       
node2    122m         6%     2667Mi          35% 
posted @ 2021-03-25 10:46  巽逸  阅读(0)  评论(0编辑  收藏  举报  来源