Difference between revisions of "Openshift"
From John Freier
(Created page with "RedHat OpenShift This will process a Kubernetes template with a param file. oc process -f templates/template.yaml --param-file=parameters/dev.yaml --ignore-unknown-paramete...") |
|||
(6 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
RedHat OpenShift | RedHat OpenShift | ||
+ | |||
+ | |||
+ | |||
+ | == OpenShift CLI - OC == | ||
+ | |||
+ | Switch Projects. | ||
+ | oc project ${project_name} | ||
This will process a Kubernetes template with a param file. | This will process a Kubernetes template with a param file. | ||
oc process -f templates/template.yaml --param-file=parameters/dev.yaml --ignore-unknown-parameters=true | oc apply -f- | oc process -f templates/template.yaml --param-file=parameters/dev.yaml --ignore-unknown-parameters=true | oc apply -f- | ||
+ | |||
+ | |||
+ | After applying a deployment you need to restart the OpenShift containers. | ||
+ | oc rollout resume deployment/${deployment_name} | ||
+ | |||
+ | |||
+ | Scale deployment to 0 | ||
+ | oc get deployment -o name # Get the deployment names | ||
+ | oc scale --replicas=0 [deployment_name] | ||
+ | |||
+ | Example: | ||
+ | oc scale --replicas=0 deployment.apps/test-deployment | ||
+ | |||
+ | |||
+ | Get all events | ||
+ | oc get events | ||
+ | |||
+ | Get all pods | ||
+ | oc get pods | ||
+ | |||
+ | Connect to pod - terminal | ||
+ | oc rsh {pod} | ||
+ | |||
+ | Open a tunnel to a pod | ||
+ | oc port-forward $POD_NAME 5432 > port-forward.log & |
Latest revision as of 10:26, 19 January 2023
RedHat OpenShift
OpenShift CLI - OC
Switch Projects.
oc project ${project_name}
This will process a Kubernetes template with a param file.
oc process -f templates/template.yaml --param-file=parameters/dev.yaml --ignore-unknown-parameters=true | oc apply -f-
After applying a deployment you need to restart the OpenShift containers.
oc rollout resume deployment/${deployment_name}
Scale deployment to 0
oc get deployment -o name # Get the deployment names oc scale --replicas=0 [deployment_name] Example: oc scale --replicas=0 deployment.apps/test-deployment
Get all events
oc get events
Get all pods
oc get pods
Connect to pod - terminal
oc rsh {pod}
Open a tunnel to a pod
oc port-forward $POD_NAME 5432 > port-forward.log &