How to create kubeconfig for a certain serviceaccount in OpenShift 4.11?

Solution Verified - Updated -

Issue

  • I need kubeconfig for a particular serviceaccount
  • Unable to create kubeconfig with the oc sa create-kubeconfig command because of the following error:
Command "create-kubeconfig" is deprecated, and will be removed in the future version. Use oc create token instead.
error: could not find a service account token for service account "some-serviceaccout"

Environment

  • Red Hat Openshift Container Platform 4.11 and later

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content