This is my DaemonSet
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
According to the documentation.
cluster-autoscaler.kubernetes.io/enable-ds-eviction: "false" should prevent scaling down.
But GKE cluster autoscaler ignores this annotation.
Is there any way to prevent DaemonSet from being evicted by the cluster autoscaler?
CodePudding user response:
The cluster-autoscaler.kubernetes.io/enable-ds-eviction
annotation does not apply once a node is actually empty. During the scale down process, while the autoscaler is evicting/rescheduling pods elsewhere, it will ignore daemonsets when cluster-autoscaler.kubernetes.io/enable-ds-eviction
is set to false. Once the node is empty (i.e. no longer has any deployed pods), the node will then be removed (and the daemonset pod will be gracefully terminated).