Update the annotations on one or more resources.
Example: Add an annotation to a Route
$ oc annotate route/test-route haproxy.router.openshift.io/ip_whitelist="192.168.1.10"
Example: Remove the annotation from the Route
$ oc annotate route/test-route haproxy.router.openshift.io/ip_whitelist-
Apply a configuration to a resource by file name or standard in (stdin) in JSON or YAML format.
Example: Apply the configuration in
pod.json
to a Pod$ oc apply -f pod.json
Autoscale a DeploymentConfig or ReplicationController.
Example: Autoscale to a minimum of two and maximum of five Pods
$ oc autoscale deploymentconfig/parksmap-katacoda --min=2 --max=5
Create a resource by file name or standard in (stdin) in JSON or YAML format.
Example: Create a Pod using the content in
pod.json
$ oc create -f pod.json
Delete a resource.
Example: Delete a Pod named
parksmap-katacoda-1-qfqz4
$ oc delete pod/parksmap-katacoda-1-qfqz4
Example: Delete all Pods with the
app=parksmap-katacoda
label$ oc delete pods -l app=parksmap-katacoda
Return detailed information about a specific object.
Example: Describe a Deployment named
example
$ oc describe deployment/example
Example: Describe all Pods
$ oc describe pods
Edit a resource.
Example: Edit a DeploymentConfig using the default editor
$ oc edit deploymentconfig/parksmap-katacoda
Example: Edit a DeploymentConfig using a different editor
$ OC_EDITOR="nano" oc edit deploymentconfig/parksmap-katacoda
Example: Edit a DeploymentConfig in JSON format
$ oc edit deploymentconfig/parksmap-katacoda -o json
Expose a Service externally as a Route.
Example: Expose a Service
$ oc expose service/parksmap-katacoda
Example: Expose a Service and specify the host name
$ oc expose service/parksmap-katacoda --hostname=www.my-host.com
Display one or more resources.
Example: List Pods in the
default
namespace$ oc get pods -n default
Example: Get details about the
python
DeploymentConfig in JSON format$ oc get deploymentconfig/python -o json
Update the labels on one or more resources.
Example: Update the
python-1-mz2rf
Pod with the label status
set to unhealthy
$ oc label pod/python-1-mz2rf status=unhealthy
Set the desired number of replicas for a ReplicationController or a DeploymentConfig.
Example: Scale the
ruby-app
DeploymentConfig to three Pods$ oc scale deploymentconfig/ruby-app --replicas=3
Manage secrets in your project.
Example: Allow
my-pull-secret
to be used as an image pull secret by the default
service account$ oc secrets link default my-pull-secret --for=pull
Get a token assigned to a service account or create a new token or kubeconfig
file for a service account.
Example: Get the token assigned to the
default
service account$ oc serviceaccounts get-token default