kubectl auth can-i

The kubectl command that asks the authorizer whether an identity may perform one verb on one resource, answering yes or no.

In more detail

With --as you can check another identity, such as a service account, if you are allowed to impersonate it. It tests authorization only; it cannot predict a Pod Security Admission rejection. Test a nearby forbidden action as well, to prove the permission is narrow.

Examples

kubectl auth can-i get pods --as=web
kubectl auth can-i get secrets --as=web

Related terms

Taught in

References

Certification courses