Protecting Important Directories in a Kubernetes Cluster

Restricting Access to Directories and Configmaps

The Kubeconfig, Kubeletconfig, and Kubeadmconfig contain important information about the cluster.       

Apart from information gathering, modifying these configs can paralyze the cluster.

By default, the following directories contain important information about the cluster:

  • /etc/kubernetes/
  • /var/lib/kubelet/
  • /etc/sysconfig/kubelet
  • $HOME/./kube/config.yaml

These directories are only relevant for troubleshooting. Therefore, non-admin users should not have any access rights to these paths. Since all paths are immediately visible with "systemctl cat kubelet", "systemctl" should only be accessible to admins of the cluster. Furthermore, these directories are mounted in the corresponding pods by configmaps in the kube-system namespace. Therefore, access to the configmaps should also be restricted to the kube-system namespace.

Design Escapes