Why is this not a valid command? (from RBAC lab) > > kubectl auth can-i ge . . .

Magnus Markling:
Why is this not a valid command? (from RBAC lab)
> > kubectl auth can-i get pod dark-blue-app --namespace=blue
> error: you must specify two or three arguments: verb, resource, and optional resourceName

DS Dsouza:
Hello Magnus, i think

DS Dsouza:

kubectl auth can-i create deployments --namespace dev

DS Dsouza:
the = is causing the issue

Magnus Markling:
i’m afraid that doesn’t change anything. even with “–namespace blue” I get the same error

Magnus Markling:
> kubectl auth can-i get pod dark-blue-app --namespace blue
does it work for you to run this? (now without = )

I get the same error as well, I only get the error when I specify the resourceName. Even though in the error message it says that it can be added as an option. I don’t know if it’s me who is doing it wrong, a kubernetes problem, or a kodekloud problem

Hello @gast.oussama,
If you are checking the permission for a specific resource then please use the “/” symbol as shown below: -

kubectl auth can-i get pods/dark-blue-app -n blue

You can do kubectl auth can-i --help . A similar example is available for a job.
There is no issue with the labs and with k8s.

Hope this information helps you to clear your doubts.

Regards,
KodeKloud Support

1 Like

Yes, this works, Thanks.