1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 21:46:22 +01:00
Files
openshift-docs/modules/cli-developer-application-management.adoc
2020-11-20 03:12:49 +00:00

192 lines
3.8 KiB
Plaintext

// Module included in the following assemblies:
//
// * cli_reference/openshift_cli/developer-cli-commands.adoc
[id="cli-application-management-commands_{context}"]
= Application management CLI commands
== annotate
Update the annotations on one or more resources.
.Example: Add an annotation to a route
[source,terminal]
----
$ oc annotate route/test-route haproxy.router.openshift.io/ip_whitelist="192.168.1.10"
----
.Example: Remove the annotation from the route
[source,terminal]
----
$ 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
[source,terminal]
----
$ oc apply -f pod.json
----
== autoscale
Autoscale a deployment or replication controller.
.Example: Autoscale to a minimum of two and maximum of five pods
[source,terminal]
----
$ 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`
[source,terminal]
----
$ oc create -f pod.json
----
== delete
Delete a resource.
.Example: Delete a pod named `parksmap-katacoda-1-qfqz4`
[source,terminal]
----
$ oc delete pod/parksmap-katacoda-1-qfqz4
----
.Example: Delete all pods with the `app=parksmap-katacoda` label
[source,terminal]
----
$ oc delete pods -l app=parksmap-katacoda
----
== describe
Return detailed information about a specific object.
.Example: Describe a deployment named `example`
[source,terminal]
----
$ oc describe deployment/example
----
.Example: Describe all pods
[source,terminal]
----
$ oc describe pods
----
== edit
Edit a resource.
.Example: Edit a deployment using the default editor
[source,terminal]
----
$ oc edit deploymentconfig/parksmap-katacoda
----
.Example: Edit a deployment using a different editor
[source,terminal]
----
$ OC_EDITOR="nano" oc edit deploymentconfig/parksmap-katacoda
----
.Example: Edit a deployment in JSON format
[source,terminal]
----
$ oc edit deploymentconfig/parksmap-katacoda -o json
----
== expose
Expose a service externally as a route.
.Example: Expose a service
[source,terminal]
----
$ oc expose service/parksmap-katacoda
----
.Example: Expose a service and specify the host name
[source,terminal]
----
$ oc expose service/parksmap-katacoda --hostname=www.my-host.com
----
== get
Display one or more resources.
.Example: List pods in the `default` namespace
[source,terminal]
----
$ oc get pods -n default
----
.Example: Get details about the `python` deployment in JSON format
[source,terminal]
----
$ 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`
[source,terminal]
----
$ oc label pod/python-1-mz2rf status=unhealthy
----
== scale
Set the desired number of replicas for a replication controller or a
deployment.
.Example: Scale the `ruby-app` deployment to three pods
[source,terminal]
----
$ 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
[source,terminal]
----
$ 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
[source,terminal]
----
$ oc serviceaccounts get-token default
----
== set
Configure existing application resources.
.Example: Set the name of a secret on a build config
[source,terminal]
----
$ oc set build-secret --source buildconfig/mybc mysecret
----