back Home or Openshift or Kubectl Command

And Openshift Ansible

OC Command

Login/User management

oc login authenticate to an openshift cluster
oc logout end the current session
oc whoami show the current user context

Project management

oc project show the current project context
oc get projects show all project current login has access to
oc status show overview of current project resources
oc new-project create a new project in Openshift and change to that context

Resource management

oc new-app create a new application from from source code, container image, or OpenShift template
oc new-build create a new build configuration from source code
oc label add/update/remove labels from an Openshift resource
oc annotate add/update/remove annotations from an Openshift resource
oc create create a new resource from filename or stdin
oc get retrieve a resource (use -o for additional output options)
oc replace replace an existing resource from filename or stdin
oc delete delete a resource
oc edit modify a resource from text editor
oc describe retrieve a resource with details

Cluster management

oc adm administrative functions for an openshift cluster
oc adm router \registry install a router or registry
oc adm policy manage role/scc to user/group bindings, as well as additionalpolicy administration
oc adm diagnostics run tests/validation against a cluster
oc adm cordon/uncordon/drain unschedule/schedule/drain a node
oc adm groups manage groups
oc adm top show usage statistics of resources

Additional resource management

oc patch Update fields for a resource with JSON or YAML segments
oc extract get configmaps or secrets and save to disk
oc set Modify miscellaneous application resources
oc set probe Add a readiness/liveness probe on pod template/deployment configuration
oc set volumes Manage volume types on a pod template/deployment configuration
oc set build-hook Set a script/command to execute as part of the build process
oc set build-secret set a secret to be included as part of the build process
oc set env set environment variables on a pod template/deployment configuration/build configuration
oc set image update the image for deployment configurations/daemonsets
oc set triggers set triggers for deployment configurations/build configurations

Operational commands

oc logs retrieve the logs for a resource (build configurations, deployment configurations, and pods)
oc rsh remote shell into a container
oc rsync copy files to or from a container
oc exec execute a command in a container
oc run create a deployment configuration from image
oc idle scale resources to zero replicas

Build / Deploy

oc rollout manage deployments from deployment configuration
oc rollout latest start a new deployment with the latest state
oc rollout undo perform a rollback operation
oc rollout history oc rollout history - View historical information for a deployment configuration
oc rollout status watch the status of a rollout until complete
oc tag tag existing images into image streams
oc start-build start a new build from a build configuration
oc cancel-build cancel a build in progress
oc import-image pull in images and tags from an external Docker registry
oc scale change the number of pod replicas for a deployment

Example - end to end create an app

oc_command.txt · Last modified: 2019/11/25 00:53 by root
RSS - 200 © CrosswireDigitialMedia Ltd