Command "oc serviceaccounts get-token" is deprecated

Solution Unverified - Updated -

Issue

  • Not able to get the token for a service account with get-token.
$ oc serviceaccounts get-token prometheus-k8s -n openshift-monitoring

Command "get-token" 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 "prometheus-k8s"

Environment

  • Openshift 4.11+

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