Create a ServiceAccount token

Generates a short-lived bound token, here valid for 1 hour

kubectl create token <sa-name> -n <ns> --duration=1h

tool
kubectl73 commands
tags
rbacconfig

More kubectl commands

  • kubectl auth can-i --list -n <ns>

    Shows everything the current user can do in the namespace

  • kubectl delete pods --all -n <ns>

    Forces all pods to be recreated; handy after a ConfigMap change

  • kubectl get ingress -A

    All Ingress resources with their hosts and addresses

  • kubectl get pods -n <ns> -o yaml > pods-dump.yaml

    Saves the full state of all pods in a namespace for backup or analysis

  • kubectl get pods -A -o jsonpath='{range .items[*]}{.metadata.namespace}{"\t"}{.metadata.name}{"\t"}{range .spec.containers[*]}{.image}{"\n"}{end}{end}'

    Shows every container image running in the cluster, with namespace and pod

all 73 kubectl commands