kubernetes部署metrics-server metrics-server-v0.3.4 pod报错

[root@hadoop02 ~]# kubectl logs metrics-server-v0.3.4-76db4dd54b-s4t2d -c metrics-server -n kube-system
Get http://172.16.2.220:10255/stats/summary?only_cpu_and_memory=true: dial tcp 172.16.2.220:10255: connect: connection refused, unable to fully scrape metrics from source kubelet_summary:hadoop03: unable to fetch metrics from Kubelet hadoop03 (172.16.2.160): Get http://172.16.2.160:10255/stats/summary?only_cpu_and_memory=true: dial tcp 172.16.2.160:10255: connect: connection refused, unable to fully scrape metrics from source kubelet_summary:hadoop01: unable to fetch metrics from Kubelet hadoop01 (172.16.2.95): Get http://172.16.2.95:10255/stats/summary?only_cpu_and_memory=true: dial tcp 172.16.2.95:10255: connect: connection refused]

 

[root@hadoop02 ~]# kubectl logs metrics-server-v0.3.4-76db4dd54b-s4t2d -c metrics-server-nanny -n kube-system
ERROR: logging before flag.Parse: I1104 14:14:20.120043 1 pod_nanny.go:65] Invoked by [/pod_nanny --config-dir=/etc/config --cpu={{ base_metrics_server_cpu }} --extra-cpu=0.5m --memory={{ base_metrics_server_memory }} --extra-memory={{ metrics_server_memory_per_node }}Mi --threshold=5 --deployment=metrics-server-v0.3.4 --container=metrics-server --poll-period=300000 --estimator=exponential --minClusterSize={{ metrics_server_min_cluster_size }}]
invalid argument "{{ metrics_server_min_cluster_size }}" for "--minClusterSize" flag: strconv.ParseUint: parsing "{{ metrics_server_min_cluster_size }}": invalid syntax

 

1) 修改metrics-server-deployment.yaml

[root@hadoop01 metrics-server]# vim metrics-server-deployment.yaml
      containers:
      - name: metrics-server
        image: registry.aliyuncs.com/google_containers/metrics-server-amd64:v0.3.4
        command:
        - /metrics-server
        - --metric-resolution=30s
        #- --kubelet-port=10255
        #- --deprecated-kubelet-completely-insecure=true
        - --kubelet-insecure-tls
        - --kubelet-preferred-address-types=InternalIP,Hostname,InternalDNS,ExternalDNS,ExternalIP
.......
.......
.......
.......
        command:
          - /pod_nanny
          - --config-dir=/etc/config
          #- --cpu={{ base_metrics_server_cpu }}
          - --extra-cpu=0.5m
          #- --memory={{ base_metrics_server_memory }}
          #- --extra-memory={{ metrics_server_memory_per_node }}Mi
          - --threshold=5
          - --deployment=metrics-server-v0.3.4
          - --container=metrics-server
          - --poll-period=300000
          - --estimator=exponential
          - --minClusterSize=2
          #- --minClusterSize={{ metrics_server_min_cluster_size }}

2)修改resource-reader.yaml

rules:
- apiGroups:
  - ""
  resources:
  - pods
  - nodes
  - nodes/stats //加上这个
  - namespaces
  verbs:
  - get
  - list
  - watch

3)重新apply

kubectl apply -f metrics-server-deployment.yaml

上一篇:二进制方式搭建Kubernetes 1.19.3高可用集群(五)——部署dashboard


下一篇:Spring cloud微服务安全实战-7-1章节概述