Skip to content
This repository has been archived by the owner on Mar 30, 2022. It is now read-only.

Useful OpenShift Commands

robbaronbu edited this page May 24, 2017 · 14 revisions

UP https://github.com/CCI-MOC/moc-public/wiki/OpenShift

  1. restarts the master service:

    systemctl restart atomic-openshift-master
    
  2. log in:

    oc login -u <username>:<password>
    
  3. list the projects:

    oc projects   
    
  4. create a project:

    oadm new-project <project name> --description="<project description>"
    
  5. gets current project:

    oc project
    
  6. sets current project:

    oc project <project name>
    
  7. lists pods in current project:

    oc get pods
    
  8. describe a pod:

    oc describe pod <a pod name from command 5>
    
  9. cat log from a pod:

    oc logs <a pod name from command 5>
    
  10. list nodes:

    oc get nodes
    
  11. delete a node:

    oc delete <node name>
    
  12. Move the project over to a different region - also can be used to determine the region a project is currently running in.

    1. oc edit dc/[project name]

    a) either add or edit

    spec: template: spec: nodeSelector: region: [region name]

    1. redeploy the project:

      oc -n default rollout latest docker-registry

    So far the only time we have had to do this is to move the docker-registry from the default region to the infra region.


Notes:

  1. On project creation:

    a) oadm new-project uses the default template

    b) oc new-project and "Create New Project" (from the GUI) will allow the specification of one project template

    c) Cluster admins can use: oc process ... | oc create -f ... (This is still a bit of a research project - haven't used this yet).

see: <https://github.com/openshift/origin/issues/4381>
Clone this wiki locally