1

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?

jake wong
  • 4,909
  • 12
  • 42
  • 85
  • Are you using managed K8s cluster (AKS, EKS, GKE)? Or is it self-managed? Which version of K8s are you using? –  Mar 28 '22 at 09:32
  • hello. i'm using a local k8s cluster on tinker board (is like a raspberry pi). it was started using kubeadm. – jake wong Mar 28 '22 at 10:46
  • And which version of K8s are you using? –  Mar 28 '22 at 12:29
  • Yes i should have provided this info: `Client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.5", GitCommit:"c285e781331a3785a7f436042c65c5641ce8a9e9", GitTreeState:"clean", BuildDate:"2022-03-16T15:58:47Z", GoVersion:"go1.17.8", Compiler:"gc", Platform:"linux/arm64"} Server Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.4", GitCommit:"b695d79d4f967c403a96986f1750a35eb75e75f1", GitTreeState:"clean", BuildDate:"2021-11-17T15:42:41Z", GoVersion:"go1.16.10", Compiler:"gc", Platform:"linux/arm64"}` – jake wong Mar 28 '22 at 17:44
  • Does the kubelet have `--dynamic-config-dir` flag configured, and `DynamicKubeletConfig=true` feature enabled? –  Mar 29 '22 at 05:40

0 Answers0