KUBERNETES(1)(kubernetes)

πŸ“¦
version 1.37.2 Β· 5 versions
, in arch rolling, fedora 43, fedora 44, nixpkgs unstable

✨ KUBERNETES(1)(kubernetes) ✨

okay bestie, welcome to the kubernetes manual β€” section 1, the user commands zone πŸ’… this little page lives in the KUBERNETES(1)(kubernetes) corner of the manual universe, and it was originally put together by Eric Paris back in Jan 2015 🌸 (yes we're citing our sources, we're not heathens)


πŸŽ€ NAME πŸŽ€

kubectl create token β€” Request a service account token


πŸ¦‹ SYNOPSIS πŸ¦‹

kubectl create token [OPTIONS]

πŸ’– DESCRIPTION πŸ’–

Request a service account token. that's it, that's the whole vibe. you want a token, you ask for a token, the cluster says bet 🫢


✨ OPTIONS ✨

  • --allow-missing-template-keys=true β€” if true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. (so like, only the cool template girlies get this treatment πŸ’…)
  • --audience=[] β€” Audience of the requested token. If unset, defaults to requesting a token for use with the Kubernetes API server. May be repeated to request a token valid for multiple audiences. (one token, many audiences, main character energy fr fr πŸ‘‘)
  • --bound-object-kind="" β€” Kind of an object to bind the token to. Supported kinds are Node, Pod, Secret. If set, --bound-object-name must be provided. (no object name? then no binding, them's the rules 😀)
  • --bound-object-name="" β€” Name of an object to bind the token to. The token will expire when the object is deleted. Requires --bound-object-kind. (it's giving "we go down together" πŸ’€)
  • --bound-object-uid="" β€” UID of an object to bind the token to. Requires --bound-object-kind and --bound-object-name. If unset, the UID of the existing object is used. (leave it blank and it'll just grab the UID that's already there, lowkey convenient ✨)
  • --duration=0s β€” Requested lifetime of the issued token. If not set or if set to 0, the lifetime will be determined by the server automatically. The server may return a token with a longer or shorter lifetime. (you request, the server decides. the server is the final boss here πŸ™ˆ)
  • -o, --output="" β€” Output format. One of: (json, yaml, kyaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file). (pick your fighter βš”οΈ)
  • --show-managed-fields=false β€” If true, keep the managedFields when printing objects in JSON or YAML format.
  • --template="" β€” Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. (iykyk 🧚)

🌈 OPTIONS INHERITED FROM PARENT COMMANDS 🌈

these are the ones you get from the parent command, the family heirlooms πŸ’œ

  • --as="" β€” Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
  • --as-group=[] β€” Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
  • --as-uid="" β€” UID to impersonate for the operation.
  • --as-user-extra=[] β€” User extras to impersonate for the operation, this flag can be repeated to specify multiple values for the same key.
  • --cache-dir="/home/username/.kube/cache" β€” Default cache directory
  • --certificate-authority="" β€” Path to a cert file for the certificate authority
  • --client-certificate="" β€” Path to a client certificate file for TLS
  • --client-key="" β€” Path to a client key file for TLS
  • --cluster="" β€” The name of the kubeconfig cluster to use
  • --context="" β€” The name of the kubeconfig context to use
  • --disable-compression=false β€” If true, opt-out of response compression for all requests to the server
  • --insecure-skip-tls-verify=false β€” If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. 🚨 bestie do NOT casually flip this one, it literally says insecure, it means insecure, that's a whole vibe check you're failing on purpose
  • --kubeconfig="" β€” Path to the kubeconfig file to use for CLI requests.
  • --kuberc="" β€” Path to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.
  • --match-server-version=false β€” Require server version to match client version
  • -n, --namespace="" β€” If present, the namespace scope for this CLI request
  • --password="" β€” Password for basic authentication to the API server
  • --profile="none" β€” Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex|trace)
  • --profile-output="profile.pprof" β€” Name of the file to write the profile to
  • --proxy-url="" β€” Proxy URL to use for requests to the API server
  • --request-timeout="0" β€” The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (zero = no cap, we wait forever apparently 😭)
  • -s, --server="" β€” The address and port of the Kubernetes API server
  • --tls-server-name="" β€” Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
  • --token="" β€” Bearer token for authentication to the API server
  • --user="" β€” The name of the kubeconfig user to use
  • --username="" β€” Username for basic authentication to the API server
  • --version=false β€” --version, --version=raw prints version information and quits; --version=vX.Y.Z... sets the reported version
  • --warnings-as-errors=false β€” Treat warnings received from the server as errors and exit with a non-zero exit code

🌸 EXAMPLE 🌸

# Request a token to authenticate to the kube-apiserver as the service account "myapp" in the current namespace
kubectl create token myapp

# Request a token for a service account in a custom namespace
kubectl create token myapp --namespace myns

# Request a token with a custom expiration
kubectl create token myapp --duration 10m

# Request a token with a custom audience
kubectl create token myapp --audience https://example.com

# Request a token bound to an instance of a Secret object
kubectl create token myapp --bound-object-kind Secret --bound-object-name mysecret

# Request a token bound to an instance of a Secret object with a specific UID
kubectl create token myapp --bound-object-kind Secret --bound-object-name mysecret --bound-object-uid 0d4691ed-659b-4935-a832-355f77ee47cc

πŸ”₯ SEE ALSO πŸ”₯


πŸ’€ HISTORY πŸ’€

January 2015, Originally compiled by Eric Paris (eparis at redhat dot com) based on the kubernetes source material, but hopefully they have been automatically generated since! (iconic honestly, imagine writing a manpage in 2015 and it's still out here living its best life πŸ‘‘)


and that's the whole page bestie!! πŸŽ€ this was KUBERNETES(1)(kubernetes) β€” from the Manuals crew, filed under User, dated January 2015, originally compiled by Eric Paris (eparis at redhat dot com), built off the kubernetes source material. slay, stay tokenized, and don't skip the TLS verify flag 🫢✨

πŸ“¦ where this page comes from