<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://wiki.samerhijazi.net/index.php?action=history&amp;feed=atom&amp;title=IT-SDK-Openshift-cmd</id>
	<title>IT-SDK-Openshift-cmd - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.samerhijazi.net/index.php?action=history&amp;feed=atom&amp;title=IT-SDK-Openshift-cmd"/>
	<link rel="alternate" type="text/html" href="http://wiki.samerhijazi.net/index.php?title=IT-SDK-Openshift-cmd&amp;action=history"/>
	<updated>2026-04-05T17:56:46Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.32.0</generator>
	<entry>
		<id>http://wiki.samerhijazi.net/index.php?title=IT-SDK-Openshift-cmd&amp;diff=718&amp;oldid=prev</id>
		<title>Samerhijazi: Samerhijazi moved page IT-Studing-Openshift-cmd to IT-SDK-Openshift-cmd without leaving a redirect</title>
		<link rel="alternate" type="text/html" href="http://wiki.samerhijazi.net/index.php?title=IT-SDK-Openshift-cmd&amp;diff=718&amp;oldid=prev"/>
		<updated>2020-02-14T18:16:25Z</updated>

		<summary type="html">&lt;p&gt;Samerhijazi moved page &lt;a href=&quot;/index.php?title=IT-Studing-Openshift-cmd&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;IT-Studing-Openshift-cmd (page does not exist)&quot;&gt;IT-Studing-Openshift-cmd&lt;/a&gt; to &lt;a href=&quot;/index.php?title=IT-SDK-Openshift-cmd&quot; title=&quot;IT-SDK-Openshift-cmd&quot;&gt;IT-SDK-Openshift-cmd&lt;/a&gt; without leaving a redirect&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 18:16, 14 February 2020&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Samerhijazi</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samerhijazi.net/index.php?title=IT-SDK-Openshift-cmd&amp;diff=276&amp;oldid=prev</id>
		<title>Samerhijazi: Samerhijazi moved page IT-Openshift-cmd to IT-Studing-Openshift-cmd without leaving a redirect</title>
		<link rel="alternate" type="text/html" href="http://wiki.samerhijazi.net/index.php?title=IT-SDK-Openshift-cmd&amp;diff=276&amp;oldid=prev"/>
		<updated>2019-10-28T19:50:15Z</updated>

		<summary type="html">&lt;p&gt;Samerhijazi moved page &lt;a href=&quot;/index.php?title=IT-Openshift-cmd&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;IT-Openshift-cmd (page does not exist)&quot;&gt;IT-Openshift-cmd&lt;/a&gt; to &lt;a href=&quot;/index.php?title=IT-Studing-Openshift-cmd&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;IT-Studing-Openshift-cmd (page does not exist)&quot;&gt;IT-Studing-Openshift-cmd&lt;/a&gt; without leaving a redirect&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 19:50, 28 October 2019&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Samerhijazi</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samerhijazi.net/index.php?title=IT-SDK-Openshift-cmd&amp;diff=143&amp;oldid=prev</id>
		<title>Samerhijazi at 22:48, 14 June 2019</title>
		<link rel="alternate" type="text/html" href="http://wiki.samerhijazi.net/index.php?title=IT-SDK-Openshift-cmd&amp;diff=143&amp;oldid=prev"/>
		<updated>2019-06-14T22:48:35Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;a href=&quot;http://wiki.samerhijazi.net/index.php?title=IT-SDK-Openshift-cmd&amp;amp;diff=143&amp;amp;oldid=125&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>Samerhijazi</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.samerhijazi.net/index.php?title=IT-SDK-Openshift-cmd&amp;diff=125&amp;oldid=prev</id>
		<title>Fiducia: Created page with &quot;&lt;p&gt; Source: https://github.com/openshift/openshift-docs/blob/master/cli_reference/cli_by_example_content.adoc == An introduction to the concepts and types in OpenShift ==    /...&quot;</title>
		<link rel="alternate" type="text/html" href="http://wiki.samerhijazi.net/index.php?title=IT-SDK-Openshift-cmd&amp;diff=125&amp;oldid=prev"/>
		<updated>2019-06-12T07:14:56Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;p&amp;gt; Source: https://github.com/openshift/openshift-docs/blob/master/cli_reference/cli_by_example_content.adoc == An introduction to the concepts and types in OpenShift ==    /...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;p&amp;gt; Source: https://github.com/openshift/openshift-docs/blob/master/cli_reference/cli_by_example_content.adoc&lt;br /&gt;
== An introduction to the concepts and types in OpenShift ==&lt;br /&gt;
&lt;br /&gt;
  // View all projects you have access to&lt;br /&gt;
  $ oc projects&lt;br /&gt;
&lt;br /&gt;
  // See a list of all services in the current project&lt;br /&gt;
  $ oc get svc&lt;br /&gt;
&lt;br /&gt;
  // Describe a deployment configuration in detail&lt;br /&gt;
  $ oc describe dc mydeploymentconfig&lt;br /&gt;
&lt;br /&gt;
  // Show the images tagged into an image stream&lt;br /&gt;
  $ oc describe is ruby-centos7&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Log in to an OpenShift server ==&lt;br /&gt;
&lt;br /&gt;
  // Log in interactively&lt;br /&gt;
  $ oc login&lt;br /&gt;
&lt;br /&gt;
  // Log in to the given server with the given certificate authority file&lt;br /&gt;
  $ oc login localhost:8443 --certificate-authority=/path/to/cert.crt&lt;br /&gt;
&lt;br /&gt;
  // Log in to the given server with the given credentials (will not prompt interactively)&lt;br /&gt;
  $ oc login localhost:8443 --username=myuser --password=mypass&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Request a new project ==&lt;br /&gt;
&lt;br /&gt;
  // Create a new project with minimal information&lt;br /&gt;
  $ oc new-project web-team-dev&lt;br /&gt;
&lt;br /&gt;
  // Create a new project with a display name and description&lt;br /&gt;
  $ oc new-project web-team-dev --display-name=&amp;quot;Web Team Development&amp;quot; --description=&amp;quot;Development project for the web team.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Create a new application ==&lt;br /&gt;
&lt;br /&gt;
  // Create an application based on the source code in the current git repository (with a public remote) and a container image&lt;br /&gt;
  $ oc new-app . --docker-image=repo/langimage&lt;br /&gt;
&lt;br /&gt;
  // Create a Ruby application based on the provided [image]~[source code] combination&lt;br /&gt;
  $ oc new-app openshift/ruby-20-centos7~https://github.com/openshift/ruby-hello-world.git&lt;br /&gt;
&lt;br /&gt;
  // Use the public Docker Hub MySQL image to create an app. Generated artifacts will be labeled with db=mysql&lt;br /&gt;
  $ oc new-app mysql -l db=mysql&lt;br /&gt;
&lt;br /&gt;
  // Use a MySQL image in a private registry to create an app and override application artifacts' names&lt;br /&gt;
  $ oc new-app --docker-image=myregistry.com/mycompany/mysql --name=private&lt;br /&gt;
&lt;br /&gt;
  // Create an application from a remote repository using its beta4 branch&lt;br /&gt;
  $ oc new-app https://github.com/openshift/ruby-hello-world#beta4&lt;br /&gt;
&lt;br /&gt;
  // Create an application based on a stored template, explicitly setting a parameter value&lt;br /&gt;
  $ oc new-app --template=ruby-helloworld-sample --param=MYSQL_USER=admin&lt;br /&gt;
&lt;br /&gt;
  // Create an application from a remote repository and specify a context directory&lt;br /&gt;
  $ oc new-app https://github.com/youruser/yourgitrepo --context-dir=src/build&lt;br /&gt;
&lt;br /&gt;
  // Create an application based on a template file, explicitly setting a parameter value&lt;br /&gt;
  $ oc new-app --file=./example/myapp/template.json --param=MYSQL_USER=admin&lt;br /&gt;
&lt;br /&gt;
== Show an overview of the current project==&lt;br /&gt;
  // Show an overview of the current project&lt;br /&gt;
  $ oc status&lt;br /&gt;
&lt;br /&gt;
== Switch to another project ==&lt;br /&gt;
  // Switch to 'myapp' project&lt;br /&gt;
  $ oc project myapp&lt;br /&gt;
&lt;br /&gt;
  // Display the project currently in use&lt;br /&gt;
  $ oc project&lt;br /&gt;
&lt;br /&gt;
== Starts a new build ==&lt;br /&gt;
  // Starts build from build config matching the name &amp;quot;golang&amp;quot;&lt;br /&gt;
  $ oc start-build golang&lt;br /&gt;
&lt;br /&gt;
  // Starts build from build matching the name &amp;quot;golang-1&amp;quot;&lt;br /&gt;
  $ oc start-build --from-build=golang-1&lt;br /&gt;
&lt;br /&gt;
  // Starts build from build config matching the name &amp;quot;golang&amp;quot; and watches the logs until the build&lt;br /&gt;
  // completes or fails&lt;br /&gt;
  $ oc start-build golang --follow&lt;br /&gt;
&lt;br /&gt;
== Show container logs from the build container ==&lt;br /&gt;
  // Stream logs from the latest build for build config &amp;quot;golang&amp;quot; to stdout&lt;br /&gt;
  $ oc logs -f bc/golang&lt;br /&gt;
  // Stream logs from the first build for build config &amp;quot;golang&amp;quot; to stdout&lt;br /&gt;
  $ oc logs -f --version=1 bc/golang&lt;br /&gt;
  // Stream logs from build &amp;quot;golang-1&amp;quot; to stdout&lt;br /&gt;
  $ oc logs -f build/golang-1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== View, start, cancel, or retry rollouts==&lt;br /&gt;
  // Display information for the 'database' DeploymentConfig&lt;br /&gt;
  $ oc describe dc/database&lt;br /&gt;
&lt;br /&gt;
  // Start a new deployment based on the 'database' DeploymentConfig&lt;br /&gt;
  $ oc rollout latest dc/database&lt;br /&gt;
&lt;br /&gt;
  // View the status of the latest rollout&lt;br /&gt;
  $ oc rollout status dc/database&lt;br /&gt;
&lt;br /&gt;
  // View the history of the 'database' DeploymentConfig&lt;br /&gt;
  $ oc rollout history dc/database&lt;br /&gt;
&lt;br /&gt;
== Show logs from the deployment process==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  // Stream logs from the latest deployment for deployment config &amp;quot;frontend&amp;quot; to stdout&lt;br /&gt;
  // Note that if the deployment process is successful, logs from the application will&lt;br /&gt;
  // be returned.&lt;br /&gt;
  $ oc logs -f dc/frontend&lt;br /&gt;
  // Return the logs from the first deployment for deployment config &amp;quot;database&amp;quot; to stdout&lt;br /&gt;
  // Note that if the deployment process was successful, logs from the application will&lt;br /&gt;
  // be returned.&lt;br /&gt;
  $ oc logs --version=1 dc/database&lt;br /&gt;
&lt;br /&gt;
== Revert part of an application back to a previous deployment==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  // Perform a rollback&lt;br /&gt;
  $ oc rollout undo dc/foo&lt;br /&gt;
&lt;br /&gt;
  // See what the rollback will look like, but don't perform the rollback&lt;br /&gt;
  $ oc rollout undo dc/foo --dry-run&lt;br /&gt;
&lt;br /&gt;
  // Perform a rollback to a specific revision&lt;br /&gt;
  $ oc rollout undo dc/foo --to-revision=2&lt;br /&gt;
&lt;br /&gt;
== Create a new build configuration==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  // Create a build config based on the source code in the current git repository (with a public remote) and a container image&lt;br /&gt;
  $ oc new-build . --docker-image=repo/langimage&lt;br /&gt;
&lt;br /&gt;
  // Create a NodeJS build config based on the provided [image]~[source code] combination&lt;br /&gt;
  $ oc new-build openshift/nodejs-010-centos7~https://bitbucket.com/user/nodejs-app&lt;br /&gt;
&lt;br /&gt;
  // Create a build config from a remote repository using its beta2 branch&lt;br /&gt;
  $ oc new-build https://github.com/openshift/ruby-hello-world#beta2&lt;br /&gt;
&lt;br /&gt;
== Cancel a pending or running build==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  // Cancel the build with the given name&lt;br /&gt;
  $ oc cancel-build 1da32cvq&lt;br /&gt;
&lt;br /&gt;
  // Cancel the named build and print the build logs&lt;br /&gt;
  $ oc cancel-build 1da32cvq --dump-logs&lt;br /&gt;
&lt;br /&gt;
  // Cancel the named build and create a new one with the same parameters&lt;br /&gt;
  $ oc cancel-build 1da32cvq --restart&lt;br /&gt;
&lt;br /&gt;
== Imports images from a container image registry==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  $ oc import-image mystream&lt;br /&gt;
&lt;br /&gt;
== Change the number of pods in a deployment==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  // Scale replication controller named 'foo' to 3.&lt;br /&gt;
  $ oc scale --replicas=3 replicationcontrollers foo&lt;br /&gt;
&lt;br /&gt;
  // If the replication controller named foo's current size is 2, scale foo to 3.&lt;br /&gt;
  $ oc scale --current-replicas=2 --replicas=3 replicationcontrollers foo&lt;br /&gt;
&lt;br /&gt;
== Tag existing images into image streams==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  // Tag the current image for the image stream 'openshift/ruby' and tag '2.0' into the image stream 'yourproject/ruby with tag 'tip'.&lt;br /&gt;
  $ oc tag openshift/ruby:2.0 yourproject/ruby:tip&lt;br /&gt;
&lt;br /&gt;
  // Tag a specific image.&lt;br /&gt;
  $ oc tag openshift/ruby@sha256:6b646fa6bf5e5e4c7fa41056c27910e679c03ebe7f93e361e6515a9da7e258cc yourproject/ruby:tip&lt;br /&gt;
&lt;br /&gt;
  // Tag an external container image.&lt;br /&gt;
  $ oc tag --source=docker openshift/origin:latest yourproject/ruby:tip&lt;br /&gt;
&lt;br /&gt;
  // Remove the specified spec tag from an image stream.&lt;br /&gt;
  $ openshift cli tag openshift/origin:latest -d&lt;br /&gt;
&lt;br /&gt;
== Display one or many resources==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  // List all pods in ps output format.&lt;br /&gt;
  $ oc get pods&lt;br /&gt;
&lt;br /&gt;
  // List a single replication controller with specified ID in ps output format.&lt;br /&gt;
  $ oc get replicationController 1234-56-7890-234234-456456&lt;br /&gt;
&lt;br /&gt;
  // List a single pod in JSON output format.&lt;br /&gt;
  $ oc get -o json pod 1234-56-7890-234234-456456&lt;br /&gt;
&lt;br /&gt;
  // Return only the status value of the specified pod.&lt;br /&gt;
  $ oc get -o template pod 1234-56-7890-234234-456456 --template={{.currentState.status}}&lt;br /&gt;
&lt;br /&gt;
== Show details of a specific resource==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  // Provide details about the ruby-20-centos7 image repository&lt;br /&gt;
  $ oc describe imageRepository ruby-20-centos7&lt;br /&gt;
&lt;br /&gt;
  // Provide details about the ruby-sample-build build configuration&lt;br /&gt;
  $ oc describe bc ruby-sample-build&lt;br /&gt;
&lt;br /&gt;
== Edit a resource on the server==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  // Edit the service named 'docker-registry':&lt;br /&gt;
  $ oc edit svc/docker-registry&lt;br /&gt;
&lt;br /&gt;
  // Edit the DeploymentConfig named 'my-deployment':&lt;br /&gt;
  $ oc edit dc/my-deployment&lt;br /&gt;
&lt;br /&gt;
  // Use an alternative editor&lt;br /&gt;
  $ OC_EDITOR=&amp;quot;nano&amp;quot; oc edit dc/my-deployment&lt;br /&gt;
&lt;br /&gt;
  // Edit the service 'docker-registry' in JSON using the v1beta3 API format:&lt;br /&gt;
  $ oc edit svc/docker-registry --output-version=v1beta3 -o json&lt;br /&gt;
&lt;br /&gt;
== Update the environment on a resource with a pod template==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  // Update deployment 'registry' with a new environment variable&lt;br /&gt;
  $ oc set env dc/registry STORAGE_DIR=/local&lt;br /&gt;
&lt;br /&gt;
  // List the environment variables defined on a deployment 'registry'&lt;br /&gt;
  $ oc set env dc/registry --list&lt;br /&gt;
&lt;br /&gt;
  // List the environment variables defined on all pods&lt;br /&gt;
  $ oc set env pods --all --list&lt;br /&gt;
&lt;br /&gt;
  // Output a YAML object with updated environment for deployment 'registry'&lt;br /&gt;
  // Does not alter the object on the server&lt;br /&gt;
  $ oc set env dc/registry STORAGE_DIR=/local -o yaml&lt;br /&gt;
&lt;br /&gt;
  // Update all replication controllers in the project to have ENV=prod&lt;br /&gt;
  $ oc set env replicationControllers --all ENV=prod&lt;br /&gt;
&lt;br /&gt;
  // Remove the environment variable ENV from all deployment configs&lt;br /&gt;
  $ oc set env deploymentConfigs --all ENV-&lt;br /&gt;
&lt;br /&gt;
  // Remove the environment variable ENV from a pod definition on disk and update the pod on the server&lt;br /&gt;
  $ oc set env -f pod.json ENV-&lt;br /&gt;
&lt;br /&gt;
  // Set some of the local shell environment into a deployment on the server&lt;br /&gt;
  $ env | grep RAILS_ | oc set env -e - dc/registry&lt;br /&gt;
&lt;br /&gt;
== Update volume on a resource with a pod template==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  // Add new volume of type 'emptyDir' for deployment config 'registry' and mount under /opt inside the containers&lt;br /&gt;
  // The volume name is auto generated&lt;br /&gt;
  $ oc set volume dc/registry --add --mount-path=/opt&lt;br /&gt;
&lt;br /&gt;
  // Add new volume 'v1' with secret 'magic' for pod 'p1'&lt;br /&gt;
  $ oc set volume pod/p1 --add --name=v1 -m /etc --type=secret --secret-name=magic&lt;br /&gt;
&lt;br /&gt;
  // Add new volume to pod 'p1' based on gitRepo (or other volume sources not supported by --type)&lt;br /&gt;
  $ oc set volume pod/p1 --add -m /repo --source=&amp;lt;json-string&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  // Add emptyDir volume 'v1' to a pod definition on disk and update the pod on the server&lt;br /&gt;
  $ oc set volume -f pod.json --add --name=v1&lt;br /&gt;
&lt;br /&gt;
  // Create a new persistent volume and overwrite existing volume 'v1' for replication controller 'r1'&lt;br /&gt;
  $ oc set volume rc/r1 --add --name=v1 -t persistentVolumeClaim --claim-name=pvc1 --overwrite&lt;br /&gt;
&lt;br /&gt;
  // Change pod 'p1' mount point to /data for volume v1&lt;br /&gt;
  $ oc set volume pod p1 --add --name=v1 -m /data --overwrite&lt;br /&gt;
&lt;br /&gt;
  // Remove all volumes for pod 'p1'&lt;br /&gt;
  $ oc set volume pod/p1 --remove --confirm&lt;br /&gt;
&lt;br /&gt;
  // Remove volume 'v1' from deployment config 'registry'&lt;br /&gt;
  $ oc set volume dc/registry --remove --name=v1&lt;br /&gt;
&lt;br /&gt;
  // Unmount volume v1 from container c1 on pod p1 and remove the volume v1 if it is not referenced by any containers on pod p1&lt;br /&gt;
  $ oc set volume pod/p1 --remove --name=v1 --containers=c1&lt;br /&gt;
&lt;br /&gt;
  // List volumes defined on replication controller 'r1'&lt;br /&gt;
  $ oc set volume rc r1 --list&lt;br /&gt;
&lt;br /&gt;
  // List volumes defined on all pods&lt;br /&gt;
  $ oc set volume pods --all --list&lt;br /&gt;
&lt;br /&gt;
  // Output json object with volume info for pod 'p1' but don't alter the object on server&lt;br /&gt;
  $ oc set volume pod/p1 --add --name=v1 --mount=/opt -o json&lt;br /&gt;
&lt;br /&gt;
== Update the labels on a resource==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  // Update pod 'foo' with the label 'unhealthy' and the value 'true'.&lt;br /&gt;
  $ oc label pods foo unhealthy=true&lt;br /&gt;
&lt;br /&gt;
  // Update pod 'foo' with the label 'status' and the value 'unhealthy', overwriting any existing value.&lt;br /&gt;
  $ oc label --overwrite pods foo status=unhealthy&lt;br /&gt;
&lt;br /&gt;
  // Update all pods in the namespace&lt;br /&gt;
  $ oc label pods --all status=unhealthy&lt;br /&gt;
&lt;br /&gt;
  // Update pod 'foo' only if the resource is unchanged from version 1.&lt;br /&gt;
  $ oc label pods foo status=unhealthy --resource-version=1&lt;br /&gt;
&lt;br /&gt;
  // Update pod 'foo' by removing a label named 'bar' if it exists.&lt;br /&gt;
  // Does not require the --overwrite flag.&lt;br /&gt;
  $ oc label pods foo bar-&lt;br /&gt;
&lt;br /&gt;
== Expose a replicated application as a service or route==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  // Create a route based on service ruby-hello-world. The new route will re-use the ruby-hello-world labels&lt;br /&gt;
  $ oc expose svc/ruby-hello-world&lt;br /&gt;
&lt;br /&gt;
  // Create a route and specify your own label and route name&lt;br /&gt;
  $ oc expose svc/ruby-hello-world -l name=myroute --name=fromdowntown&lt;br /&gt;
&lt;br /&gt;
ifdef::openshift-enterprise,openshift-origin,openshift-dedicated[]&lt;br /&gt;
  // Create a route and specify a hostname&lt;br /&gt;
  $ oc expose svc/ruby-hello-world --hostname=www.example.com&lt;br /&gt;
endif::[]&lt;br /&gt;
&lt;br /&gt;
  // Expose a deployment configuration as a service and use the specified port&lt;br /&gt;
  $ oc expose dc/ruby-hello-world --port=8080&lt;br /&gt;
&lt;br /&gt;
== Autoscale an application==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  // Auto scale a deployment config &amp;quot;foo&amp;quot;, with the number of pods between 2 to 10, target CPU utilization at a default value that server applies&lt;br /&gt;
  $ oc autoscale dc/foo --min=2 --max=10&lt;br /&gt;
&lt;br /&gt;
  // Auto scale a replication controller &amp;quot;foo&amp;quot;, with the number of pods between 1 to 5, target CPU utilization at 80%&lt;br /&gt;
  $ oc autoscale rc/foo --max=5 --cpu-percent=80&lt;br /&gt;
&lt;br /&gt;
ifdef::openshift-enterprise,openshift-origin,openshift-dedicated[]&lt;br /&gt;
== Securely expose containers via a route==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  // Create a secure edge-terminated route using the specified&lt;br /&gt;
  // certificates/keys and hostname.  If the certificates/keys&lt;br /&gt;
  // are not specified, those from the router will be re-used.&lt;br /&gt;
  $ oc create route edge --service=frontend \&lt;br /&gt;
      --cert=${MASTER_CONFIG_DIR}/ca.crt \&lt;br /&gt;
      --key=${MASTER_CONFIG_DIR}/ca.key \&lt;br /&gt;
      --ca-cert=${MASTER_CONFIG_DIR}/ca.crt \&lt;br /&gt;
      --hostname=www.example.com&lt;br /&gt;
&lt;br /&gt;
  // Create a secure passthrough route.&lt;br /&gt;
  $ oc create route passthrough --service=registry&lt;br /&gt;
&lt;br /&gt;
  // Create a secure reencrypt-terminated route in&lt;br /&gt;
  // a similar fashion to edge.  The only additional&lt;br /&gt;
  // requirement is to specify a destination CA certificate.&lt;br /&gt;
  $ oc create route reencrypt --service=backend --dest-ca-cert=ca.crt&lt;br /&gt;
endif::[]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ifdef::openshift-online[]&lt;br /&gt;
== Securely expose containers via a route==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  // Create a secure edge-terminated route.&lt;br /&gt;
  $ oc create route edge --service=frontend&lt;br /&gt;
&lt;br /&gt;
  // Create a secure passthrough route.&lt;br /&gt;
  oc create route passthrough --service=frontend&lt;br /&gt;
endif::[]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Delete a resource by filename, stdin, resource and ID, or by resources and label selector.==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  // Delete a pod using the type and ID specified in pod.json.&lt;br /&gt;
  $ oc delete -f pod.json&lt;br /&gt;
&lt;br /&gt;
  // Delete a pod based on the type and ID in the JSON passed into stdin.&lt;br /&gt;
  $ cat pod.json | oc delete -f -&lt;br /&gt;
&lt;br /&gt;
  // Delete pods and services with label name=myLabel.&lt;br /&gt;
  $ oc delete pods,services -l name=myLabel&lt;br /&gt;
&lt;br /&gt;
  // Delete a pod with ID 1234-56-7890-234234-456456.&lt;br /&gt;
  $ oc delete pod 1234-56-7890-234234-456456&lt;br /&gt;
&lt;br /&gt;
  // Delete all pods&lt;br /&gt;
  $ oc delete pods --all&lt;br /&gt;
&lt;br /&gt;
== Print the logs for a container in a pod.==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  // Returns snapshot of ruby-container logs from pod backend.&lt;br /&gt;
  $ oc logs backend -c ruby-container&lt;br /&gt;
&lt;br /&gt;
  // Starts streaming of ruby-container logs from pod backend.&lt;br /&gt;
  // Both NAME and TYPE/NAME syntax are supported for pods.&lt;br /&gt;
  $ oc logs -f pod/backend -c ruby-container&lt;br /&gt;
&lt;br /&gt;
== Execute a command in a container.==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  // Get output from running 'date' in ruby-container from pod 123456-7890&lt;br /&gt;
  $ oc exec -p 123456-7890 -c ruby-container date&lt;br /&gt;
&lt;br /&gt;
  // Switch to raw terminal mode, sends stdin to 'bash' in ruby-container from pod 123456-780 and sends stdout/stderr from 'bash' back to the client&lt;br /&gt;
  $ oc exec -p 123456-7890 -c ruby-container -i -t -- bash -il&lt;br /&gt;
&lt;br /&gt;
== Open a remote shell session to a container. It will default to the first container if none is specified.==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  // Open a shell session on the first container in pod 123456-7890&lt;br /&gt;
  $ oc rsh 123456-7890&lt;br /&gt;
&lt;br /&gt;
  // Run the command 'cat /etc/resolv.conf' inside pod 123456-7890&lt;br /&gt;
  $ oc rsh 123456-7890 cat /etc/resolv.conf&lt;br /&gt;
&lt;br /&gt;
== Forward one or more local ports to a pod.==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  // Listens on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in the pod&lt;br /&gt;
  $ oc port-forward -p mypod 5000 6000&lt;br /&gt;
&lt;br /&gt;
  // Listens on port 8888 locally, forwarding to 5000 in the pod&lt;br /&gt;
  $ oc port-forward -p mypod 8888:5000&lt;br /&gt;
&lt;br /&gt;
  // Listens on a random port locally, forwarding to 5000 in the pod&lt;br /&gt;
  $ oc port-forward -p mypod :5000&lt;br /&gt;
&lt;br /&gt;
  // Listens on a random port locally, forwarding to 5000 in the pod&lt;br /&gt;
  $ oc port-forward -p mypod 0:5000&lt;br /&gt;
&lt;br /&gt;
== Run a proxy to the Kubernetes API server==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  // Run a proxy to Kubernetes apiserver on port 8011, serving static content from ./local/www/&lt;br /&gt;
  $ oc proxy --port=8011 --www=./local/www/&lt;br /&gt;
&lt;br /&gt;
  // Run a proxy to Kubernetes apiserver, changing the api prefix to k8s-api&lt;br /&gt;
  // This makes e.g. the pods api available at localhost:8011/k8s-api/v1beta3/pods/&lt;br /&gt;
  $ oc proxy --api-prefix=k8s-api&lt;br /&gt;
&lt;br /&gt;
== Create a resource by filename or stdin==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  // Create a pod using the data in pod.json.&lt;br /&gt;
  $ oc create -f pod.json&lt;br /&gt;
&lt;br /&gt;
  // Create a pod based on the JSON passed into stdin.&lt;br /&gt;
  $ cat pod.json | oc create -f -&lt;br /&gt;
&lt;br /&gt;
== Update a resource by filename or stdin.==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  // Update a pod using the data in pod.json.&lt;br /&gt;
  $ oc replace -f pod.json&lt;br /&gt;
&lt;br /&gt;
  // Update a pod based on the JSON passed into stdin.&lt;br /&gt;
  $ cat pod.json | oc replace -f -&lt;br /&gt;
&lt;br /&gt;
== Process a template into list of resources==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  // Convert template.json file into resource list&lt;br /&gt;
  $ oc process -f template.json&lt;br /&gt;
&lt;br /&gt;
  // Process template while passing a user-defined label&lt;br /&gt;
  $ oc process -f template.json -l name=mytemplate&lt;br /&gt;
&lt;br /&gt;
  // Convert stored template into resource list&lt;br /&gt;
  $ oc process foo&lt;br /&gt;
&lt;br /&gt;
  // Convert template.json into resource list&lt;br /&gt;
  $ cat template.json | oc process -f -&lt;br /&gt;
&lt;br /&gt;
== Export resources so they can be used elsewhere==[NOTE]&lt;br /&gt;
`oc export` is deprecated. See link:https://docs.openshift.com/container-platform/3.11/release_notes/ocp_3_11_release_notes.html#ocp-311-notable-technical-changes[Notable Technical Changes] for more details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  // export the services and deployment configurations labeled name=test&lt;br /&gt;
  oc get -o yaml --export svc,dc -l name=test&lt;br /&gt;
&lt;br /&gt;
  // export to JSON&lt;br /&gt;
  oc get -o json --export service&lt;br /&gt;
&lt;br /&gt;
== Create a new secret based on a key file or on files within a directory==&lt;br /&gt;
[ons=&amp;quot;nowrap&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
  // Create a new secret named my-secret with a key named ssh-privatekey&lt;br /&gt;
  $ oc create secret generic my-secret --from-file=ssh-privatekey=&amp;lt;path/to/ssh/private/key&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  // Create a new secret named my-secret with keys named ssh-privatekey and ssh-publickey instead of the names of the keys on disk&lt;br /&gt;
  $ oc create secret generic my-secret --from-file=ssh-privatekey=&amp;lt;path/to/ssh/private/key&amp;gt; --from-file=ssh-publickey=&amp;lt;path/to/ssh/public/key&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  // Create a new secret named my-secret with keys for each file in the folder &amp;quot;bar&amp;quot;&lt;br /&gt;
  $ oc create secret generic my-secret --from-file=&amp;lt;path/to/bar&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== End the current server session==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  // Logout&lt;br /&gt;
  $ oc logout&lt;br /&gt;
&lt;br /&gt;
== Display merged kubeconfig settings or a specified kubeconfig file.==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  // Show Merged kubeconfig settings.&lt;br /&gt;
  $ oc config view&lt;br /&gt;
&lt;br /&gt;
  // Get the password for the e2e user&lt;br /&gt;
  $ oc config view -o template --template='{{range .users}}{{ if eq .name &amp;quot;e2e&amp;quot; }}{{ index .user.password }}{{end}}{{end}}'&lt;br /&gt;
&lt;br /&gt;
== Set a cluster entry in kubeconfig==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  // Set only the server field on the e2e cluster entry without touching other values.&lt;br /&gt;
  $ oc config set-cluster e2e --server=https://1.2.3.4&lt;br /&gt;
&lt;br /&gt;
  // Embed certificate authority data for the e2e cluster entry&lt;br /&gt;
  $ oc config set-cluster e2e --certificate-authority=~/.kube/e2e/kubernetes.ca.crt&lt;br /&gt;
&lt;br /&gt;
  // Disable cert checking for the dev cluster entry&lt;br /&gt;
  $ oc config set-cluster e2e --insecure-skip-tls-verify=true&lt;br /&gt;
&lt;br /&gt;
== Set a user entry in kubeconfig==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  // Set only the &amp;quot;client-key&amp;quot; field on the &amp;quot;cluster-admin&amp;quot;&lt;br /&gt;
  // entry, without touching other values:&lt;br /&gt;
  $ oc config set-credentials cluster-admin --client-key=~/.kube/admin.key&lt;br /&gt;
&lt;br /&gt;
  // Set basic auth for the &amp;quot;cluster-admin&amp;quot; entry&lt;br /&gt;
  $ oc config set-credentials cluster-admin --username=admin --password=uXFGweU9l35qcif&lt;br /&gt;
&lt;br /&gt;
  // Embed client certificate data in the &amp;quot;cluster-admin&amp;quot; entry&lt;br /&gt;
  $ oc config set-credentials cluster-admin --client-certificate=~/.kube/admin.crt --embed-certs=true&lt;br /&gt;
&lt;br /&gt;
== Set a context entry in kubeconfig==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  // Set the user field on the gce context entry without touching other values&lt;br /&gt;
  $ oc config set-context gce --user=cluster-admin&lt;br /&gt;
&lt;br /&gt;
== Change configuration files for the client==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  // Change the config context to use&lt;br /&gt;
  oc config use-context my-context&lt;br /&gt;
&lt;br /&gt;
  // Set the value of a config preference&lt;br /&gt;
  oc config set preferences.some true&lt;/div&gt;</summary>
		<author><name>Fiducia</name></author>
		
	</entry>
</feed>