我是 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.
在阅读了其他问题之后,例如Node 在部署到 Kubernetes 集群时有 pod 不能容忍错误,并且1 个节点有 pod 在 kubernetes 集群中不能容忍的 taints,我可以理解为什么会出现这个问题,但我是困惑于我们是否应该在图像上添加我们自己的这种关系,例如(https://github.com/kubernetes-sigs/metrics-server/releases/tag/v0.3.7):
tolerations:
- key: "example-key"
operator: "Exists"
effect: "NoSchedule"
如果主节点应该能够收集他自己的指标,这个参数不应该默认添加吗?如果不是,那么我们应该在所有工作人员上部署 UI(这没有任何意义)。
也许在这方面有更多经验的人可以分享一些启示?