OC-CREATE-TOKEN(1)
π
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 thegolangandjsonpathoutput 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 areNode,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-kindand--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 to0, 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 themanagedFieldswhen printing objects inJSONorYAMLformat--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 theKUBECTL_KUBERC=falsefeature gate, or by turning off the featureKUBERC=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
- nixpkgs unstable: openshift 4.22.0-202605222050
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms