Use automatic OpenShift token injection

Use the OpenShift user token that is automatically injected into workspace containers to run oc and kubectl commands against the OpenShift cluster without explicit login.

Before you begin

  • You have a running instance of Red Hat OpenShift Dev Spaces.

About this task

Warning

Automatic token injection works only on the OpenShift infrastructure.

Procedure

  1. Open the OpenShift Dev Spaces dashboard and start a workspace.
  2. After the workspace starts, open a terminal in the workspace container.
  3. Run oc or kubectl commands to deploy applications, inspect and manage cluster resources, or view logs. The injected OpenShift user token authenticates these commands automatically.
    $ oc get pods

    Token Injection in IDE