OpenShift

OpenShift

What is OpenShift?

Red Hat OpenShift is an enterprise-ready Kubernetes container platform with full-stack automated operations to manage hybrid cloud, multicloud, and edge deployments. Red Hat OpenShift is optimized to improve developer productivity and promote innovation. [Ref]

 

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 additional policy 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