metrics-server pod 应该 运行 在主节点或工作节点上?

metrics-server pod should run on master node(s) or worker node(s)?

我是 k8s 的新手,我正在尝试在主节点上部署仪表板,部署的一部分是启动指标服务器。可以在此处找到完整文档 (dashboard/metrics-server)。

我的问题与部署后立即看到的警告有关:

$ kubectl describe pods -n kube-system metrics-server-74d7f54fdc-psz5p
Name:           metrics-server-74d7f54fdc-psz5p
Namespace:      kube-system
Priority:       0
Node:           <none>
Labels:         k8s-app=metrics-server
                pod-template-hash=74d7f54fdc
Annotations:    <none>
Status:         Pending
IP:
IPs:            <none>
Controlled By:  ReplicaSet/metrics-server-74d7f54fdc
Containers:
  metrics-server:
    Image:      my.repo.net/k8s.gcr.io/metrics-server-amd64:v0.3.6
    Port:       4443/TCP
    Host Port:  0/TCP
    Args:
      --cert-dir=/tmp
      --secure-port=4443
    Environment:  <none>
    Mounts:
      /tmp from tmp-dir (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from metrics-server-token-d47dm (ro)
Conditions:
  Type           Status
  PodScheduled   False
Volumes:
  tmp-dir:
    Type:       EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:
    SizeLimit:  <unset>
  metrics-server-token-d47dm:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  metrics-server-token-d47dm
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  kubernetes.io/arch=amd64
                 kubernetes.io/os=linux
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type     Reason            Age                  From               Message
  ----     ------            ----                 ----               -------
  Warning  FailedScheduling  116s (x49 over 66m)  default-scheduler  0/1 nodes are available: 1 node(s) had taint {node-role.kubernetes.io/master: }, that the pod didn't tolerate.

阅读其他问题后,例如 and I can understand why this problem occurs, but I am confused as to if we should add our self this torelation on the image e.g. (https://github.com/kubernetes-sigs/metrics-server/releases/tag/v0.3.7):

tolerations:
  - key: "example-key"
    operator: "Exists"
    effect: "NoSchedule"

如果Master节点应该能够自己收集metrics,这个参数应该不会默认添加?如果不是,那么我们应该在所有 worker 上部署 UI(这没有任何意义)。

也许在这方面有更多经验的人可以分享一些光?

度量服务器可以部署到工作节点中,不必部署在主节点中以获取有关主服务器的度量。 metric server 使用 kubeapi-server 获取关于集群的各种指标,metric server 的要求是:

  1. 必须可以从 kubeapi-server
  2. 到达
  3. Kubelet 权限设置正确refer this link

您的集群中是否有工作节点?他们的任何污点是否应用于这些节点?此外,根据您的部署 yaml 节点选择器配置了以下值,请确保您的工作节点具有这两个标签

  • kubernetes.io/arch=amd64
  • kubernetes.io/os=linux

您可以使用以下命令将标签添加到节点(如果不存在)。

kubectl label nodes *node-name* kubernetes.io/arch=amd64