I'm using Python and want to be able to check the status of a pod with:
kubernetes.client.CoreV1Api().read_namespaced_pod_status(name=name, namespace='default')
but this give my a forbidden, 403 response, while:
kubernetes.client.CoreV1Api().list_pod_for_all_namespaces()
works fine. The rights I have setup in a ClusterRole looks like this:
rules:
- apiGroups: ["", "extensions"]
resources: ["pods", "services", "ingresses"]
verbs: ["get", "watch", "list", "create", "delete"]
So what do I need to modify to make it work?
Pod's status is a sub-resource of the ["pod"] resource, so you have to define it for your ClusterRole as follows:
rules:
- apiGroups: ["", "extensions"]
resources: ["pods","pods/status" "services", "ingresses"]
verbs: ["get", "watch", "list", "create", "delete"]