LinuxCommandLibrary

kubectl-auth

checks authorization permissions

TLDR

Check if action is allowed

$ kubectl auth can-i [create] [pods]
copy
Check as user
$ kubectl auth can-i [delete] [deployments] --as [user@example.com]
copy
Check in namespace
$ kubectl auth can-i [get] [secrets] -n [namespace]
copy
List all permissions
$ kubectl auth can-i --list
copy
Check all namespaces
$ kubectl auth can-i [get] [pods] --all-namespaces
copy
Reconcile RBAC
$ kubectl auth reconcile -f [rbac.yaml]
copy

SYNOPSIS

kubectl auth subcommand [options]

DESCRIPTION

kubectl auth checks authorization permissions. It verifies what actions are allowed for users and service accounts.
The command tests RBAC policies. It's useful for debugging access issues and auditing permissions.

PARAMETERS

can-i VERB RESOURCE

Check authorization.
reconcile
Reconcile RBAC rules.
--as USER
Impersonate user.
--as-group GROUP
Impersonate group.
--list
List all permissions.
-n NAMESPACE
Target namespace.
--help
Display help information.

CAVEATS

Subcommand of kubectl. Shows RBAC results. May not reflect all policies.

HISTORY

kubectl auth provides authorization checking for Kubernetes RBAC policies and access debugging.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community