From f27876c6abf41e5f5165bd037f6e0288fcc1b00b Mon Sep 17 00:00:00 2001 From: songtianlun Date: Tue, 22 Apr 2025 16:06:51 +0800 Subject: [PATCH] feat: add node affinity for DaemonSet scheduling - Implement node affinity to prevent scheduling on vkvm-us2 - Update affinity section in daemonset.yaml - Ensure that the DaemonSet runs only on specific nodes This change introduces a node affinity rule to the DaemonSet configuration, allowing it to avoid scheduling on nodes labeled with `kubernetes.io/hostname` set to `vkvm-us2`. This helps to ensure resource allocation and performance by restricting the DaemonSet to the desired nodes. --- backups/daemonset+cronjob/daemonset.yaml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/backups/daemonset+cronjob/daemonset.yaml b/backups/daemonset+cronjob/daemonset.yaml index 8d5ebd6..d79e747 100644 --- a/backups/daemonset+cronjob/daemonset.yaml +++ b/backups/daemonset+cronjob/daemonset.yaml @@ -14,10 +14,15 @@ spec: spec: #nodeSelector: # kubernetes.io/hostname: "vkvm-us1" - #affinity: - # nodeAffinity: - # requiredDuringSchedulingIgnoredDuringExecution: - # nodeSelectorTerms: + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: kubernetes.io/hostname + operator: NotIn + values: + - vkvm-us2 # - matchExpressions: # #- key: region # # operator: NotIn