Browse Source

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>
pull/12475/head
Shaleen Bathla 1 month ago
committed by GitHub
parent
commit
082507cff2
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 1 deletions
  1. 2
      docs/operations/hardening.md
  2. 2
      roles/kubernetes/node/defaults/main.yml
  3. 2
      roles/kubernetes/node/templates/kubelet-config.v1beta1.yaml.j2

2
docs/operations/hardening.md

@ -96,6 +96,8 @@ kubelet_make_iptables_util_chains: true
kubelet_feature_gates: ["RotateKubeletServerCertificate=true"] kubelet_feature_gates: ["RotateKubeletServerCertificate=true"]
kubelet_seccomp_default: true kubelet_seccomp_default: true
kubelet_systemd_hardening: true kubelet_systemd_hardening: true
# To disable kubelet's staticPodPath (for nodes that don't use static pods like worker nodes)
kubelet_static_pod_path: ""
# In case you have multiple interfaces in your # In case you have multiple interfaces in your
# control plane nodes and you want to specify the right # control plane nodes and you want to specify the right
# IP addresses, kubelet_secure_addresses allows you # IP addresses, kubelet_secure_addresses allows you

2
roles/kubernetes/node/defaults/main.yml

@ -188,6 +188,8 @@ conntrack_modules:
- nf_conntrack - nf_conntrack
- nf_conntrack_ipv4 - nf_conntrack_ipv4
# Set this option to "" (empty) to disable staticPodPath (See docs/operations/hardening.md)
kubelet_static_pod_path: "{{ kube_manifest_dir }}"
## Enable distributed tracing for kubelet ## Enable distributed tracing for kubelet
kubelet_tracing: false kubelet_tracing: false

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

@ -22,7 +22,7 @@ enforceNodeAllocatable:
- {{ item }} - {{ item }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
staticPodPath: {{ kube_manifest_dir }}
staticPodPath: "{{ kubelet_static_pod_path }}"
cgroupDriver: {{ kubelet_cgroup_driver | default('systemd') }} cgroupDriver: {{ kubelet_cgroup_driver | default('systemd') }}
containerLogMaxFiles: {{ kubelet_logfiles_max_nr }} containerLogMaxFiles: {{ kubelet_logfiles_max_nr }}
containerLogMaxSize: {{ kubelet_logfiles_max_size }} containerLogMaxSize: {{ kubelet_logfiles_max_size }}

Loading…
Cancel
Save