Useful OpenShift Commands

  1. Log in:

    • Visit the web console

    • Select “Copy login command” from the account menu in the upper right

    • Paste the generated oc login command in to your terminal

      oc login --token=... --server=https://...
  2. List the projects:

    oc projects
  3. Create a project:

    oc new-project <project name> --description="<project description>"
  4. Get current project:

    oc project
  5. Set current project:

    oc project <project name>
  6. List pods in current project:

    oc get pods
  7. describe a pod:

    oc describe pod <pod name>
  8. Show log from a pod:

    oc logs <pod name>
  9. Start a shell in a pod:

    oc exec -it <pod name> -- bash