diff --git a/using_openshift/cli.adoc b/using_openshift/cli.adoc index b9f1143790c4..e30d39b05456 100644 --- a/using_openshift/cli.adoc +++ b/using_openshift/cli.adoc @@ -11,60 +11,83 @@ toc::[] == Overview -The OpenShift CLI enables you to create and manage OpenShift projects from a terminal. This is useful for situations where: +With the OpenShift command line interface (CLI), you can create and manage OpenShift projects from a terminal. The CLI is ideal in situations where you are: -* You are working directly with project source code -* You are scripting OpenShift operations -* You are bandwidth-constrained and can't use the web console +* Working directly with project source code +* Scripting OpenShift operations +* Restricted by bandwidth resources and cannot use the web console -The CLI commands are available directly from the OpenShift binary by running `openshift cli `, but if `osc` is available on your system, you can treat it as a shortcut to the same commands available through `openshift cli` (`osc `). +The CLI commands are available directly from the OpenShift binary with the following syntax: -NOTE: Throughout this document we will reference `osc`, but you can run the same commands with `openshift cli`. +---- +openshift cli +---- + +However, if `osc` is available on your workstation you can use it as a shortcut in place of `openshift cli` in the command syntax: + +---- +osc +---- + +NOTE: Although `osc` is used in the command examples presented throughout this document, you can substitute `openshift cli` in the command syntax if `osc` is not available on your workstation. == Configuring the CLI -Running `osc --help` reveals a large number of configuration options. These are well-documented, but some of the main ones you may need are: +There are many configuration options available for the OpenShift CLI, and you can access these with the `osc --help` command. The following table describes some of the more common options. -*-s, --server* + -This enables you to specify the hostname of the OpenShift server. You will need to provide this if the server is running on a different host from the CLI. +.Common CLI Configuration Options +[cols="4,8",options="header"] +|=== -*--insecure-skip-tls-verify=true* + -This is the quick and dirty way to interact with a server that is using HTTPS. Note, however, that it is not secure. +|Option |Description -*--auth-path* + -*--certificate-authority* + -*--client-certificate* + -*--client-key* + -These settings are the _proper_ way to authenticate an OpenShift server that uses HTTPS. Connections set up this way will be secure. +.^|`-s, --server` +|This option allows you to specify the host name of the OpenShift server. You will need to provide this if the server is running on a different host from the CLI. + +.^|`--insecure-skip-tls-verify=true` +|This option allows quick interaction with an HTTPS server; however, note that it is not secure. + +a|`--auth-path` + +`--certificate-authority` + +`--client-certificate` + +`--client-key` +.^|These settings are used to correctly and securely authenticate with an OpenShift server that uses HTTPS. +|=== [TIP] ==== -*Can I just set these in a configuration file?* + -The ability to permanently set `osc` configuration details in a config file is forthcoming. For now you will need to pass these on the command line, or create a shell alias that sets the values that you need. +*Can I use a configuration file?* + +The ability to permanently configure `osc` options with a configuration file is planned for a future release and is not available at this time. The current workaround is to use the CLI, or you can create a shell alias to configure the required parameters. ==== -== Object Types in the CLI -The supported OpenShift object types are: +== CLI Object Types +OpenShift supports the following object types, some of which have abbreviated syntax that you can use with `osc`. + +.Supported Object Types +[options="header"] +|=== -* build -* buildConfig -* event -* minion -* pod -* replicationController -* service +|Object Type |Abbreviated Version -Some of these objects also have shorthand equivalent codes for use with `osc`: +|build | +|buildconfig | +|event |`ev` +|minion |`mi` +|pod |`po` +|replicationController |`rc` +|service |`se` +|=== -* `po` - pods -* `rc` - replication controllers -* `se` - services -* `mi` - minions -* `ev` - events +== Common CLI Operations +The CLI allows interaction with the various objects that are managed by OpenShift. The common `osc` operations are invoked by specifying the following: -== Common Operations -At its heart, the `osc` utility is just a mechanism for interacting with the various objects that OpenShift manages. The common `osc` commands are invoked by specifying an _action_, the _object type_ to perform the action on, and optionally a specific _object name or ID_ of the indicated object type. +* An _action_ +* The _object type_ to perform the action on +* The _object name_ or _ID_ of the specified _object type_ -For instance, running `osc get se` returns the complete list of currently defined services: +In the following example the `osc get` operation returns a complete list of services that are currently defined. ---- $ osc get se @@ -74,7 +97,7 @@ kubernetes-ro component=apiserver,provider=kubernetes docker-registry name=registrypod 172.30.17.158 5001 ---- -And running `osc get se kubernetes-ro` returns the same list filtered down to an individual object: +The following example operation returns the same list that is filtered down to an individual object: ---- $ osc get se kubernetes-ro @@ -82,56 +105,88 @@ NAME LABELS SELECTOR kubernetes-ro component=apiserver,provider=kubernetes 172.30.17.77 80 ---- -=== Get -*`osc get __`* + -This command returns a list of objects of the indicated link:#object-types[object type]. If an object name or ID is optionally included in the request, the list of results will be filtered by that value. +The following table describes the common `osc` operations and provides the general syntax for them. -=== Describe -*`osc describe `* + -This command returns information about the specific object returned by the query; a specific object name or ID must be provided. The exact information available varies per link:#object-types[object type]. +.Common CLI Operations +[cols=".^2,.^5,8",options="header"] +|=== -=== Create / Create All -*`osc create -f `* + -*`osc createall _-d _ _-f _`* + -These commands perform the same central function, which is to parse a configuration file and create one or more OpenShift objects based on the file contents. In the `createall` case, you can specify a directory (`-d`) with multiple configuration files, a file (`-f`) that contains multiple configurations, or even pass configurations through STDIN. +|Operation |Syntax |Description -=== Update -*`osc update -f `* + -This command attempts to modify an existing object based on the contents of the specified configuration file. If the object does not already exist, this function behaves exactly like link:#create-create-all[`osc create`]. +|`get` +|`osc get __ __` +|This command returns a list of objects of the indicated link:#object-types[object type]. If the optional _object name_ or _ID_ is included in the request, the list of results will be filtered by that value. -=== Delete -*`osc delete -f `* + -*`osc delete `* + -*`osc delete -l