0

I have written shell script for k8s cronjob which uses kubectl command to get namespaces with needed parameters (like age, name etc). But i have an issue like this: Error from server (Forbidden): namespaces is forbidden: User "system:serviceaccount:default:default" cannot list resource "namespaces" in API group "" at the cluster scope. I have tried to write a ClusterRole, but it didn't work too.

  • Does this answer your question? [How to run kubectl commands inside a container?](https://stackoverflow.com/questions/42642170/how-to-run-kubectl-commands-inside-a-container) – danielorn Aug 25 '21 at 10:43
  • 1
    you were in the right path `I have tried to write a ClusterRole, but it didn't work too.`. What is the error? why do you thinkit does not work ? ,have you tried `kubectl auth can-i get ns --as system:serviceaccount:default:default` ? – P.... Aug 25 '21 at 14:59

0 Answers0