'Kubernetes: no errors when editing node config, but changes not reflected

I am following this tutorial on kubernetes site to reconfigure my nodes so that I can change gracefullshutdown from 0s to 30s.

after generating the configz file from kubectl proxy, I made the changes and pushed it to the control plane kube-system config location.

running: k get configmap -n kube-system yields the below:

NAME                                 DATA   AGE
coredns                              1      113d
extension-apiserver-authentication   6      113d
kube-flannel-cfg                     2      113d
kube-proxy                           2      113d
kube-root-ca.crt                     1      113d
kubeadm-config                       1      113d
kubelet-config-1.22                  1      113d
my-config-v1-ttk6dmhmmk              1      55m

taking a look at my-config-v1-ttkxxxxxx shows that it is indeed in the correct format with my gracefullshutdown changes:

# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
data:
  kubelet: |
    {
      "enableServer": true,
      "staticPodPath": "/etc/kubernetes/manifests",
      "syncFrequency": "1m0s",
       ...
      "enableSystemLogHandler": true,
      "shutdownGracePeriod": "30s",
      "shutdownGracePeriodCriticalPods": "10s",
      "enableProfilingHandler": true,
      "enableDebugFlagsHandler": true,
      "seccompDefault": false,
      "memoryThrottlingFactor": 0.8,
      "registerNode": true,
      "kind": "KubeletConfiguration",
      "apiVersion": "kubelet.config.k8s.io/v1beta1"
    }
kind: ConfigMap
metadata:
  creationTimestamp: "2022-03-26T09:52:34Z"
  name: my-config-v1-ttk6dmhmmk
  namespace: kube-system
  resourceVersion: "168825"
  uid: 09876a0a-fadd-4bc4-b80a-6a058304f304

This is where the problem comes about

I am trying to apply this config map to the node. I don't get any errors, but the changes are not applied either...

NODE_NAME=my-node-1
CONFIG_MAP_NAME=my-config-v1-ttk6dmhmmk
kubectl patch node ${NODE_NAME} -p "{\"spec\":{\"configSource\":{\"configMap\":{\"name\":\"${CONFIG_MAP_NAME}\",\"namespace\":\"kube-system\",\"kubeletConfigKey\":\"kubelet\"}}}}"

# result:
node/my-node-1 patched

finally, when I check back on it with kubectl get no ${NODE_NAME} -o json | jq '.status.config' the result is null....

any idea what is happening?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source