Skip to content

Commit 082507c

Browse files
kubelet: conditionalize staticPodPath location (#12433)
Add variable to set kubelet staticPodPath location. It can be set to empty so that we can choose to disable it for some nodes. STIG recommendation is to disable it. Signed-off-by: Shaleen Bathla <shaleenbathla@gmail.com> Co-authored-by: ChengHao Yang <17496418+tico88612@users.noreply.github.com>
1 parent bae7278 commit 082507c

3 files changed

Lines changed: 5 additions & 1 deletion

File tree

docs/operations/hardening.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ kubelet_make_iptables_util_chains: true
9696
kubelet_feature_gates: ["RotateKubeletServerCertificate=true"]
9797
kubelet_seccomp_default: true
9898
kubelet_systemd_hardening: true
99+
# To disable kubelet's staticPodPath (for nodes that don't use static pods like worker nodes)
100+
kubelet_static_pod_path: ""
99101
# In case you have multiple interfaces in your
100102
# control plane nodes and you want to specify the right
101103
# IP addresses, kubelet_secure_addresses allows you

roles/kubernetes/node/defaults/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,8 @@ conntrack_modules:
188188
- nf_conntrack
189189
- nf_conntrack_ipv4
190190

191+
# Set this option to "" (empty) to disable staticPodPath (See docs/operations/hardening.md)
192+
kubelet_static_pod_path: "{{ kube_manifest_dir }}"
191193

192194
## Enable distributed tracing for kubelet
193195
kubelet_tracing: false

roles/kubernetes/node/templates/kubelet-config.v1beta1.yaml.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ enforceNodeAllocatable:
2222
- {{ item }}
2323
{% endfor %}
2424
{% endif %}
25-
staticPodPath: {{ kube_manifest_dir }}
25+
staticPodPath: "{{ kubelet_static_pod_path }}"
2626
cgroupDriver: {{ kubelet_cgroup_driver | default('systemd') }}
2727
containerLogMaxFiles: {{ kubelet_logfiles_max_nr }}
2828
containerLogMaxSize: {{ kubelet_logfiles_max_size }}

0 commit comments

Comments
 (0)