-
Login to OpenShift
oc login <server_url> --token=<your_token>
-
Get Cluster Information
oc status
-
Get Projects
oc projects
-
Switch to a Project
oc project <project_name>
-
List All Pods
oc get pods
-
Describe a Pod
oc describe pod <pod_name>
-
Get Pod Logs
oc logs <pod_name>
-
Execute a Command Inside a Pod
oc exec <pod_name> -- <command>
-
List All Deployments
oc get deployments
-
View Deployment Details
oc describe deployment <deployment_name>
-
List All DeploymentConfigs
oc get deploymentconfigs
-
View DeploymentConfig Details
oc describe deploymentconfig <deployment_config_name>
-
Trigger a New Deployment Rollout (Kubernetes Deployment)
- Restarts a Kubernetes Deployment to trigger a new rollout.
oc rollout restart deployment/<deployment_name>
-
Trigger a New Deployment Rollout (OpenShift DeploymentConfig)
- For triggering a new rollout using an OpenShift DeploymentConfig.
oc rollout latest <deployment_config_name>
-
Scale Down and Up to Rollout (Kubernetes Deployment)
- Another method to trigger a new rollout by scaling down and then back up.
oc scale deployment <deployment_name> --replicas=0 oc scale deployment <deployment_name> --replicas=1
-
List Services
oc get svc
-
Describe a Service
oc describe svc <service_name>
-
List Routes
oc get routes
-
Describe a Route
oc describe route <route_name>
-
List Builds
oc get builds
-
Start a New Build
oc start-build <build_name>
-
List Image Streams
oc get is
-
Describe an Image Stream
oc describe is <image_stream_name>
-
Scale a Deployment
oc scale --replicas=<number_of_replicas> deployment/<deployment_name>
-
Scale a DeploymentConfig
oc scale --replicas=<number_of_replicas> deploymentconfig/<deployment_config_name>
- Delete an Application
oc delete all -l app=<application_name>
- Expose a Service as a Route
oc expose svc/<service_name>