Useful OpenShift Commands¶
Log in:
oc login -u <username>:<password>
List the projects:
oc projects
Create a project:
oadm new-project <project name> --description="<project description>"
gets current project:
oc project
sets current project:
oc project <project name>
lists pods in current project:
oc get pods
describe a pod:
oc describe pod <a pod name from command 5>
cat log from a pod:
oc logs <a pod name from command 5>
list nodes:
oc get nodes
delete a node:
oc delete <node name>
Move the project over to a different region - also can be used to determine the region a project is currently running in.
oc edit dc/[project name]
Either add or edit
spec: template: spec: nodeSelector: region: [region name]
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¶
On project creation:
oadm new-project
uses the default templateoc new-project
and “Create New Project” (from the GUI) will allow the specification of one project template- Cluster admins can use:
oc process ... | oc create -f ...
(This is still a bit of a research project - haven’t used this yet).