Skip to content

feat: Fix up Kubelet file permissions #1110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ spec:
kubeletExtraArgs:
cloud-provider: external
name: '{{ ds.meta_data.local_hostname }}'
postKubeadmCommands:
- chmod 600 "$(systemctl show -P FragmentPath kubelet.service)"
- chmod 600 /var/lib/kubelet/config.yaml
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: AWSMachineTemplate
Expand Down Expand Up @@ -142,3 +145,6 @@ spec:
kubeletExtraArgs:
cloud-provider: external
name: '{{ ds.meta_data.local_hostname }}'
postKubeadmCommands:
- chmod 600 "$(systemctl show -P FragmentPath kubelet.service)"
- chmod 600 /var/lib/kubelet/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ spec:
nodeRegistration: {}
joinConfiguration:
nodeRegistration: {}
postKubeadmCommands:
- chmod 600 "$(systemctl show -P FragmentPath kubelet.service)"
- chmod 600 /var/lib/kubelet/config.yaml
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: DockerMachineTemplate
Expand Down Expand Up @@ -132,3 +135,6 @@ spec:
spec:
joinConfiguration:
nodeRegistration: {}
postKubeadmCommands:
- chmod 600 "$(systemctl show -P FragmentPath kubelet.service)"
- chmod 600 /var/lib/kubelet/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ spec:
tls-cipher-suites: TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256
postKubeadmCommands:
- echo "after kubeadm call" > /var/log/postkubeadm.log
- chmod 600 "$(systemctl show -P FragmentPath kubelet.service)"
- chmod 600 /var/lib/kubelet/config.yaml
preKubeadmCommands:
- echo "before kubeadm call" > /var/log/prekubeadm.log
- hostnamectl set-hostname "{{ ds.meta_data.hostname }}"
Expand Down Expand Up @@ -223,6 +225,9 @@ spec:
- echo "127.0.0.1 {{ ds.meta_data.hostname }}" >> /etc/hosts
useExperimentalRetryJoin: true
verbosity: 10
postKubeadmCommands:
- chmod 600 "$(systemctl show -P FragmentPath kubelet.service)"
- chmod 600 /var/lib/kubelet/config.yaml
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: NutanixClusterTemplate
Expand Down
12 changes: 12 additions & 0 deletions hack/examples/overlays/clusterclasses/aws/kustomization.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,16 @@ patches:
- target:
kind: KubeadmControlPlaneTemplate
path: ../../../patches/disable-kubeadmcontrolplane-profiling.yaml
- target:
kind: KubeadmControlPlaneTemplate
path: ../../../patches/initialize-postkubeadmcommands.yaml
- target:
kind: KubeadmControlPlaneTemplate
path: ../../../patches/kubelet-file-permissions.yaml
- target:
kind: KubeadmConfigTemplate
path: ../../../patches/initialize-postkubeadmcommands.yaml
- target:
kind: KubeadmConfigTemplate
path: ../../../patches/kubelet-file-permissions.yaml
# END CIS patches
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,16 @@ patches:
- target:
kind: KubeadmControlPlaneTemplate
path: ../../../patches/disable-kubeadmcontrolplane-profiling.yaml
- target:
kind: KubeadmControlPlaneTemplate
path: ../../../patches/initialize-postkubeadmcommands.yaml
- target:
kind: KubeadmControlPlaneTemplate
path: ../../../patches/kubelet-file-permissions.yaml
- target:
kind: KubeadmConfigTemplate
path: ../../../patches/initialize-postkubeadmcommands.yaml
- target:
kind: KubeadmConfigTemplate
path: ../../../patches/kubelet-file-permissions.yaml
# END CIS patches
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,13 @@ patches:
- target:
kind: KubeadmControlPlaneTemplate
path: ../../../patches/disable-kubeadmcontrolplane-profiling.yaml
- target:
kind: KubeadmControlPlaneTemplate
path: ../../../patches/initialize-postkubeadmcommands.yaml
- target:
kind: KubeadmControlPlaneTemplate
path: ../../../patches/kubelet-file-permissions.yaml
- target:
kind: KubeadmConfigTemplate
path: ../../../patches/kubelet-file-permissions.yaml
# END CIS patches
6 changes: 6 additions & 0 deletions hack/examples/patches/initialize-postkubeadmcommands.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Copyright 2025 Nutanix. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

- op: add
path: /spec/template/spec/postKubeadmCommands
value: []
9 changes: 9 additions & 0 deletions hack/examples/patches/kubelet-file-permissions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright 2025 Nutanix. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

- op: add
path: /spec/template/spec/postKubeadmCommands/-
value: chmod 600 "$(systemctl show -P FragmentPath kubelet.service)"
- op: add
path: /spec/template/spec/postKubeadmCommands/-
value: chmod 600 /var/lib/kubelet/config.yaml
Loading