OC-CREATE-TOKEN(1)

πŸ“¦
version 4.22.0 Β· 2 versions
, in nixpkgs unstable

πŸ’… OC CREATE(1) β€” oc create token

okay bestie, welcome to the oc create token manual page, being the Openshift CLI User Manuals situation, and yes we're gonna get through it together πŸ’–


✨ NAME ✨

oc create token β€” request a service account token. that's it. that's the whole vibe πŸŽ€

πŸ¦‹ SYNOPSIS πŸ¦‹

oc create token [OPTIONS]

🌸 DESCRIPTION 🌸

Request a service account token. literally what it says on the tin, no cap 🫢


✨ OPTIONS ✨

  • --allow-missing-template-keys=true β€” if true, ignore any errors that pop up in templates when a field or a map key is missing from the template. heads up though: this only applies to the golang and jsonpath output formats, so don't go thinking it saves you everywhere πŸ™ˆ
  • --audience=[] β€” the audience of the token you're requesting. if you leave it unset, it defaults to requesting a token for use with the Kubernetes API server. you can repeat this flag to request a token that's valid for multiple audiences β€” multitasking icon behavior πŸ‘‘
  • --bound-object-kind="" β€” kind of object to bind the token to. the supported kinds are Node, Pod, Secret. if you set this, you must also provide --bound-object-name. no skipping, bestie πŸ’€
  • --bound-object-name="" β€” name of the object to bind the token to. the token will expire when that object gets deleted, so it's giving "we go down together" energy. requires --bound-object-kind
  • --bound-object-uid="" β€” UID of an object to bind the token to. requires --bound-object-kind and --bound-object-name. if you leave it unset, the UID of the existing object is used ✨
  • --duration=0 β€” the requested lifetime of the issued token. if it's not set, or if it's set to 0, the lifetime is determined by the server automatically. and lowkey the server may hand you back a token with a longer or shorter lifetime than you asked for, so don't come for it 🌈
  • -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 a 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]

πŸ’œ OPTIONS INHERITED FROM PARENT COMMANDS πŸ’œ

these aren't even hers, she inherited them, and we respect the lineage πŸ‘‘

  • --as="" β€” username to impersonate for the operation. the 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="/homeless-shelter/.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, so like… be so serious before you flip this one, fr fr 😭
  • --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 the KUBECTL_KUBERC=false feature gate, or by 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
  • --profile="none" β€” name of profile to capture. one of (none|cpu|heap|goroutine|threadcreate|block|mutex)
  • --profile-output="profile.pprof" β€” name of the file to write the profile to
  • --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 ⭐
  • -s, --server="" β€” the address and port of the Kubernetes API server
  • --tls-server-name="" β€” server name to use for server certificate validation. if it's 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
  • --warnings-as-errors=false β€” treat warnings received from the server as errors and exit with a non-zero exit code πŸ’€

πŸ”₯ EXAMPLE πŸ”₯

here's the part where she demonstrates. look at her go 🧚

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

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

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

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

# Request a token bound to an instance of a Secret object
oc 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
oc create token myapp --bound-object-kind Secret --bound-object-name mysecret --bound-object-uid 0d4691ed-659b-4935-a832-355f77ee47cc

πŸ‘€ SEE ALSO πŸ‘€

(and that's the whole guest list, she keeps it tight ✨)


πŸŽ€ HISTORY πŸŽ€

June 2016, Ported from the Kubernetes man-doc generator β€” vintage, iconic, still slaying πŸ’…


and that's the page, bestie!! brought to you by Openshift / Openshift CLI User Manuals, dated June 2016, footer and all πŸ«ΆπŸ’– no cap, go request some tokens responsibly ✨

πŸ“¦ where this page comes from