oc get nodes
oc get nodes --show-labels
oc label nodes <nodes name> <key=value>
oc label nodes --all <key=value>
oc label nodes <node name> <key=value> --overwrite
oc label nodes <node name> <key>-
oc describe node <node name>
The parameter -n <project name> is optional in all commands below although it is recommended in order to avoid any problem or confusion between projects when using Openshift CLI
oc get po -n <project name>
oc get po -o wide
oc get po -w
or watch oc get po
oc get po --all-namespace
oc get po --all-namespace -o wide
oc logs <pods name>
oc logs -f <pods name>
oc logs <pods name> -c <containers name>
oc logs <pods name> --since=30s
oc logs <pods name> --tail=60
oc scale dc <dc name> --replicas=5
oc scale rc <rc name> --replicas=5
oc rsh <pod name>
oc rsync <local dir> <pod name>:<remote dir>
oc get projects
oc edit namespace <projects name>
oc delete project <projects name>
oc new-project <projects name> --display-name="<projects display name> --description=<projects description>"
The params display-name and description are optionals
oc adm new-project --admin=<admins name>
oc adm new-project --node-selector=<node selector>
oc adm create-bootstrap-project-template -o yaml > my-template.yaml
Edit it as you want
vi my-template.yaml
Import to the cluster
oc create -f my-template.yaml -n default
Edit master-config.yaml
...
projectRequestTemplate: "default/project-request"
oc adm policy add-role-to-user admin <user> -n <project>
oc label project <projects name> key=value
oc adm add-scc-to-user anyuid -z default -n <project>
oc get users
oc adm policy add-cluster-role-to-user cluster-admin <user>
oc adm policy add-cluster-role-to-user self-provisioner <user>
oc adm policy remove-cluster-role-from-user self-provisioner <user>
oc adm policy remove-cluster-role-from-user self-provisioner system:authenticated
oc adm policy remove-cluster-role-from-user self-provisioner system:authenticated:oauth
oc delete user <user>
oc delete identity <identity:user>
oc create serviceaccount <service account name
oc get sa
oc delete sa <service account>
oc edit sa <service account>
oc serviceaccounts get-token <service account>
oc adm police add-role-to-user <role> -z <service account> -n <project>
oc adm prune images --confirm
oc adm prune builds --confirm
oc adm prune deploments --confirm
oc adm top images
docker rm $(docker ps -a -q)