-
Notifications
You must be signed in to change notification settings - Fork 278
Description
The aws-node-termination-handler-psp RoleBinding references the aws-node-termination-handler ServiceAccount in kube-system. But the RoleBinding itself does not specify a namespace.
Note the lack of namespace under metadata:
aws-node-termination-handler/config/helm/aws-node-termination-handler/templates/psp.yaml
Lines 48 to 62 in 85e022b
| apiVersion: rbac.authorization.k8s.io/v1 | |
| kind: RoleBinding | |
| metadata: | |
| name: {{ template "aws-node-termination-handler.fullname" . }}-psp | |
| labels: | |
| {{ include "aws-node-termination-handler.labels" . | indent 4 }} | |
| roleRef: | |
| apiGroup: rbac.authorization.k8s.io | |
| kind: ClusterRole | |
| name: {{ template "aws-node-termination-handler.fullname" . }}-psp | |
| subjects: | |
| - kind: ServiceAccount | |
| name: {{ template "aws-node-termination-handler.serviceAccountName" . }} | |
| namespace: {{ .Release.Namespace }} | |
| {{- end }} |
As such, it gets installed into the default namespace.
$ kubectl get rolebindings -n default
NAME ROLE AGE
aws-node-termination-handler-psp ClusterRole/aws-node-termination-handler-psp 15h
I'm not an expert in Kubernetes RBAC or PSPs, so apologies if this is off base, but according to https://kubernetes.io/docs/concepts/policy/pod-security-policy/, it seems like the PSP will have no effect since the RoleBinding doesn't grant access to the namespace that NTH actually runs in (kube-system):
When a PodSecurityPolicy resource is created, it does nothing. In order to use it, the requesting user or target pod's service account must be authorized to use the policy, by allowing the use verb on the policy.