Check RBAC permissions

Checks if a ServiceAccount can list pods; change the verb and resource to check other actions

kubectl auth can-i list pods --as=system:serviceaccount:<ns>:<sa> -n <ns>

tool
kubectl73 commands
tags
rbacdebug

More kubectl commands

  • kubectl get pods -n <ns> -o custom-columns='NAME:.metadata.name,NODE:.spec.nodeName,STATUS:.status.phase'

    Prints only the fields you need, no jq required

  • kubectl patch deployment <name> -n <ns> -p '{"spec":{"replicas":2}}'

    Changes one field with an inline JSON patch, without editing the whole manifest

  • kubectl annotate pod <pod> -n <ns> key=value --overwrite

    Adds or updates an annotation; --overwrite replaces the existing value

  • kubectl label node <node> role=worker --overwrite

    Adds or changes a label on any resource, here on a node

  • kubectl taint nodes <node> key=value:NoSchedule

    Pods without a matching toleration will not be scheduled on this node

all 73 kubectl commands