这是我的守护进程
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: nginx
spec:
selector:
matchLabels:
run: nginx
template:
metadata:
labels:
run: nginx
annotations:
"cluster-autoscaler.kubernetes.io/enable-ds-eviction": "false"
"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"
spec:
containers:
- image: nginx
imagePullPolicy: IfNotPresent
name: nginx
ports:
- containerPort: 80
protocol: TCP
根据documentation .
cluster-autoscaler.kubernetes.io/enable-ds-eviction: "false" 应防止缩减。
但 GKE 集群自动缩放器会忽略此注释。
有什么方法可以防止 DaemonSet 被集群自动缩放器驱逐?
最佳答案
一旦节点实际为空,cluster-autoscaler.kubernetes.io/enable-ds-eviction
注释将不适用。在缩减过程中,当自动缩放器在其他地方驱逐/重新安排 pod 时,当 cluster-autoscaler.kubernetes.io/enable-ds-eviction
设置为 false 时,它将忽略守护进程。一旦节点为空(即不再有任何部署的 pod),该节点将被删除(并且 daemonset pod 将被优雅地终止)。
关于kubernetes - GKE,如何避免 DaemonSet 被 cluster autoscaler 逐出?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69581301/