Playing with PSPs I noticed that upon creation of a PSP object denying privileged pods and activation of PodSecurityPolicy admission controller on the kube-apiserver.yaml file, the kube-apiserver pod is no longer listed as a pod in kube-system namespace.
It seems logical as kube-apiserver pod runs as privileged container, however, apart from not showing up in the list of pods, all queries are successful.
Could it be that there is an explanation for this behavior i am missing here?
“Failed creating a mirror pod for” err=“pods "kube-apiserver-controlplane" is forbidden: PodSecurityPolicy: unable to admit pod: []” pod=“kube-system/kube-apiserver-controlplane”
Can you please let me know how we deal with this situation in the exam but more importantly in the real world, after enabling PSP Admission controller?
Well, after PodSecurityPolicy is added as an additional admission plugin in the kube-apiserver manifest, the kube-apiserver pod is no longer showing in the list of running pods, but the api server is actually responding to kubectl and all other pods are up.
Studying a bit more i found out this is expected behavior if there is no default psp and relevant RBAC config, allowing the creation of pods in the kube-system namespace.
I think it would be great if this point is clarified in the lecture.
You have to get the user that your kubeadm is using to create your static pods and add it to the cluster role binding, but that is not enough, you also have to add an annotation about seccomp. I included on my example also the required stuff to allow the NGINX Ingress Controller pod.