in container

OpenShift Command oc Cheat Sheat

The content is based on OpenShift 3.9

  • 登入 OpenShift CLI
    • oc login <server>
    • oc login --username <username>
    • oc login --username <username> --password <password>
    • oc login --token <token>

  • 新增 user 為具有 admin 權限
    • oc adm policy add-role-to-user admin <username> -n <project>
  • 列出所有專案內的細節
    • oc get all -owide
  • rc/dc scale-out 名字為 ‘foo’ 增至 3
    • oc scale --replicas=3 replicationcontrollers foo
    • oc scale --replicas=3 dc foo
  • 持續監控 events
    • oc get event -w
  • 重新 Trigger dc/rc
    • oc rollout latest dc/<name>
  • 顯示 resource 的詳細描述
    • oc describe <resource>/<name>
  • 使用 privileged 等級執行權限
    • oc adm policy add-scc-to-user privileged -z default -n <project>

Reference