From e02ff0687e5ae03da7becb43fd40b892fcf42723 Mon Sep 17 00:00:00 2001 From: David Porter Date: Thu, 29 Apr 2021 14:42:23 -0700 Subject: [PATCH] Remove node termination handler addon --- .../addons/node-termination-handler/README | 4 - .../node-termination-handler/daemonset.yaml | 74 ------------------- cluster/gce/config-default.sh | 8 -- cluster/gce/config-test.sh | 8 -- cluster/gce/gci/configure-helper.sh | 17 ----- cluster/gce/util.sh | 1 - 6 files changed, 112 deletions(-) delete mode 100644 cluster/gce/addons/node-termination-handler/README delete mode 100644 cluster/gce/addons/node-termination-handler/daemonset.yaml diff --git a/cluster/gce/addons/node-termination-handler/README b/cluster/gce/addons/node-termination-handler/README deleted file mode 100644 index bca8ade8952..00000000000 --- a/cluster/gce/addons/node-termination-handler/README +++ /dev/null @@ -1,4 +0,0 @@ -# GCE Node Termination Handler - -This addon deploys [GCE Node Termination Handler](https://github.com/GoogleCloudPlatform/k8s-node-termination-handler) on to kubernetes clusters on GCP. -It is meant to help translate GCE VM termination notifications into kubernetes graceful terminations. diff --git a/cluster/gce/addons/node-termination-handler/daemonset.yaml b/cluster/gce/addons/node-termination-handler/daemonset.yaml deleted file mode 100644 index c3b42149c87..00000000000 --- a/cluster/gce/addons/node-termination-handler/daemonset.yaml +++ /dev/null @@ -1,74 +0,0 @@ ---- -apiVersion: apps/v1 -kind: DaemonSet -metadata: - labels: - addonmanager.kubernetes.io/mode: Reconcile - k8s-app: node-termination-handler - namespace: kube-system - name: node-termination-handler -spec: - selector: - matchLabels: - k8s-app: node-termination-handler - updateStrategy: - type: RollingUpdate - template: - metadata: - labels: - k8s-app: node-termination-handler - spec: - priorityClassName: system-node-critical - # Necessary to reboot node - hostPID: true - affinity: - nodeAffinity: - # Restrict to GPU nodes or preemptible nodes - requiredDuringSchedulingIgnoredDuringExecution: - nodeSelectorTerms: - - matchExpressions: - - key: cloud.google.com/gke-accelerator - operator: Exists - - matchExpressions: - - key: cloud.google.com/gke-preemptible - operator: Exists - volumes: - - name: klet-service-account - hostPath: - path: /var/lib/kubelet - - name: klet-ca-crt - hostPath: - path: /etc/srv/kubernetes - tolerations: - # Run regardless of any existing taints. - - effect: NoSchedule - operator: Exists - - effect: NoExecute - operator: Exists - containers: - - image: k8s.gcr.io/gke-node-termination-handler@sha256:aca12d17b222dfed755e28a44d92721e477915fb73211d0a0f8925a1fa847cca - name: node-termination-handler - command: ["./node-termination-handler"] - args: ["--logtostderr", "--exclude-pods=$(POD_NAME):$(POD_NAMESPACE)", "-v=10", "--kubeconfig=/var/lib/kubelet/kubeconfig", "--taint=cloud.google.com/impending-node-termination::NoSchedule"] - securityContext: - capabilities: - # Necessary to reboot node - add: ["SYS_BOOT"] - env: - - name: POD_NAME - valueFrom: - fieldRef: - fieldPath: metadata.name - - name: POD_NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace - resources: - limits: - cpu: 50m - memory: 30Mi - volumeMounts: - - name: klet-service-account - mountPath: /var/lib/kubelet - - name: klet-ca-crt - mountPath: /etc/srv/kubernetes diff --git a/cluster/gce/config-default.sh b/cluster/gce/config-default.sh index 6211a74c57c..4464cc82350 100755 --- a/cluster/gce/config-default.sh +++ b/cluster/gce/config-default.sh @@ -513,14 +513,6 @@ CONCURRENT_SERVICE_SYNCS="${CONCURRENT_SERVICE_SYNCS:-}" export SERVICEACCOUNT_ISSUER="https://kubernetes.io/${CLUSTER_NAME}" -# Optional: Enable Node termination Handler for Preemptible and GPU VMs. -# https://github.com/GoogleCloudPlatform/k8s-node-termination-handler -ENABLE_NODE_TERMINATION_HANDLER="${ENABLE_NODE_TERMINATION_HANDLER:-false}" -# Override default Node Termination Handler Image -if [[ "${NODE_TERMINATION_HANDLER_IMAGE:-}" ]]; then - PROVIDER_VARS="${PROVIDER_VARS:-} NODE_TERMINATION_HANDLER_IMAGE" -fi - # Taint Windows nodes by default to prevent Linux workloads from being # scheduled onto them. WINDOWS_NODE_TAINTS="${WINDOWS_NODE_TAINTS:-node.kubernetes.io/os=win1809:NoSchedule}" diff --git a/cluster/gce/config-test.sh b/cluster/gce/config-test.sh index 80bbbee499a..c14535fbcab 100755 --- a/cluster/gce/config-test.sh +++ b/cluster/gce/config-test.sh @@ -565,14 +565,6 @@ CONCURRENT_SERVICE_SYNCS=${CONCURRENT_SERVICE_SYNCS:-} # to resolve the partially qualified name. export SERVICEACCOUNT_ISSUER='https://kubernetes.default.svc.cluster.local' -# Optional: Enable Node termination Handler for Preemptible and GPU VMs. -# https://github.com/GoogleCloudPlatform/k8s-node-termination-handler -ENABLE_NODE_TERMINATION_HANDLER=${ENABLE_NODE_TERMINATION_HANDLER:-false} -# Override default Node Termination Handler Image -if [[ "${NODE_TERMINATION_HANDLER_IMAGE:-}" ]]; then - PROVIDER_VARS="${PROVIDER_VARS:-} NODE_TERMINATION_HANDLER_IMAGE" -fi - # Taint Windows nodes by default to prevent Linux workloads from being # scheduled onto them. WINDOWS_NODE_TAINTS=${WINDOWS_NODE_TAINTS:-node.kubernetes.io/os=win1809:NoSchedule} diff --git a/cluster/gce/gci/configure-helper.sh b/cluster/gce/gci/configure-helper.sh index 0636ac053ff..b1fafa91e86 100644 --- a/cluster/gce/gci/configure-helper.sh +++ b/cluster/gce/gci/configure-helper.sh @@ -2287,12 +2287,6 @@ function setup-addon-manifests { copy-manifests "${psp_dir}" "${dst_dir}" fi fi - if [[ "${ENABLE_NODE_TERMINATION_HANDLER:-}" == "true" ]]; then - local -r nth_dir="${src_dir}/${3:-$2}/node-termination-handler" - if [[ -d "${nth_dir}" ]]; then - copy-manifests "${nth_dir}" "${dst_dir}" - fi - fi } # A function that downloads extra addons from a URL and puts them in the GCI @@ -2708,10 +2702,6 @@ EOF if [[ "${ENABLE_NVIDIA_GPU_DEVICE_PLUGIN:-}" == "true" ]]; then setup-addon-manifests "addons" "device-plugins/nvidia-gpu" fi - if [[ "${ENABLE_NODE_TERMINATION_HANDLER:-}" == "true" ]]; then - setup-addon-manifests "addons" "node-termination-handler" - setup-node-termination-handler-manifest '' - fi # Setting up the konnectivity-agent daemonset if [[ "${RUN_KONNECTIVITY_PODS:-false}" == "true" ]]; then setup-addon-manifests "addons" "konnectivity-agent" @@ -2820,13 +2810,6 @@ EOF cp "${src_file}" /etc/kubernetes/manifests } -function setup-node-termination-handler-manifest { - local -r nth_manifest="/etc/kubernetes/$1/$2/daemonset.yaml" - if [[ -n "${NODE_TERMINATION_HANDLER_IMAGE}" ]]; then - sed -i "s|image:.*|image: ${NODE_TERMINATION_HANDLER_IMAGE}|" "${nth_manifest}" - fi -} - function setup-konnectivity-agent-manifest { local -r manifest="/etc/kubernetes/addons/konnectivity-agent/konnectivity-agent-ds.yaml" sed -i "s|__APISERVER_IP__|${KUBERNETES_MASTER_NAME}|g" "${manifest}" diff --git a/cluster/gce/util.sh b/cluster/gce/util.sh index ff4084b7f59..25b9df62a40 100755 --- a/cluster/gce/util.sh +++ b/cluster/gce/util.sh @@ -1246,7 +1246,6 @@ VOLUME_PLUGIN_DIR: $(yaml-quote "${VOLUME_PLUGIN_DIR}") KUBELET_ARGS: $(yaml-quote "${KUBELET_ARGS}") REQUIRE_METADATA_KUBELET_CONFIG_FILE: $(yaml-quote true) ENABLE_NETD: $(yaml-quote "${ENABLE_NETD:-false}") -ENABLE_NODE_TERMINATION_HANDLER: $(yaml-quote "${ENABLE_NODE_TERMINATION_HANDLER:-false}") CUSTOM_NETD_YAML: | ${CUSTOM_NETD_YAML//\'/\'\'} CUSTOM_CALICO_NODE_DAEMONSET_YAML: |