Skip to content

Latest commit

 

History

History
170 lines (120 loc) · 3.45 KB

cli-developer-application-management.adoc

File metadata and controls

170 lines (120 loc) · 3.45 KB

Application management CLI commands

annotate

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

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

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

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

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

describe

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

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

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

get

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

label

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

scale

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

secrets

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

serviceaccounts

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

set

Configure existing application resources.

Example: Sets the name of a secret on a BuildConfig
$ oc set build-secret --source buildconfig/mybc mysecret