OC-SERVICEACCOUNTS-CREATE-KUBECONFIG(1)
π oc serviceaccounts create-kubeconfig β like, the whole manual but make it make sense
okay so bestie, this one lives in the Openshift CLI User Manuals family, and it's genuinely one of those lil commands that just works. pull up a chair. π
β¨ NAME β¨
oc serviceaccounts create-kubeconfig β the command that generates a kubeconfig file for a service account. that's it. that's the vibe. π«Ά
β¨ SYNOPSIS β¨
oc serviceaccounts create-kubeconfig [OPTIONS]
πΈ DESCRIPTION πΈ
so what it does is: it generates a kubeconfig file that will utilize this service account. simple as that, no cap. π
the kubeconfig file will reference the service account token and use the current server, namespace, and cluster contact info. and listen β if the service account has multiple tokens, the first token found will be returned. don't ask questions, first one wins, periodt. also the generated file gets output to STDOUT, which means if you don't redirect it somewhere it's just gonna spill all over your terminal. you've been warned. π
now the important part β service account API tokens are used by service accounts to authenticate to the API. and the way this works? client actions using a service account token will be executed as if the service account itself were making the actions. like, main character energy but it's the service account wearing the costume. iykyk. π
π OPTIONS π
--with-namespace=""β namespace for this context in.kubeconfig. just sets the namespace for that one context, that's it. π¦
π§ OPTIONS INHERITED FROM PARENT COMMANDS π§
these are the hand-me-downs from oc serviceaccounts, and yes you get all of them. slay.
--as=""β username to impersonate for the operation. user could be a regular user or a service account in a namespace. be someone else for a minute, iconic. π--as-group=[]β group to impersonate for the operation, this flag can be repeated to specify multiple groups. stack 'em up. π₯--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. yes that's the real default. no i don't know why either. π--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. like, dangerously insecure. don't just leave this on, bestie, i'm begging. π--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 exportingKUBECTL_KUBERC=falsefeature gate or 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. the zero is doing a lot of heavy lifting there fr fr. β³-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.--warnings-as-errors=falseβ treat warnings received from the server as errors and exit with a non-zero exit code. spicy. πΆοΈ
π₯ EXAMPLE π₯
okay here's the moment you've been waiting for, the actual usage:
# Create a kubeconfig file for service account 'default'
oc serviceaccounts create-kubeconfig 'default' > default.kubeconfig
see that >? that's you catching STDOUT and putting it in a file like a responsible icon. π
π SEE ALSO π
go read the parent one, it's giving lore. π
β HISTORY β
June 2016, ported from the Kubernetes man-doc generator. a vintage. an elder. we respect her. π
lowkey reminder bestie: --insecure-skip-tls-verify is not a fun little toggle, it literally stops checking if the server's certificate is valid and makes your HTTPS connections insecure. keep that in mind. π
and that's the whole page, you're so welcome π«Ά β brought to you by Openshift, straight out of the Openshift CLI User Manuals, dated June 2016. mwah. π β¨πΈ
π¦ 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