Este contenido no está disponible en el idioma seleccionado.
Chapter 2. OpenShift CLI (oc)
2.1. Getting started with the OpenShift CLI Copiar enlaceEnlace copiado en el portapapeles!
2.1.1. About the OpenShift CLI Copiar enlaceEnlace copiado en el portapapeles!
With the OpenShift CLI (oc
), you can create applications and manage OpenShift Container Platform projects from a terminal. The OpenShift CLI is ideal in the following situations:
- Working directly with project source code
- Scripting OpenShift Container Platform operations
- Managing projects while restricted by bandwidth resources and the web console is unavailable
2.1.2. Installing the OpenShift CLI Copiar enlaceEnlace copiado en el portapapeles!
You can install the OpenShift CLI (oc
) either by downloading the binary or by using an RPM.
2.1.2.1. Installing the OpenShift CLI by downloading the binary Copiar enlaceEnlace copiado en el portapapeles!
You can install the OpenShift CLI (oc
) to interact with OpenShift Container Platform from a command-line interface. You can install oc
on Linux, Windows, or macOS.
If you installed an earlier version of oc
, you cannot use it to complete all of the commands in OpenShift Container Platform 4.13. Download and install the new version of oc
.
Installing the OpenShift CLI on Linux
You can install the OpenShift CLI (oc
) binary on Linux by using the following procedure.
Procedure
- Navigate to the OpenShift Container Platform downloads page on the Red Hat Customer Portal.
- Select the architecture from the Product Variant drop-down list.
- Select the appropriate version from the Version drop-down list.
- Click Download Now next to the OpenShift v4.13 Linux Client entry and save the file.
Unpack the archive:
tar xvf <file>
$ tar xvf <file>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Place the
oc
binary in a directory that is on yourPATH
.To check your
PATH
, execute the following command:echo $PATH
$ echo $PATH
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
After you install the OpenShift CLI, it is available using the
oc
command:oc <command>
$ oc <command>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Installing the OpenShift CLI on Windows
You can install the OpenShift CLI (oc
) binary on Windows by using the following procedure.
Procedure
- Navigate to the OpenShift Container Platform downloads page on the Red Hat Customer Portal.
- Select the appropriate version from the Version drop-down list.
- Click Download Now next to the OpenShift v4.13 Windows Client entry and save the file.
- Unzip the archive with a ZIP program.
Move the
oc
binary to a directory that is on yourPATH
.To check your
PATH
, open the command prompt and execute the following command:path
C:\> path
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
After you install the OpenShift CLI, it is available using the
oc
command:oc <command>
C:\> oc <command>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Installing the OpenShift CLI on macOS
You can install the OpenShift CLI (oc
) binary on macOS by using the following procedure.
Procedure
- Navigate to the OpenShift Container Platform downloads page on the Red Hat Customer Portal.
- Select the appropriate version from the Version drop-down list.
Click Download Now next to the OpenShift v4.13 macOS Client entry and save the file.
NoteFor macOS arm64, choose the OpenShift v4.13 macOS arm64 Client entry.
- Unpack and unzip the archive.
Move the
oc
binary to a directory on your PATH.To check your
PATH
, open a terminal and execute the following command:echo $PATH
$ echo $PATH
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
After you install the OpenShift CLI, it is available using the
oc
command:oc <command>
$ oc <command>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.1.2.2. Installing the OpenShift CLI by using the web console Copiar enlaceEnlace copiado en el portapapeles!
You can install the OpenShift CLI (oc
) to interact with OpenShift Container Platform from a web console. You can install oc
on Linux, Windows, or macOS.
If you installed an earlier version of oc
, you cannot use it to complete all of the commands in OpenShift Container Platform 4.13. Download and install the new version of oc
.
2.1.2.2.1. Installing the OpenShift CLI on Linux using the web console Copiar enlaceEnlace copiado en el portapapeles!
You can install the OpenShift CLI (oc
) binary on Linux by using the following procedure.
Procedure
From the web console, click ?.
Click Command Line Tools.
-
Select appropriate
oc
binary for your Linux platform, and then click Download oc for Linux. - Save the file.
Unpack the archive.
tar xvf <file>
$ tar xvf <file>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Move the
oc
binary to a directory that is on yourPATH
.To check your
PATH
, execute the following command:echo $PATH
$ echo $PATH
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
After you install the OpenShift CLI, it is available using the oc
command:
oc <command>
$ oc <command>
2.1.2.2.2. Installing the OpenShift CLI on Windows using the web console Copiar enlaceEnlace copiado en el portapapeles!
You can install the OpenShift CLI (oc
) binary on Windows by using the following procedure.
Procedure
From the web console, click ?.
Click Command Line Tools.
-
Select the
oc
binary for Windows platform, and then click Download oc for Windows for x86_64. - Save the file.
- Unzip the archive with a ZIP program.
Move the
oc
binary to a directory that is on yourPATH
.To check your
PATH
, open the command prompt and execute the following command:path
C:\> path
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
After you install the OpenShift CLI, it is available using the oc
command:
oc <command>
C:\> oc <command>
2.1.2.2.3. Installing the OpenShift CLI on macOS using the web console Copiar enlaceEnlace copiado en el portapapeles!
You can install the OpenShift CLI (oc
) binary on macOS by using the following procedure.
Procedure
From the web console, click ?.
Click Command Line Tools.
Select the
oc
binary for macOS platform, and then click Download oc for Mac for x86_64.NoteFor macOS arm64, click Download oc for Mac for ARM 64.
- Save the file.
- Unpack and unzip the archive.
Move the
oc
binary to a directory on your PATH.To check your
PATH
, open a terminal and execute the following command:echo $PATH
$ echo $PATH
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
After you install the OpenShift CLI, it is available using the oc
command:
oc <command>
$ oc <command>
2.1.2.3. Installing the OpenShift CLI by using an RPM Copiar enlaceEnlace copiado en el portapapeles!
For Red Hat Enterprise Linux (RHEL), you can install the OpenShift CLI (oc
) as an RPM if you have an active OpenShift Container Platform subscription on your Red Hat account.
It is not supported to install the OpenShift CLI (oc
) as an RPM for Red Hat Enterprise Linux (RHEL) 9. You must install the OpenShift CLI for RHEL 9 by downloading the binary.
Prerequisites
- Must have root or sudo privileges.
Procedure
Register with Red Hat Subscription Manager:
subscription-manager register
# subscription-manager register
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Pull the latest subscription data:
subscription-manager refresh
# subscription-manager refresh
Copy to Clipboard Copied! Toggle word wrap Toggle overflow List the available subscriptions:
subscription-manager list --available --matches '*OpenShift*'
# subscription-manager list --available --matches '*OpenShift*'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow In the output for the previous command, find the pool ID for an OpenShift Container Platform subscription and attach the subscription to the registered system:
subscription-manager attach --pool=<pool_id>
# subscription-manager attach --pool=<pool_id>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Enable the repositories required by OpenShift Container Platform 4.13.
subscription-manager repos --enable="rhocp-4.13-for-rhel-8-x86_64-rpms"
# subscription-manager repos --enable="rhocp-4.13-for-rhel-8-x86_64-rpms"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Install the
openshift-clients
package:yum install openshift-clients
# yum install openshift-clients
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
After you install the CLI, it is available using the oc
command:
oc <command>
$ oc <command>
2.1.2.4. Installing the OpenShift CLI by using Homebrew Copiar enlaceEnlace copiado en el portapapeles!
For macOS, you can install the OpenShift CLI (oc
) by using the Homebrew package manager.
Prerequisites
-
You must have Homebrew (
brew
) installed.
Procedure
Run the following command to install the openshift-cli package:
brew install openshift-cli
$ brew install openshift-cli
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.1.3. Logging in to the OpenShift CLI Copiar enlaceEnlace copiado en el portapapeles!
You can log in to the OpenShift CLI (oc
) to access and manage your cluster.
Prerequisites
- You must have access to an OpenShift Container Platform cluster.
-
The OpenShift CLI (
oc
) is installed.
To access a cluster that is accessible only over an HTTP proxy server, you can set the HTTP_PROXY
, HTTPS_PROXY
and NO_PROXY
variables. These environment variables are respected by the oc
CLI so that all communication with the cluster goes through the HTTP proxy.
Authentication headers are sent only when using HTTPS transport.
Procedure
Enter the
oc login
command and pass in a user name:oc login -u user1
$ oc login -u user1
Copy to Clipboard Copied! Toggle word wrap Toggle overflow When prompted, enter the required information:
Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
If you are logged in to the web console, you can generate an oc login
command that includes your token and server information. You can use the command to log in to the OpenShift Container Platform CLI without the interactive prompts. To generate the command, select Copy login command from the username drop-down menu at the top right of the web console.
You can now create a project or issue other commands for managing your cluster.
2.1.4. Logging in to the OpenShift CLI using a web browser Copiar enlaceEnlace copiado en el portapapeles!
You can log in to the OpenShift CLI (oc
) with the help of a web browser to access and manage your cluster. This allows users to avoid inserting their access token into the command line.
Logging in to the CLI through the web browser runs a server on localhost with HTTP, not HTTPS; use with caution on multi-user workstations.
Prerequisites
- You must have access to an OpenShift Container Platform cluster.
-
You must have installed the OpenShift CLI (
oc
). - You must have a browser installed.
Procedure
Enter the
oc login
command with the--web
flag:oc login <cluster_url> --web
$ oc login <cluster_url> --web
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Optionally, you can specify the server URL and callback port. For example,
oc login <cluster_url> --web --callback-port 8280 localhost:8443
.
The web browser opens automatically. If it does not, click the link in the command output. If you do not specify the OpenShift Container Platform server
oc
tries to open the web console of the cluster specified in the currentoc
configuration file. If nooc
configuration exists,oc
prompts interactively for the server URL.Example output
Opening login URL in the default browser: https://openshift.example.com Opening in existing browser session.
Opening login URL in the default browser: https://openshift.example.com Opening in existing browser session.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - If more than one identity provider is available, select your choice from the options provided.
-
Enter your username and password into the corresponding browser fields. After you are logged in, the browser displays the text
access token received successfully; please return to your terminal
. Check the CLI for a login confirmation.
Example output
Login successful. You don't have any projects. You can try to create a new project, by running oc new-project <projectname>
Login successful. You don't have any projects. You can try to create a new project, by running oc new-project <projectname>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
The web console defaults to the profile used in the previous session. To switch between Administrator and Developer profiles, log out of the OpenShift Container Platform web console and clear the cache.
You can now create a project or issue other commands for managing your cluster.
2.1.5. Using the OpenShift CLI Copiar enlaceEnlace copiado en el portapapeles!
Review the following sections to learn how to complete common tasks using the CLI.
2.1.5.1. Creating a project Copiar enlaceEnlace copiado en el portapapeles!
Use the oc new-project
command to create a new project.
oc new-project my-project
$ oc new-project my-project
Example output
Now using project "my-project" on server "https://openshift.example.com:6443".
Now using project "my-project" on server "https://openshift.example.com:6443".
2.1.5.2. Creating a new app Copiar enlaceEnlace copiado en el portapapeles!
Use the oc new-app
command to create a new application.
oc new-app https://github.com/sclorg/cakephp-ex
$ oc new-app https://github.com/sclorg/cakephp-ex
Example output
--> Found image 40de956 (9 days old) in imagestream "openshift/php" under tag "7.2" for "php" ... Run 'oc status' to view your app.
--> Found image 40de956 (9 days old) in imagestream "openshift/php" under tag "7.2" for "php"
...
Run 'oc status' to view your app.
2.1.5.3. Viewing pods Copiar enlaceEnlace copiado en el portapapeles!
Use the oc get pods
command to view the pods for the current project.
When you run oc
inside a pod and do not specify a namespace, the namespace of the pod is used by default.
oc get pods -o wide
$ oc get pods -o wide
Example output
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE cakephp-ex-1-build 0/1 Completed 0 5m45s 10.131.0.10 ip-10-0-141-74.ec2.internal <none> cakephp-ex-1-deploy 0/1 Completed 0 3m44s 10.129.2.9 ip-10-0-147-65.ec2.internal <none> cakephp-ex-1-ktz97 1/1 Running 0 3m33s 10.128.2.11 ip-10-0-168-105.ec2.internal <none>
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE
cakephp-ex-1-build 0/1 Completed 0 5m45s 10.131.0.10 ip-10-0-141-74.ec2.internal <none>
cakephp-ex-1-deploy 0/1 Completed 0 3m44s 10.129.2.9 ip-10-0-147-65.ec2.internal <none>
cakephp-ex-1-ktz97 1/1 Running 0 3m33s 10.128.2.11 ip-10-0-168-105.ec2.internal <none>
2.1.5.4. Viewing pod logs Copiar enlaceEnlace copiado en el portapapeles!
Use the oc logs
command to view logs for a particular pod.
oc logs cakephp-ex-1-deploy
$ oc logs cakephp-ex-1-deploy
Example output
--> Scaling cakephp-ex-1 to 1 --> Success
--> Scaling cakephp-ex-1 to 1
--> Success
2.1.5.5. Viewing the current project Copiar enlaceEnlace copiado en el portapapeles!
Use the oc project
command to view the current project.
oc project
$ oc project
Example output
Using project "my-project" on server "https://openshift.example.com:6443".
Using project "my-project" on server "https://openshift.example.com:6443".
2.1.5.6. Viewing the status for the current project Copiar enlaceEnlace copiado en el portapapeles!
Use the oc status
command to view information about the current project, such as services, deployments, and build configs.
oc status
$ oc status
Example output
2.1.5.7. Listing supported API resources Copiar enlaceEnlace copiado en el portapapeles!
Use the oc api-resources
command to view the list of supported API resources on the server.
oc api-resources
$ oc api-resources
Example output
NAME SHORTNAMES APIGROUP NAMESPACED KIND bindings true Binding componentstatuses cs false ComponentStatus configmaps cm true ConfigMap ...
NAME SHORTNAMES APIGROUP NAMESPACED KIND
bindings true Binding
componentstatuses cs false ComponentStatus
configmaps cm true ConfigMap
...
2.1.6. Getting help Copiar enlaceEnlace copiado en el portapapeles!
You can get help with CLI commands and OpenShift Container Platform resources in the following ways:
Use
oc help
to get a list and description of all available CLI commands:Example: Get general help for the CLI
oc help
$ oc help
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Use the
--help
flag to get help about a specific CLI command:Example: Get help for the
oc create
commandoc create --help
$ oc create --help
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Use the
oc explain
command to view the description and fields for a particular resource:Example: View documentation for the
Pod
resourceoc explain pods
$ oc explain pods
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.1.7. Logging out of the OpenShift CLI Copiar enlaceEnlace copiado en el portapapeles!
You can log out the OpenShift CLI to end your current session.
Use the
oc logout
command.oc logout
$ oc logout
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Logged "user1" out on "https://openshift.example.com"
Logged "user1" out on "https://openshift.example.com"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
This deletes the saved authentication token from the server and removes it from your configuration file.
2.2. Configuring the OpenShift CLI Copiar enlaceEnlace copiado en el portapapeles!
2.2.1. Enabling tab completion Copiar enlaceEnlace copiado en el portapapeles!
You can enable tab completion for the Bash or Zsh shells.
2.2.1.1. Enabling tab completion for Bash Copiar enlaceEnlace copiado en el portapapeles!
After you install the OpenShift CLI (oc
), you can enable tab completion to automatically complete oc
commands or suggest options when you press Tab. The following procedure enables tab completion for the Bash shell.
Prerequisites
-
You must have the OpenShift CLI (
oc
) installed. -
You must have the package
bash-completion
installed.
Procedure
Save the Bash completion code to a file:
oc completion bash > oc_bash_completion
$ oc completion bash > oc_bash_completion
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Copy the file to
/etc/bash_completion.d/
:sudo cp oc_bash_completion /etc/bash_completion.d/
$ sudo cp oc_bash_completion /etc/bash_completion.d/
Copy to Clipboard Copied! Toggle word wrap Toggle overflow You can also save the file to a local directory and source it from your
.bashrc
file instead.
Tab completion is enabled when you open a new terminal.
2.2.1.2. Enabling tab completion for Zsh Copiar enlaceEnlace copiado en el portapapeles!
After you install the OpenShift CLI (oc
), you can enable tab completion to automatically complete oc
commands or suggest options when you press Tab. The following procedure enables tab completion for the Zsh shell.
Prerequisites
-
You must have the OpenShift CLI (
oc
) installed.
Procedure
To add tab completion for
oc
to your.zshrc
file, run the following command:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Tab completion is enabled when you open a new terminal.
2.3. Usage of oc and kubectl commands Copiar enlaceEnlace copiado en el portapapeles!
The Kubernetes command-line interface (CLI), kubectl
, can be used to run commands against a Kubernetes cluster. Because OpenShift Container Platform is a certified Kubernetes distribution, you can use the supported kubectl
binaries that ship with OpenShift Container Platform , or you can gain extended functionality by using the oc
binary.
2.3.1. The oc binary Copiar enlaceEnlace copiado en el portapapeles!
The oc
binary offers the same capabilities as the kubectl
binary, but it extends to natively support additional OpenShift Container Platform features, including:
Full support for OpenShift Container Platform resources
Resources such as
DeploymentConfig
,BuildConfig
,Route
,ImageStream
, andImageStreamTag
objects are specific to OpenShift Container Platform distributions, and build upon standard Kubernetes primitives.Authentication
The
oc
binary offers a built-inlogin
command for authentication and lets you work with projects, which map Kubernetes namespaces to authenticated users. Read Understanding authentication for more information.Additional commands
The additional command
oc new-app
, for example, makes it easier to get new applications started using existing source code or pre-built images. Similarly, the additional commandoc new-project
makes it easier to start a project that you can switch to as your default.
If you installed an earlier version of the oc
binary, you cannot use it to complete all of the commands in OpenShift Container Platform 4.13 . If you want the latest features, you must download and install the latest version of the oc
binary corresponding to your OpenShift Container Platform server version.
Non-security API changes will involve, at minimum, two minor releases (4.1 to 4.2 to 4.3, for example) to allow older oc
binaries to update. Using new capabilities might require newer oc
binaries. A 4.3 server might have additional capabilities that a 4.2 oc
binary cannot use and a 4.3 oc
binary might have additional capabilities that are unsupported by a 4.2 server.
X.Y ( |
X.Y+N footnote:versionpolicyn[Where N is a number greater than or equal to 1.] ( | |
X.Y (Server) |
|
|
X.Y+N footnote:versionpolicyn[] (Server) |
|
|
Fully compatible.
oc
client might not be able to access server features.
oc
client might provide options and features that might not be compatible with the accessed server.
2.3.2. The kubectl binary Copiar enlaceEnlace copiado en el portapapeles!
The kubectl
binary is provided as a means to support existing workflows and scripts for new OpenShift Container Platform users coming from a standard Kubernetes environment, or for those who prefer to use the kubectl
CLI. Existing users of kubectl
can continue to use the binary to interact with Kubernetes primitives, with no changes required to the OpenShift Container Platform cluster.
You can install the supported kubectl
binary by following the steps to Install the OpenShift CLI. The kubectl
binary is included in the archive if you download the binary, or is installed when you install the CLI by using an RPM.
For more information, see the kubectl documentation.
2.4. Managing CLI profiles Copiar enlaceEnlace copiado en el portapapeles!
A CLI configuration file allows you to configure different profiles, or contexts, for use with the CLI tools overview. A context consists of user authentication an OpenShift Container Platform server information associated with a nickname.
2.4.1. About switches between CLI profiles Copiar enlaceEnlace copiado en el portapapeles!
Contexts allow you to easily switch between multiple users across multiple OpenShift Container Platform servers, or clusters, when using CLI operations. Nicknames make managing CLI configurations easier by providing short-hand references to contexts, user credentials, and cluster details. After a user logs in with the oc
CLI for the first time, OpenShift Container Platform creates a ~/.kube/config
file if one does not already exist. As more authentication and connection details are provided to the CLI, either automatically during an oc login
operation or by manually configuring CLI profiles, the updated information is stored in the configuration file:
CLI config file
- 1
- The
clusters
section defines connection details for OpenShift Container Platform clusters, including the address for their master server. In this example, one cluster is nicknamedopenshift1.example.com:8443
and another is nicknamedopenshift2.example.com:8443
. - 2
- This
contexts
section defines two contexts: one nicknamedalice-project/openshift1.example.com:8443/alice
, using thealice-project
project,openshift1.example.com:8443
cluster, andalice
user, and another nicknamedjoe-project/openshift1.example.com:8443/alice
, using thejoe-project
project,openshift1.example.com:8443
cluster andalice
user. - 3
- The
current-context
parameter shows that thejoe-project/openshift1.example.com:8443/alice
context is currently in use, allowing thealice
user to work in thejoe-project
project on theopenshift1.example.com:8443
cluster. - 4
- The
users
section defines user credentials. In this example, the user nicknamealice/openshift1.example.com:8443
uses an access token.
The CLI can support multiple configuration files which are loaded at runtime and merged together along with any override options specified from the command line. After you are logged in, you can use the oc status
or oc project
command to verify your current working environment:
Verify the current working environment
oc status
$ oc status
Example output
List the current project
oc project
$ oc project
Example output
Using project "joe-project" from context named "joe-project/openshift1.example.com:8443/alice" on server "https://openshift1.example.com:8443".
Using project "joe-project" from context named "joe-project/openshift1.example.com:8443/alice" on server "https://openshift1.example.com:8443".
You can run the oc login
command again and supply the required information during the interactive process, to log in using any other combination of user credentials and cluster details. A context is constructed based on the supplied information if one does not already exist. If you are already logged in and want to switch to another project the current user already has access to, use the oc project
command and enter the name of the project:
oc project alice-project
$ oc project alice-project
Example output
Now using project "alice-project" on server "https://openshift1.example.com:8443".
Now using project "alice-project" on server "https://openshift1.example.com:8443".
At any time, you can use the oc config view
command to view your current CLI configuration, as seen in the output. Additional CLI configuration commands are also available for more advanced usage.
If you have access to administrator credentials but are no longer logged in as the default system user system:admin
, you can log back in as this user at any time as long as the credentials are still present in your CLI config file. The following command logs in and switches to the default project:
oc login -u system:admin -n default
$ oc login -u system:admin -n default
2.4.2. Manual configuration of CLI profiles Copiar enlaceEnlace copiado en el portapapeles!
This section covers more advanced usage of CLI configurations. In most situations, you can use the oc login
and oc project
commands to log in and switch between contexts and projects.
If you want to manually configure your CLI config files, you can use the oc config
command instead of directly modifying the files. The oc config
command includes a number of helpful sub-commands for this purpose:
Subcommand | Usage |
---|---|
| Sets a cluster entry in the CLI config file. If the referenced cluster nickname already exists, the specified information is merged in. oc config set-cluster <cluster_nickname> [--server=<master_ip_or_fqdn>]
|
| Sets a context entry in the CLI config file. If the referenced context nickname already exists, the specified information is merged in. oc config set-context <context_nickname> [--cluster=<cluster_nickname>]
|
| Sets the current context using the specified context nickname. oc config use-context <context_nickname>
|
| Sets an individual value in the CLI config file. oc config set <property_name> <property_value>
The |
| Unsets individual values in the CLI config file. oc config unset <property_name>
The |
| Displays the merged CLI configuration currently in use. oc config view
Displays the result of the specified CLI config file. oc config view --config=<specific_filename>
|
Example usage
-
Log in as a user that uses an access token. This token is used by the
alice
user:
oc login https://openshift1.example.com --token=ns7yVhuRNpDM9cgzfhhxQ7bM5s7N2ZVrkZepSRf4LC0
$ oc login https://openshift1.example.com --token=ns7yVhuRNpDM9cgzfhhxQ7bM5s7N2ZVrkZepSRf4LC0
- View the cluster entry automatically created:
oc config view
$ oc config view
Example output
- Update the current context to have users log in to the desired namespace:
oc config set-context `oc config current-context` --namespace=<project_name>
$ oc config set-context `oc config current-context` --namespace=<project_name>
- Examine the current context, to confirm that the changes are implemented:
oc whoami -c
$ oc whoami -c
All subsequent CLI operations uses the new context, unless otherwise specified by overriding CLI options or until the context is switched.
2.4.3. Load and merge rules Copiar enlaceEnlace copiado en el portapapeles!
You can follow these rules, when issuing CLI operations for the loading and merging order for the CLI configuration:
CLI config files are retrieved from your workstation, using the following hierarchy and merge rules:
-
If the
--config
option is set, then only that file is loaded. The flag is set once and no merging takes place. -
If the
$KUBECONFIG
environment variable is set, then it is used. The variable can be a list of paths, and if so the paths are merged together. When a value is modified, it is modified in the file that defines the stanza. When a value is created, it is created in the first file that exists. If no files in the chain exist, then it creates the last file in the list. -
Otherwise, the
~/.kube/config
file is used and no merging takes place.
-
If the
The context to use is determined based on the first match in the following flow:
-
The value of the
--context
option. -
The
current-context
value from the CLI config file. - An empty value is allowed at this stage.
-
The value of the
The user and cluster to use is determined. At this point, you may or may not have a context; they are built based on the first match in the following flow, which is run once for the user and once for the cluster:
-
The value of the
--user
for user name and--cluster
option for cluster name. -
If the
--context
option is present, then use the context’s value. - An empty value is allowed at this stage.
-
The value of the
The actual cluster information to use is determined. At this point, you may or may not have cluster information. Each piece of the cluster information is built based on the first match in the following flow:
The values of any of the following command-line options:
-
--server
, -
--api-version
-
--certificate-authority
-
--insecure-skip-tls-verify
-
- If cluster information and a value for the attribute is present, then use it.
- If you do not have a server location, then there is an error.
The actual user information to use is determined. Users are built using the same rules as clusters, except that you can only have one authentication technique per user; conflicting techniques cause the operation to fail. Command-line options take precedence over config file values. Valid command-line options are:
-
--auth-path
-
--client-certificate
-
--client-key
-
--token
-
- For any information that is still missing, default values are used and prompts are given for additional information.
2.5. Extending the OpenShift CLI with plugins Copiar enlaceEnlace copiado en el portapapeles!
You can write and install plugins to build on the default oc
commands, allowing you to perform new and more complex tasks with the OpenShift Container Platform CLI.
2.5.1. Writing CLI plugins Copiar enlaceEnlace copiado en el portapapeles!
You can write a plugin for the OpenShift Container Platform CLI in any programming language or script that allows you to write command-line commands. Note that you can not use a plugin to overwrite an existing oc
command.
Procedure
This procedure creates a simple Bash plugin that prints a message to the terminal when the oc foo
command is issued.
Create a file called
oc-foo
.When naming your plugin file, keep the following in mind:
-
The file must begin with
oc-
orkubectl-
to be recognized as a plugin. -
The file name determines the command that invokes the plugin. For example, a plugin with the file name
oc-foo-bar
can be invoked by a command ofoc foo bar
. You can also use underscores if you want the command to contain dashes. For example, a plugin with the file nameoc-foo_bar
can be invoked by a command ofoc foo-bar
.
-
The file must begin with
Add the following contents to the file.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
After you install this plugin for the OpenShift Container Platform CLI, it can be invoked using the oc foo
command.
2.5.2. Installing and using CLI plugins Copiar enlaceEnlace copiado en el portapapeles!
After you write a custom plugin for the OpenShift Container Platform CLI, you must install the plugin before use.
Prerequisites
-
You must have the
oc
CLI tool installed. -
You must have a CLI plugin file that begins with
oc-
orkubectl-
.
Procedure
If necessary, update the plugin file to be executable.
chmod +x <plugin_file>
$ chmod +x <plugin_file>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Place the file anywhere in your
PATH
, such as/usr/local/bin/
.sudo mv <plugin_file> /usr/local/bin/.
$ sudo mv <plugin_file> /usr/local/bin/.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Run
oc plugin list
to make sure that the plugin is listed.oc plugin list
$ oc plugin list
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
The following compatible plugins are available: /usr/local/bin/<plugin_file>
The following compatible plugins are available: /usr/local/bin/<plugin_file>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If your plugin is not listed here, verify that the file begins with
oc-
orkubectl-
, is executable, and is on yourPATH
.Invoke the new command or option introduced by the plugin.
For example, if you built and installed the
kubectl-ns
plugin from the Sample plugin repository, you can use the following command to view the current namespace.oc ns
$ oc ns
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Note that the command to invoke the plugin depends on the plugin file name. For example, a plugin with the file name of
oc-foo-bar
is invoked by theoc foo bar
command.
2.6. Managing CLI plugins with Krew Copiar enlaceEnlace copiado en el portapapeles!
You can use Krew to install and manage plugins for the OpenShift CLI (oc
).
Using Krew to install and manage plugins for the OpenShift CLI is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.
For more information about the support scope of Red Hat Technology Preview features, see Technology Preview Features Support Scope.
2.6.1. Installing a CLI plugin with Krew Copiar enlaceEnlace copiado en el portapapeles!
You can install a plugin for the OpenShift CLI (oc
) with Krew.
Prerequisites
- You have installed Krew by following the installation procedure in the Krew documentation.
Procedure
To list all available plugins, run the following command:
oc krew search
$ oc krew search
Copy to Clipboard Copied! Toggle word wrap Toggle overflow To get information about a plugin, run the following command:
oc krew info <plugin_name>
$ oc krew info <plugin_name>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow To install a plugin, run the following command:
oc krew install <plugin_name>
$ oc krew install <plugin_name>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow To list all plugins that were installed by Krew, run the following command:
oc krew list
$ oc krew list
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.6.2. Updating a CLI plugin with Krew Copiar enlaceEnlace copiado en el portapapeles!
You can update a plugin that was installed for the OpenShift CLI (oc
) with Krew.
Prerequisites
- You have installed Krew by following the installation procedure in the Krew documentation.
- You have installed a plugin for the OpenShift CLI with Krew.
Procedure
To update a single plugin, run the following command:
oc krew upgrade <plugin_name>
$ oc krew upgrade <plugin_name>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow To update all plugins that were installed by Krew, run the following command:
oc krew upgrade
$ oc krew upgrade
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.6.3. Uninstalling a CLI plugin with Krew Copiar enlaceEnlace copiado en el portapapeles!
You can uninstall a plugin that was installed for the OpenShift CLI (oc
) with Krew.
Prerequisites
- You have installed Krew by following the installation procedure in the Krew documentation.
- You have installed a plugin for the OpenShift CLI with Krew.
Procedure
To uninstall a plugin, run the following command:
oc krew uninstall <plugin_name>
$ oc krew uninstall <plugin_name>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.7. OpenShift CLI developer command reference Copiar enlaceEnlace copiado en el portapapeles!
This reference provides descriptions and example commands for OpenShift CLI (oc
) developer commands. For administrator commands, see the OpenShift CLI administrator command reference.
Run oc help
to list all commands or run oc <command> --help
to get additional details for a specific command.
2.7.1. OpenShift CLI (oc) developer commands Copiar enlaceEnlace copiado en el portapapeles!
2.7.1.1. oc annotate Copiar enlaceEnlace copiado en el portapapeles!
Update the annotations on a resource
Example usage
2.7.1.2. oc api-resources Copiar enlaceEnlace copiado en el portapapeles!
Print the supported API resources on the server
Example usage
2.7.1.3. oc api-versions Copiar enlaceEnlace copiado en el portapapeles!
Print the supported API versions on the server, in the form of "group/version"
Example usage
Print the supported API versions
# Print the supported API versions
oc api-versions
2.7.1.4. oc apply Copiar enlaceEnlace copiado en el portapapeles!
Apply a configuration to a resource by file name or stdin
Example usage
2.7.1.5. oc apply edit-last-applied Copiar enlaceEnlace copiado en el portapapeles!
Edit latest last-applied-configuration annotations of a resource/object
Example usage
Edit the last-applied-configuration annotations by type/name in YAML
# Edit the last-applied-configuration annotations by type/name in YAML
oc apply edit-last-applied deployment/nginx
# Edit the last-applied-configuration annotations by file in JSON
oc apply edit-last-applied -f deploy.yaml -o json
2.7.1.6. oc apply set-last-applied Copiar enlaceEnlace copiado en el portapapeles!
Set the last-applied-configuration annotation on a live object to match the contents of a file
Example usage
2.7.1.7. oc apply view-last-applied Copiar enlaceEnlace copiado en el portapapeles!
View the latest last-applied-configuration annotations of a resource/object
Example usage
View the last-applied-configuration annotations by type/name in YAML
# View the last-applied-configuration annotations by type/name in YAML
oc apply view-last-applied deployment/nginx
# View the last-applied-configuration annotations by file in JSON
oc apply view-last-applied -f deploy.yaml -o json
2.7.1.8. oc attach Copiar enlaceEnlace copiado en el portapapeles!
Attach to a running container
Example usage
2.7.1.9. oc auth can-i Copiar enlaceEnlace copiado en el portapapeles!
Check whether an action is allowed
Example usage
2.7.1.10. oc auth reconcile Copiar enlaceEnlace copiado en el portapapeles!
Reconciles rules for RBAC role, role binding, cluster role, and cluster role binding objects
Example usage
Reconcile RBAC resources from a file
# Reconcile RBAC resources from a file
oc auth reconcile -f my-rbac-rules.yaml
2.7.1.11. oc autoscale Copiar enlaceEnlace copiado en el portapapeles!
Autoscale a deployment config, deployment, replica set, stateful set, or replication controller
Example usage
Auto scale a deployment "foo", with the number of pods between 2 and 10, no target CPU utilization specified so a default autoscaling policy will be used
# Auto scale a deployment "foo", with the number of pods between 2 and 10, no target CPU utilization specified so a default autoscaling policy will be used
oc autoscale deployment foo --min=2 --max=10
# Auto scale a replication controller "foo", with the number of pods between 1 and 5, target CPU utilization at 80%
oc autoscale rc foo --max=5 --cpu-percent=80
2.7.1.12. oc cancel-build Copiar enlaceEnlace copiado en el portapapeles!
Cancel running, pending, or new builds
Example usage
2.7.1.13. oc cluster-info Copiar enlaceEnlace copiado en el portapapeles!
Display cluster information
Example usage
Print the address of the control plane and cluster services
# Print the address of the control plane and cluster services
oc cluster-info
2.7.1.14. oc cluster-info dump Copiar enlaceEnlace copiado en el portapapeles!
Dump relevant information for debugging and diagnosis
Example usage
2.7.1.15. oc completion Copiar enlaceEnlace copiado en el portapapeles!
Output shell completion code for the specified shell (bash, zsh, fish, or powershell)
Example usage
2.7.1.16. oc config current-context Copiar enlaceEnlace copiado en el portapapeles!
Display the current-context
Example usage
Display the current-context
# Display the current-context
oc config current-context
2.7.1.17. oc config delete-cluster Copiar enlaceEnlace copiado en el portapapeles!
Delete the specified cluster from the kubeconfig
Example usage
Delete the minikube cluster
# Delete the minikube cluster
oc config delete-cluster minikube
2.7.1.18. oc config delete-context Copiar enlaceEnlace copiado en el portapapeles!
Delete the specified context from the kubeconfig
Example usage
Delete the context for the minikube cluster
# Delete the context for the minikube cluster
oc config delete-context minikube
2.7.1.19. oc config delete-user Copiar enlaceEnlace copiado en el portapapeles!
Delete the specified user from the kubeconfig
Example usage
Delete the minikube user
# Delete the minikube user
oc config delete-user minikube
2.7.1.20. oc config get-clusters Copiar enlaceEnlace copiado en el portapapeles!
Display clusters defined in the kubeconfig
Example usage
List the clusters that oc knows about
# List the clusters that oc knows about
oc config get-clusters
2.7.1.21. oc config get-contexts Copiar enlaceEnlace copiado en el portapapeles!
Describe one or many contexts
Example usage
List all the contexts in your kubeconfig file
# List all the contexts in your kubeconfig file
oc config get-contexts
# Describe one context in your kubeconfig file
oc config get-contexts my-context
2.7.1.22. oc config get-users Copiar enlaceEnlace copiado en el portapapeles!
Display users defined in the kubeconfig
Example usage
List the users that oc knows about
# List the users that oc knows about
oc config get-users
2.7.1.23. oc config rename-context Copiar enlaceEnlace copiado en el portapapeles!
Rename a context from the kubeconfig file
Example usage
Rename the context 'old-name' to 'new-name' in your kubeconfig file
# Rename the context 'old-name' to 'new-name' in your kubeconfig file
oc config rename-context old-name new-name
2.7.1.24. oc config set Copiar enlaceEnlace copiado en el portapapeles!
Set an individual value in a kubeconfig file
Example usage
2.7.1.25. oc config set-cluster Copiar enlaceEnlace copiado en el portapapeles!
Set a cluster entry in kubeconfig
Example usage
2.7.1.26. oc config set-context Copiar enlaceEnlace copiado en el portapapeles!
Set a context entry in kubeconfig
Example usage
Set the user field on the gce context entry without touching other values
# Set the user field on the gce context entry without touching other values
oc config set-context gce --user=cluster-admin
2.7.1.27. oc config set-credentials Copiar enlaceEnlace copiado en el portapapeles!
Set a user entry in kubeconfig
Example usage
2.7.1.28. oc config unset Copiar enlaceEnlace copiado en el portapapeles!
Unset an individual value in a kubeconfig file
Example usage
Unset the current-context
# Unset the current-context
oc config unset current-context
# Unset namespace in foo context
oc config unset contexts.foo.namespace
2.7.1.29. oc config use-context Copiar enlaceEnlace copiado en el portapapeles!
Set the current-context in a kubeconfig file
Example usage
Use the context for the minikube cluster
# Use the context for the minikube cluster
oc config use-context minikube
2.7.1.30. oc config view Copiar enlaceEnlace copiado en el portapapeles!
Display merged kubeconfig settings or a specified kubeconfig file
Example usage
2.7.1.31. oc cp Copiar enlaceEnlace copiado en el portapapeles!
Copy files and directories to and from containers
Example usage
2.7.1.32. oc create Copiar enlaceEnlace copiado en el portapapeles!
Create a resource from a file or from stdin
Example usage
2.7.1.33. oc create build Copiar enlaceEnlace copiado en el portapapeles!
Create a new build
Example usage
Create a new build
# Create a new build
oc create build myapp
2.7.1.34. oc create clusterresourcequota Copiar enlaceEnlace copiado en el portapapeles!
Create a cluster resource quota
Example usage
Create a cluster resource quota limited to 10 pods
# Create a cluster resource quota limited to 10 pods
oc create clusterresourcequota limit-bob --project-annotation-selector=openshift.io/requester=user-bob --hard=pods=10
2.7.1.35. oc create clusterrole Copiar enlaceEnlace copiado en el portapapeles!
Create a cluster role
Example usage
2.7.1.36. oc create clusterrolebinding Copiar enlaceEnlace copiado en el portapapeles!
Create a cluster role binding for a particular cluster role
Example usage
Create a cluster role binding for user1, user2, and group1 using the cluster-admin cluster role
# Create a cluster role binding for user1, user2, and group1 using the cluster-admin cluster role
oc create clusterrolebinding cluster-admin --clusterrole=cluster-admin --user=user1 --user=user2 --group=group1
2.7.1.37. oc create configmap Copiar enlaceEnlace copiado en el portapapeles!
Create a config map from a local file, directory or literal value
Example usage
2.7.1.38. oc create cronjob Copiar enlaceEnlace copiado en el portapapeles!
Create a cron job with the specified name
Example usage
Create a cron job
# Create a cron job
oc create cronjob my-job --image=busybox --schedule="*/1 * * * *"
# Create a cron job with a command
oc create cronjob my-job --image=busybox --schedule="*/1 * * * *" -- date
2.7.1.39. oc create deployment Copiar enlaceEnlace copiado en el portapapeles!
Create a deployment with the specified name
Example usage
2.7.1.40. oc create deploymentconfig Copiar enlaceEnlace copiado en el portapapeles!
Create a deployment config with default options that uses a given image
Example usage
Create an nginx deployment config named my-nginx
# Create an nginx deployment config named my-nginx
oc create deploymentconfig my-nginx --image=nginx
2.7.1.41. oc create identity Copiar enlaceEnlace copiado en el portapapeles!
Manually create an identity (only needed if automatic creation is disabled)
Example usage
Create an identity with identity provider "acme_ldap" and the identity provider username "adamjones"
# Create an identity with identity provider "acme_ldap" and the identity provider username "adamjones"
oc create identity acme_ldap:adamjones
2.7.1.42. oc create imagestream Copiar enlaceEnlace copiado en el portapapeles!
Create a new empty image stream
Example usage
Create a new image stream
# Create a new image stream
oc create imagestream mysql
2.7.1.43. oc create imagestreamtag Copiar enlaceEnlace copiado en el portapapeles!
Create a new image stream tag
Example usage
Create a new image stream tag based on an image in a remote registry
# Create a new image stream tag based on an image in a remote registry
oc create imagestreamtag mysql:latest --from-image=myregistry.local/mysql/mysql:5.0
2.7.1.44. oc create ingress Copiar enlaceEnlace copiado en el portapapeles!
Create an ingress with the specified name
Example usage
2.7.1.45. oc create job Copiar enlaceEnlace copiado en el portapapeles!
Create a job with the specified name
Example usage
2.7.1.46. oc create namespace Copiar enlaceEnlace copiado en el portapapeles!
Create a namespace with the specified name
Example usage
Create a new namespace named my-namespace
# Create a new namespace named my-namespace
oc create namespace my-namespace
2.7.1.47. oc create poddisruptionbudget Copiar enlaceEnlace copiado en el portapapeles!
Create a pod disruption budget with the specified name
Example usage
2.7.1.48. oc create priorityclass Copiar enlaceEnlace copiado en el portapapeles!
Create a priority class with the specified name
Example usage
2.7.1.49. oc create quota Copiar enlaceEnlace copiado en el portapapeles!
Create a quota with the specified name
Example usage
Create a new resource quota named my-quota
# Create a new resource quota named my-quota
oc create quota my-quota --hard=cpu=1,memory=1G,pods=2,services=3,replicationcontrollers=2,resourcequotas=1,secrets=5,persistentvolumeclaims=10
# Create a new resource quota named best-effort
oc create quota best-effort --hard=pods=100 --scopes=BestEffort
2.7.1.50. oc create role Copiar enlaceEnlace copiado en el portapapeles!
Create a role with single rule
Example usage
2.7.1.51. oc create rolebinding Copiar enlaceEnlace copiado en el portapapeles!
Create a role binding for a particular role or cluster role
Example usage
Create a role binding for user1, user2, and group1 using the admin cluster role
# Create a role binding for user1, user2, and group1 using the admin cluster role
oc create rolebinding admin --clusterrole=admin --user=user1 --user=user2 --group=group1
2.7.1.52. oc create route edge Copiar enlaceEnlace copiado en el portapapeles!
Create a route that uses edge TLS termination
Example usage
2.7.1.53. oc create route passthrough Copiar enlaceEnlace copiado en el portapapeles!
Create a route that uses passthrough TLS termination
Example usage
2.7.1.54. oc create route reencrypt Copiar enlaceEnlace copiado en el portapapeles!
Create a route that uses reencrypt TLS termination
Example usage
2.7.1.55. oc create secret docker-registry Copiar enlaceEnlace copiado en el portapapeles!
Create a secret for use with a Docker registry
Example usage
If you don't already have a .dockercfg file, you can create a dockercfg secret directly by using:
# If you don't already have a .dockercfg file, you can create a dockercfg secret directly by using:
oc create secret docker-registry my-secret --docker-server=DOCKER_REGISTRY_SERVER --docker-username=DOCKER_USER --docker-password=DOCKER_PASSWORD --docker-email=DOCKER_EMAIL
# Create a new secret named my-secret from ~/.docker/config.json
oc create secret docker-registry my-secret --from-file=.dockerconfigjson=path/to/.docker/config.json
2.7.1.56. oc create secret generic Copiar enlaceEnlace copiado en el portapapeles!
Create a secret from a local file, directory, or literal value
Example usage
2.7.1.57. oc create secret tls Copiar enlaceEnlace copiado en el portapapeles!
Create a TLS secret
Example usage
Create a new TLS secret named tls-secret with the given key pair
# Create a new TLS secret named tls-secret with the given key pair
oc create secret tls tls-secret --cert=path/to/tls.cert --key=path/to/tls.key
2.7.1.58. oc create service clusterip Copiar enlaceEnlace copiado en el portapapeles!
Create a ClusterIP service
Example usage
Create a new ClusterIP service named my-cs
# Create a new ClusterIP service named my-cs
oc create service clusterip my-cs --tcp=5678:8080
# Create a new ClusterIP service named my-cs (in headless mode)
oc create service clusterip my-cs --clusterip="None"
2.7.1.59. oc create service externalname Copiar enlaceEnlace copiado en el portapapeles!
Create an ExternalName service
Example usage
Create a new ExternalName service named my-ns
# Create a new ExternalName service named my-ns
oc create service externalname my-ns --external-name bar.com
2.7.1.60. oc create service loadbalancer Copiar enlaceEnlace copiado en el portapapeles!
Create a LoadBalancer service
Example usage
Create a new LoadBalancer service named my-lbs
# Create a new LoadBalancer service named my-lbs
oc create service loadbalancer my-lbs --tcp=5678:8080
2.7.1.61. oc create service nodeport Copiar enlaceEnlace copiado en el portapapeles!
Create a NodePort service
Example usage
Create a new NodePort service named my-ns
# Create a new NodePort service named my-ns
oc create service nodeport my-ns --tcp=5678:8080
2.7.1.62. oc create serviceaccount Copiar enlaceEnlace copiado en el portapapeles!
Create a service account with the specified name
Example usage
Create a new service account named my-service-account
# Create a new service account named my-service-account
oc create serviceaccount my-service-account
2.7.1.63. oc create token Copiar enlaceEnlace copiado en el portapapeles!
Request a service account token
Example usage
2.7.1.64. oc create user Copiar enlaceEnlace copiado en el portapapeles!
Manually create a user (only needed if automatic creation is disabled)
Example usage
Create a user with the username "ajones" and the display name "Adam Jones"
# Create a user with the username "ajones" and the display name "Adam Jones"
oc create user ajones --full-name="Adam Jones"
2.7.1.65. oc create useridentitymapping Copiar enlaceEnlace copiado en el portapapeles!
Manually map an identity to a user
Example usage
Map the identity "acme_ldap:adamjones" to the user "ajones"
# Map the identity "acme_ldap:adamjones" to the user "ajones"
oc create useridentitymapping acme_ldap:adamjones ajones
2.7.1.66. oc debug Copiar enlaceEnlace copiado en el portapapeles!
Launch a new instance of a pod for debugging
Example usage
2.7.1.67. oc delete Copiar enlaceEnlace copiado en el portapapeles!
Delete resources by file names, stdin, resources and names, or by resources and label selector
Example usage
2.7.1.68. oc describe Copiar enlaceEnlace copiado en el portapapeles!
Show details of a specific resource or group of resources
Example usage
2.7.1.69. oc diff Copiar enlaceEnlace copiado en el portapapeles!
Diff the live version against a would-be applied version
Example usage
Diff resources included in pod.json
# Diff resources included in pod.json
oc diff -f pod.json
# Diff file read from stdin
cat service.yaml | oc diff -f -
2.7.1.70. oc edit Copiar enlaceEnlace copiado en el portapapeles!
Edit a resource on the server
Example usage
2.7.1.71. oc events Copiar enlaceEnlace copiado en el portapapeles!
List events
Example usage
2.7.1.72. oc exec Copiar enlaceEnlace copiado en el portapapeles!
Execute a command in a container
Example usage
2.7.1.73. oc explain Copiar enlaceEnlace copiado en el portapapeles!
Get documentation for a resource
Example usage
Get the documentation of the resource and its fields
# Get the documentation of the resource and its fields
oc explain pods
# Get the documentation of a specific field of a resource
oc explain pods.spec.containers
2.7.1.74. oc expose Copiar enlaceEnlace copiado en el portapapeles!
Expose a replicated application as a service or route
Example usage
2.7.1.75. oc extract Copiar enlaceEnlace copiado en el portapapeles!
Extract secrets or config maps to disk
Example usage
2.7.1.76. oc get Copiar enlaceEnlace copiado en el portapapeles!
Display one or many resources
Example usage
2.7.1.77. oc idle Copiar enlaceEnlace copiado en el portapapeles!
Idle scalable resources
Example usage
Idle the scalable controllers associated with the services listed in to-idle.txt
# Idle the scalable controllers associated with the services listed in to-idle.txt
$ oc idle --resource-names-file to-idle.txt
2.7.1.78. oc image append Copiar enlaceEnlace copiado en el portapapeles!
Add layers to images and push them to a registry
Example usage
2.7.1.79. oc image extract Copiar enlaceEnlace copiado en el portapapeles!
Copy files from an image to the file system
Example usage
2.7.1.80. oc image info Copiar enlaceEnlace copiado en el portapapeles!
Display information about an image
Example usage
2.7.1.81. oc image mirror Copiar enlaceEnlace copiado en el portapapeles!
Mirror images from one repository to another
Example usage
2.7.1.82. oc import-image Copiar enlaceEnlace copiado en el portapapeles!
Import images from a container image registry
Example usage
2.7.1.83. oc kustomize Copiar enlaceEnlace copiado en el portapapeles!
Build a kustomization target from a directory or URL.
Example usage
2.7.1.84. oc label Copiar enlaceEnlace copiado en el portapapeles!
Update the labels on a resource
Example usage
2.7.1.85. oc login Copiar enlaceEnlace copiado en el portapapeles!
Log in to a server
Example usage
2.7.1.86. oc logout Copiar enlaceEnlace copiado en el portapapeles!
End the current server session
Example usage
Log out
# Log out
oc logout
2.7.1.87. oc logs Copiar enlaceEnlace copiado en el portapapeles!
Print the logs for a container in a pod
Example usage
2.7.1.88. oc new-app Copiar enlaceEnlace copiado en el portapapeles!
Create a new application
Example usage
2.7.1.89. oc new-build Copiar enlaceEnlace copiado en el portapapeles!
Create a new build configuration
Example usage
2.7.1.90. oc new-project Copiar enlaceEnlace copiado en el portapapeles!
Request a new project
Example usage
Create a new project with minimal information
# Create a new project with minimal information
oc new-project web-team-dev
# Create a new project with a display name and description
oc new-project web-team-dev --display-name="Web Team Development" --description="Development project for the web team."
2.7.1.91. oc observe Copiar enlaceEnlace copiado en el portapapeles!
Observe changes to resources and react to them (experimental)
Example usage
2.7.1.92. oc patch Copiar enlaceEnlace copiado en el portapapeles!
Update fields of a resource
Example usage
2.7.1.93. oc plugin list Copiar enlaceEnlace copiado en el portapapeles!
List all visible plugin executables on a user’s PATH
Example usage
List all available plugins
# List all available plugins
oc plugin list
2.7.1.94. oc policy add-role-to-user Copiar enlaceEnlace copiado en el portapapeles!
Add a role to users or service accounts for the current project
Example usage
Add the 'view' role to user1 for the current project
# Add the 'view' role to user1 for the current project
oc policy add-role-to-user view user1
# Add the 'edit' role to serviceaccount1 for the current project
oc policy add-role-to-user edit -z serviceaccount1
2.7.1.95. oc policy scc-review Copiar enlaceEnlace copiado en el portapapeles!
Check which service account can create a pod
Example usage
2.7.1.96. oc policy scc-subject-review Copiar enlaceEnlace copiado en el portapapeles!
Check whether a user or a service account can create a pod
Example usage
2.7.1.97. oc port-forward Copiar enlaceEnlace copiado en el portapapeles!
Forward one or more local ports to a pod
Example usage
2.7.1.98. oc process Copiar enlaceEnlace copiado en el portapapeles!
Process a template into list of resources
Example usage
2.7.1.99. oc project Copiar enlaceEnlace copiado en el portapapeles!
Switch to another project
Example usage
Switch to the 'myapp' project
# Switch to the 'myapp' project
oc project myapp
# Display the project currently in use
oc project
2.7.1.100. oc projects Copiar enlaceEnlace copiado en el portapapeles!
Display existing projects
Example usage
List all projects
# List all projects
oc projects
2.7.1.101. oc proxy Copiar enlaceEnlace copiado en el portapapeles!
Run a proxy to the Kubernetes API server
Example usage
2.7.1.102. oc registry info Copiar enlaceEnlace copiado en el portapapeles!
Print information about the integrated registry
Example usage
Display information about the integrated registry
# Display information about the integrated registry
oc registry info
2.7.1.103. oc registry login Copiar enlaceEnlace copiado en el portapapeles!
Log in to the integrated registry
Example usage
Log in to the integrated registry
# Log in to the integrated registry
oc registry login
# Log in to different registry using BASIC auth credentials
oc registry login --registry quay.io/myregistry --auth-basic=USER:PASS
2.7.1.104. oc replace Copiar enlaceEnlace copiado en el portapapeles!
Replace a resource by file name or stdin
Example usage
2.7.1.105. oc rollback Copiar enlaceEnlace copiado en el portapapeles!
Revert part of an application back to a previous deployment
Example usage
2.7.1.106. oc rollout cancel Copiar enlaceEnlace copiado en el portapapeles!
Cancel the in-progress deployment
Example usage
Cancel the in-progress deployment based on 'nginx'
# Cancel the in-progress deployment based on 'nginx'
oc rollout cancel dc/nginx
2.7.1.107. oc rollout history Copiar enlaceEnlace copiado en el portapapeles!
View rollout history
Example usage
View the rollout history of a deployment
# View the rollout history of a deployment
oc rollout history dc/nginx
# View the details of deployment revision 3
oc rollout history dc/nginx --revision=3
2.7.1.108. oc rollout latest Copiar enlaceEnlace copiado en el portapapeles!
Start a new rollout for a deployment config with the latest state from its triggers
Example usage
Start a new rollout based on the latest images defined in the image change triggers
# Start a new rollout based on the latest images defined in the image change triggers
oc rollout latest dc/nginx
# Print the rolled out deployment config
oc rollout latest dc/nginx -o json
2.7.1.109. oc rollout pause Copiar enlaceEnlace copiado en el portapapeles!
Mark the provided resource as paused
Example usage
Mark the nginx deployment as paused. Any current state of
# Mark the nginx deployment as paused. Any current state of
# the deployment will continue its function, new updates to the deployment will not
# have an effect as long as the deployment is paused
oc rollout pause dc/nginx
2.7.1.110. oc rollout restart Copiar enlaceEnlace copiado en el portapapeles!
Restart a resource
Example usage
2.7.1.111. oc rollout resume Copiar enlaceEnlace copiado en el portapapeles!
Resume a paused resource
Example usage
Resume an already paused deployment
# Resume an already paused deployment
oc rollout resume dc/nginx
2.7.1.112. oc rollout retry Copiar enlaceEnlace copiado en el portapapeles!
Retry the latest failed rollout
Example usage
Retry the latest failed deployment based on 'frontend'
# Retry the latest failed deployment based on 'frontend'
# The deployer pod and any hook pods are deleted for the latest failed deployment
oc rollout retry dc/frontend
2.7.1.113. oc rollout status Copiar enlaceEnlace copiado en el portapapeles!
Show the status of the rollout
Example usage
Watch the status of the latest rollout
# Watch the status of the latest rollout
oc rollout status dc/nginx
2.7.1.114. oc rollout undo Copiar enlaceEnlace copiado en el portapapeles!
Undo a previous rollout
Example usage
Roll back to the previous deployment
# Roll back to the previous deployment
oc rollout undo dc/nginx
# Roll back to deployment revision 3. The replication controller for that version must exist
oc rollout undo dc/nginx --to-revision=3
2.7.1.115. oc rsh Copiar enlaceEnlace copiado en el portapapeles!
Start a shell session in a container
Example usage
2.7.1.116. oc rsync Copiar enlaceEnlace copiado en el portapapeles!
Copy files between a local file system and a pod
Example usage
Synchronize a local directory with a pod directory
# Synchronize a local directory with a pod directory
oc rsync ./local/dir/ POD:/remote/dir
# Synchronize a pod directory with a local directory
oc rsync POD:/remote/dir/ ./local/dir
2.7.1.117. oc run Copiar enlaceEnlace copiado en el portapapeles!
Run a particular image on the cluster
Example usage
2.7.1.118. oc scale Copiar enlaceEnlace copiado en el portapapeles!
Set a new size for a deployment, replica set, or replication controller
Example usage
2.7.1.119. oc secrets link Copiar enlaceEnlace copiado en el portapapeles!
Link secrets to a service account
Example usage
Add an image pull secret to a service account to automatically use it for pulling pod images
# Add an image pull secret to a service account to automatically use it for pulling pod images
oc secrets link serviceaccount-name pull-secret --for=pull
# Add an image pull secret to a service account to automatically use it for both pulling and pushing build images
oc secrets link builder builder-image-secret --for=pull,mount
2.7.1.120. oc secrets unlink Copiar enlaceEnlace copiado en el portapapeles!
Detach secrets from a service account
Example usage
Unlink a secret currently associated with a service account
# Unlink a secret currently associated with a service account
oc secrets unlink serviceaccount-name secret-name another-secret-name ...
2.7.1.121. oc set build-hook Copiar enlaceEnlace copiado en el portapapeles!
Update a build hook on a build config
Example usage
2.7.1.122. oc set build-secret Copiar enlaceEnlace copiado en el portapapeles!
Update a build secret on a build config
Example usage
2.7.1.123. oc set data Copiar enlaceEnlace copiado en el portapapeles!
Update the data within a config map or secret
Example usage
2.7.1.124. oc set deployment-hook Copiar enlaceEnlace copiado en el portapapeles!
Update a deployment hook on a deployment config
Example usage
2.7.1.125. oc set env Copiar enlaceEnlace copiado en el portapapeles!
Update environment variables on a pod template
Example usage
2.7.1.126. oc set image Copiar enlaceEnlace copiado en el portapapeles!
Update the image of a pod template
Example usage
2.7.1.127. oc set image-lookup Copiar enlaceEnlace copiado en el portapapeles!
Change how images are resolved when deploying applications
Example usage
2.7.1.128. oc set probe Copiar enlaceEnlace copiado en el portapapeles!
Update a probe on a pod template
Example usage
2.7.1.129. oc set resources Copiar enlaceEnlace copiado en el portapapeles!
Update resource requests/limits on objects with pod templates
Example usage
2.7.1.130. oc set route-backends Copiar enlaceEnlace copiado en el portapapeles!
Update the backends for a route
Example usage
2.7.1.131. oc set selector Copiar enlaceEnlace copiado en el portapapeles!
Set the selector on a resource
Example usage
Set the labels and selector before creating a deployment/service pair.
# Set the labels and selector before creating a deployment/service pair.
oc create service clusterip my-svc --clusterip="None" -o yaml --dry-run | oc set selector --local -f - 'environment=qa' -o yaml | oc create -f -
oc create deployment my-dep -o yaml --dry-run | oc label --local -f - environment=qa -o yaml | oc create -f -
2.7.1.132. oc set serviceaccount Copiar enlaceEnlace copiado en el portapapeles!
Update the service account of a resource
Example usage
Set deployment nginx-deployment's service account to serviceaccount1
# Set deployment nginx-deployment's service account to serviceaccount1
oc set serviceaccount deployment nginx-deployment serviceaccount1
# Print the result (in YAML format) of updated nginx deployment with service account from a local file, without hitting the API server
oc set sa -f nginx-deployment.yaml serviceaccount1 --local --dry-run -o yaml
2.7.1.133. oc set subject Copiar enlaceEnlace copiado en el portapapeles!
Update the user, group, or service account in a role binding or cluster role binding
Example usage
2.7.1.134. oc set triggers Copiar enlaceEnlace copiado en el portapapeles!
Update the triggers on one or more objects
Example usage
2.7.1.135. oc set volumes Copiar enlaceEnlace copiado en el portapapeles!
Update volumes on a pod template
Example usage
2.7.1.136. oc start-build Copiar enlaceEnlace copiado en el portapapeles!
Start a new build
Example usage
2.7.1.137. oc status Copiar enlaceEnlace copiado en el portapapeles!
Show an overview of the current project
Example usage
2.7.1.138. oc tag Copiar enlaceEnlace copiado en el portapapeles!
Tag existing images into image streams
Example usage
2.7.1.139. oc version Copiar enlaceEnlace copiado en el portapapeles!
Print the client and server version information
Example usage
2.7.1.140. oc wait Copiar enlaceEnlace copiado en el portapapeles!
Experimental: Wait for a specific condition on one or many resources
Example usage
2.7.1.141. oc whoami Copiar enlaceEnlace copiado en el portapapeles!
Return information about the current session
Example usage
Display the currently authenticated user
# Display the currently authenticated user
oc whoami
2.8. OpenShift CLI administrator command reference Copiar enlaceEnlace copiado en el portapapeles!
This reference provides descriptions and example commands for OpenShift CLI (oc
) administrator commands. You must have cluster-admin
or equivalent permissions to use these commands.
For developer commands, see the OpenShift CLI developer command reference.
Run oc adm -h
to list all administrator commands or run oc <command> --help
to get additional details for a specific command.
2.8.1. OpenShift CLI (oc) administrator commands Copiar enlaceEnlace copiado en el portapapeles!
2.8.1.1. oc adm build-chain Copiar enlaceEnlace copiado en el portapapeles!
Output the inputs and dependencies of your builds
Example usage
2.8.1.2. oc adm catalog mirror Copiar enlaceEnlace copiado en el portapapeles!
Mirror an operator-registry catalog
Example usage
2.8.1.3. oc adm certificate approve Copiar enlaceEnlace copiado en el portapapeles!
Approve a certificate signing request
Example usage
Approve CSR 'csr-sqgzp'
# Approve CSR 'csr-sqgzp'
oc adm certificate approve csr-sqgzp
2.8.1.4. oc adm certificate deny Copiar enlaceEnlace copiado en el portapapeles!
Deny a certificate signing request
Example usage
Deny CSR 'csr-sqgzp'
# Deny CSR 'csr-sqgzp'
oc adm certificate deny csr-sqgzp
2.8.1.5. oc adm cordon Copiar enlaceEnlace copiado en el portapapeles!
Mark node as unschedulable
Example usage
Mark node "foo" as unschedulable
# Mark node "foo" as unschedulable
oc adm cordon foo
2.8.1.6. oc adm create-bootstrap-project-template Copiar enlaceEnlace copiado en el portapapeles!
Create a bootstrap project template
Example usage
Output a bootstrap project template in YAML format to stdout
# Output a bootstrap project template in YAML format to stdout
oc adm create-bootstrap-project-template -o yaml
2.8.1.7. oc adm create-error-template Copiar enlaceEnlace copiado en el portapapeles!
Create an error page template
Example usage
Output a template for the error page to stdout
# Output a template for the error page to stdout
oc adm create-error-template
2.8.1.8. oc adm create-login-template Copiar enlaceEnlace copiado en el portapapeles!
Create a login template
Example usage
Output a template for the login page to stdout
# Output a template for the login page to stdout
oc adm create-login-template
2.8.1.9. oc adm create-provider-selection-template Copiar enlaceEnlace copiado en el portapapeles!
Create a provider selection template
Example usage
Output a template for the provider selection page to stdout
# Output a template for the provider selection page to stdout
oc adm create-provider-selection-template
2.8.1.10. oc adm drain Copiar enlaceEnlace copiado en el portapapeles!
Drain node in preparation for maintenance
Example usage
Drain node "foo", even if there are pods not managed by a replication controller, replica set, job, daemon set or stateful set on it
# Drain node "foo", even if there are pods not managed by a replication controller, replica set, job, daemon set or stateful set on it
oc adm drain foo --force
# As above, but abort if there are pods not managed by a replication controller, replica set, job, daemon set or stateful set, and use a grace period of 15 minutes
oc adm drain foo --grace-period=900
2.8.1.11. oc adm groups add-users Copiar enlaceEnlace copiado en el portapapeles!
Add users to a group
Example usage
Add user1 and user2 to my-group
# Add user1 and user2 to my-group
oc adm groups add-users my-group user1 user2
2.8.1.12. oc adm groups new Copiar enlaceEnlace copiado en el portapapeles!
Create a new group
Example usage
2.8.1.13. oc adm groups prune Copiar enlaceEnlace copiado en el portapapeles!
Remove old OpenShift groups referencing missing records from an external provider
Example usage
2.8.1.14. oc adm groups remove-users Copiar enlaceEnlace copiado en el portapapeles!
Remove users from a group
Example usage
Remove user1 and user2 from my-group
# Remove user1 and user2 from my-group
oc adm groups remove-users my-group user1 user2
2.8.1.15. oc adm groups sync Copiar enlaceEnlace copiado en el portapapeles!
Sync OpenShift groups with records from an external provider
Example usage
2.8.1.16. oc adm inspect Copiar enlaceEnlace copiado en el portapapeles!
Collect debugging data for a given resource
Example usage
2.8.1.17. oc adm migrate icsp Copiar enlaceEnlace copiado en el portapapeles!
Update imagecontentsourcepolicy file(s) to imagedigestmirrorset file(s).
Example usage
update the imagecontentsourcepolicy.yaml to new imagedigestmirrorset file under directory mydir
# update the imagecontentsourcepolicy.yaml to new imagedigestmirrorset file under directory mydir
oc adm migrate icsp imagecontentsourcepolicy.yaml --dest-dir mydir
2.8.1.18. oc adm migrate template-instances Copiar enlaceEnlace copiado en el portapapeles!
Update template instances to point to the latest group-version-kinds
Example usage
Perform a dry-run of updating all objects
# Perform a dry-run of updating all objects
oc adm migrate template-instances
# To actually perform the update, the confirm flag must be appended
oc adm migrate template-instances --confirm
2.8.1.19. oc adm must-gather Copiar enlaceEnlace copiado en el portapapeles!
Launch a new instance of a pod for gathering debug information
Example usage
2.8.1.20. oc adm new-project Copiar enlaceEnlace copiado en el portapapeles!
Create a new project
Example usage
Create a new project using a node selector
# Create a new project using a node selector
oc adm new-project myproject --node-selector='type=user-node,region=east'
2.8.1.21. oc adm node-logs Copiar enlaceEnlace copiado en el portapapeles!
Display and filter node logs
Example usage
2.8.1.22. oc adm pod-network isolate-projects Copiar enlaceEnlace copiado en el portapapeles!
Isolate project network
Example usage
Provide isolation for project p1
# Provide isolation for project p1
oc adm pod-network isolate-projects <p1>
# Allow all projects with label name=top-secret to have their own isolated project network
oc adm pod-network isolate-projects --selector='name=top-secret'
2.8.1.23. oc adm pod-network join-projects Copiar enlaceEnlace copiado en el portapapeles!
Join project network
Example usage
Allow project p2 to use project p1 network
# Allow project p2 to use project p1 network
oc adm pod-network join-projects --to=<p1> <p2>
# Allow all projects with label name=top-secret to use project p1 network
oc adm pod-network join-projects --to=<p1> --selector='name=top-secret'
2.8.1.24. oc adm pod-network make-projects-global Copiar enlaceEnlace copiado en el portapapeles!
Make project network global
Example usage
Allow project p1 to access all pods in the cluster and vice versa
# Allow project p1 to access all pods in the cluster and vice versa
oc adm pod-network make-projects-global <p1>
# Allow all projects with label name=share to access all pods in the cluster and vice versa
oc adm pod-network make-projects-global --selector='name=share'
2.8.1.25. oc adm policy add-role-to-user Copiar enlaceEnlace copiado en el portapapeles!
Add a role to users or service accounts for the current project
Example usage
Add the 'view' role to user1 for the current project
# Add the 'view' role to user1 for the current project
oc adm policy add-role-to-user view user1
# Add the 'edit' role to serviceaccount1 for the current project
oc adm policy add-role-to-user edit -z serviceaccount1
2.8.1.26. oc adm policy add-scc-to-group Copiar enlaceEnlace copiado en el portapapeles!
Add a security context constraint to groups
Example usage
Add the 'restricted' security context constraint to group1 and group2
# Add the 'restricted' security context constraint to group1 and group2
oc adm policy add-scc-to-group restricted group1 group2
2.8.1.27. oc adm policy add-scc-to-user Copiar enlaceEnlace copiado en el portapapeles!
Add a security context constraint to users or a service account
Example usage
Add the 'restricted' security context constraint to user1 and user2
# Add the 'restricted' security context constraint to user1 and user2
oc adm policy add-scc-to-user restricted user1 user2
# Add the 'privileged' security context constraint to serviceaccount1 in the current namespace
oc adm policy add-scc-to-user privileged -z serviceaccount1
2.8.1.28. oc adm policy scc-review Copiar enlaceEnlace copiado en el portapapeles!
Check which service account can create a pod
Example usage
2.8.1.29. oc adm policy scc-subject-review Copiar enlaceEnlace copiado en el portapapeles!
Check whether a user or a service account can create a pod
Example usage
2.8.1.30. oc adm prune builds Copiar enlaceEnlace copiado en el portapapeles!
Remove old completed and failed builds
Example usage
2.8.1.31. oc adm prune deployments Copiar enlaceEnlace copiado en el portapapeles!
Remove old completed and failed deployment configs
Example usage
Dry run deleting all but the last complete deployment for every deployment config
# Dry run deleting all but the last complete deployment for every deployment config
oc adm prune deployments --keep-complete=1
# To actually perform the prune operation, the confirm flag must be appended
oc adm prune deployments --keep-complete=1 --confirm
2.8.1.32. oc adm prune groups Copiar enlaceEnlace copiado en el portapapeles!
Remove old OpenShift groups referencing missing records from an external provider
Example usage
2.8.1.33. oc adm prune images Copiar enlaceEnlace copiado en el portapapeles!
Remove unreferenced images
Example usage
2.8.1.34. oc adm release extract Copiar enlaceEnlace copiado en el portapapeles!
Extract the contents of an update payload to disk
Example usage
2.8.1.35. oc adm release info Copiar enlaceEnlace copiado en el portapapeles!
Display information about a release
Example usage
2.8.1.36. oc adm release mirror Copiar enlaceEnlace copiado en el portapapeles!
Mirror a release to a different image registry location
Example usage
2.8.1.37. oc adm release new Copiar enlaceEnlace copiado en el portapapeles!
Create a new OpenShift release
Example usage
2.8.1.38. oc adm taint Copiar enlaceEnlace copiado en el portapapeles!
Update the taints on one or more nodes
Example usage
2.8.1.39. oc adm top images Copiar enlaceEnlace copiado en el portapapeles!
Show usage statistics for images
Example usage
Show usage statistics for images
# Show usage statistics for images
oc adm top images
2.8.1.40. oc adm top imagestreams Copiar enlaceEnlace copiado en el portapapeles!
Show usage statistics for image streams
Example usage
Show usage statistics for image streams
# Show usage statistics for image streams
oc adm top imagestreams
2.8.1.41. oc adm top node Copiar enlaceEnlace copiado en el portapapeles!
Display resource (CPU/memory) usage of nodes
Example usage
Show metrics for all nodes
# Show metrics for all nodes
oc adm top node
# Show metrics for a given node
oc adm top node NODE_NAME
2.8.1.42. oc adm top pod Copiar enlaceEnlace copiado en el portapapeles!
Display resource (CPU/memory) usage of pods
Example usage
2.8.1.43. oc adm uncordon Copiar enlaceEnlace copiado en el portapapeles!
Mark node as schedulable
Example usage
Mark node "foo" as schedulable
# Mark node "foo" as schedulable
oc adm uncordon foo
2.8.1.44. oc adm upgrade Copiar enlaceEnlace copiado en el portapapeles!
Upgrade a cluster or adjust the upgrade channel
Example usage
Review the available cluster updates
# Review the available cluster updates
oc adm upgrade
# Update to the latest version
oc adm upgrade --to-latest=true
2.8.1.45. oc adm verify-image-signature Copiar enlaceEnlace copiado en el portapapeles!
Verify the image identity contained in the image signature
Example usage