当我为特定目的创建节点池时,有没有办法告诉 Kubernetes 不要将 kube-system pod(例如 kube-proxy)放在这些节点上(这会消耗内存)?发生这种情况时,应该请求这些节点上所有内存的实际 pod 将永远处于 Pending 状态。
$ kubectl get pods -l app=my-app
…
my-app-2 0/2 Pending 0 2d
$ kubectl describe nodes gke-my-cluster-my-node-pool-f05270d7-7c5d
…
Non-terminated Pods: (3 in total)
Namespace Name CPU Requests CPU Limits Memory Requests Memory Limits
--------- ---- ------------ ---------- --------------- -------------
kube-system fluentd-cloud-logging-gke-my-cluster-my-node-pool-f05270d7-7c5d 100m (5%) 0 (0%) 200Mi (1%) 200Mi (1%)
kube-system kube-dns-3263495268-hw5bl 260m (13%) 0 (0%) 110Mi (0%) 170Mi (1%)
kube-system kube-proxy-gke-my-cluster-my-node-pool-f05270d7-7c5d 100m (5%) 0 (0%) 0 (0%) 0 (0%)
Allocated resources:
(Total limits may be over 100 percent, i.e., overcommitted.)
CPU Requests CPU Limits Memory Requests Memory Limits
------------ ---------- --------------- -------------
460m (23%) 0 (0%) 310Mi (2%) 370Mi (2%)
答案1
您可以使用污点为此。这是一项测试版功能,您可以用污点标记节点,并用匹配的容差标记 Pod。没有容差的 Pod 将不会被调度到受污染的节点上。