MicroShift is Technology Preview software only.
For more information about the support scope of Red Hat Technology Preview software, see Technology Preview Support Scope.이 콘텐츠는 선택한 언어로 제공되지 않습니다.
CLI tools
Learning how to use the command-line tools for MicroShift
Abstract
Chapter 1. Red Hat build of MicroShift CLI tools introduction 링크 복사링크가 클립보드에 복사되었습니다!
You can use different command-line interface (CLI) tools to build, deploy, and manage Red Hat build of MicroShift clusters and workloads. With CLI tools, you can complete various administration and development operations from the terminal to manage deployments and interact with each component of the system.
CLI tools available for use with Red Hat build of MicroShift are the following:
-
Built-in
microshiftcommand types - Linux CLI tools
-
Kubernetes CLI (
kubectl) -
The OpenShift CLI (
oc) tool with an enabled subset of commands
Commands for multi-node deployments, projects, and developer tooling are not supported by Red Hat build of MicroShift.
Chapter 2. Getting started with the OpenShift CLI 링크 복사링크가 클립보드에 복사되었습니다!
To use the OpenShift CLI (oc) tool, you must download and install it separately from your MicroShift installation.
2.1. Installing the OpenShift CLI 링크 복사링크가 클립보드에 복사되었습니다!
You can install the OpenShift CLI (oc) either by downloading the binary or by using Homebrew.
2.1.1. Installing the OpenShift CLI by downloading the binary 링크 복사링크가 클립보드에 복사되었습니다!
You can install the OpenShift CLI (oc) to interact with Red Hat build of MicroShift 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 Red Hat build of MicroShift 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.
Red Hat build of MicroShift version numbering matches OpenShift Container Platform version numbering. Use the oc binary that matches your MicroShift version and has the appropriate RHEL compatibility.
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
ocbinary in a directory that is on yourPATH.To check your
PATH, execute the following command:echo $PATH
$ echo $PATHCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
After you install the OpenShift CLI, it is available using the
occommand: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.
Red Hat build of MicroShift version numbering matches OpenShift Container Platform version numbering. Use the oc binary that matches your MicroShift version and has the appropriate RHEL compatibility.
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
ocbinary to a directory that is on yourPATH.To check your
PATH, open the command prompt and execute the following command:path
C:\> pathCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
After you install the OpenShift CLI, it is available using the
occommand: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.
Red Hat build of MicroShift version numbering matches OpenShift Container Platform version numbering. Use the oc binary that matches your MicroShift version and has the appropriate RHEL compatibility.
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.
- Unpack and unzip the archive.
Move the
ocbinary to a directory on your PATH.To check your
PATH, open a terminal and execute the following command:echo $PATH
$ echo $PATHCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
After you install the OpenShift CLI, it is available using the
occommand:oc <command>
$ oc <command>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.1.2. Installing the OpenShift CLI by using Homebrew 링크 복사링크가 클립보드에 복사되었습니다!
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-cliCopy to Clipboard Copied! Toggle word wrap Toggle overflow
2.1.3. Installing the OpenShift CLI by using an RPM 링크 복사링크가 클립보드에 복사되었습니다!
For Red Hat Enterprise Linux (RHEL), you can install the OpenShift CLI (oc) as an RPM if you have an active Red Hat build of MicroShift 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 {op-system-base} 9 by downloading the binary.
Prerequisites
- Must have root or sudo privileges.
Procedure
Register with Red Hat Subscription Manager:
subscription-manager register
# subscription-manager registerCopy to Clipboard Copied! Toggle word wrap Toggle overflow Pull the latest subscription data:
subscription-manager refresh
# subscription-manager refreshCopy 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 Red Hat build of MicroShift 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 Red Hat build of MicroShift 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-clientspackage:yum install openshift-clients
# yum install openshift-clientsCopy to Clipboard Copied! Toggle word wrap Toggle overflow
After you install the CLI, it is available using the oc command:
oc <command>
$ oc <command>
Chapter 3. Configuring the OpenShift CLI 링크 복사링크가 클립보드에 복사되었습니다!
Configure oc based on your preferences for working with it.
3.1. Enabling tab completion 링크 복사링크가 클립보드에 복사되었습니다!
You can enable tab completion for the Bash or Zsh shells.
3.1.1. Enabling tab completion for Bash 링크 복사링크가 클립보드에 복사되었습니다!
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-completioninstalled.
Procedure
Save the Bash completion code to a file:
oc completion bash > oc_bash_completion
$ oc completion bash > oc_bash_completionCopy 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
.bashrcfile instead.
Tab completion is enabled when you open a new terminal.
3.1.2. Enabling tab completion for Zsh 링크 복사링크가 클립보드에 복사되었습니다!
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
octo your.zshrcfile, run the following command:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Tab completion is enabled when you open a new terminal.
Chapter 4. Using the oc tool 링크 복사링크가 클립보드에 복사되었습니다!
The optional OpenShift CLI (oc) tool provides a subset of oc commands for Red Hat build of MicroShift deployments. Using oc is convenient if you are familiar with OpenShift Container Platform and Kubernetes.
4.1. About the OpenShift CLI 링크 복사링크가 클립보드에 복사되었습니다!
With the OpenShift command-line interface (CLI), the oc command, you can deploy and manage Red Hat build of MicroShift projects from a terminal. The CLI oc tool is ideal in the following situations:
- Working directly with project source code
- Scripting Red Hat build of MicroShift operations
- Managing projects while restricted by bandwidth resources
A kubeconfig file must exist for the cluster to be accessible. The values are applied from built-in default values or a config.yaml, if one was created.
4.2. Using the OpenShift CLI in Red Hat build of MicroShift 링크 복사링크가 클립보드에 복사되었습니다!
Review the following sections to learn how to complete common tasks in Red Hat build of MicroShift using the oc CLI.
4.2.1. Viewing pods 링크 복사링크가 클립보드에 복사되었습니다!
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>
4.2.2. Viewing pod logs 링크 복사링크가 클립보드에 복사되었습니다!
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
4.2.3. Listing supported API resources 링크 복사링크가 클립보드에 복사되었습니다!
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
...
4.3. Getting help 링크 복사링크가 클립보드에 복사되었습니다!
You can get help with CLI commands and Red Hat build of MicroShift resources in the following ways.
Use
oc help --flagto get information about a specific CLI command:Example: Get help for the
oc createcommandoc create --help
$ oc create --helpCopy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Use the
oc explaincommand to view the description and fields for a particular resource:Example: View documentation for the
Podresourceoc explain pods
$ oc explain podsCopy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
4.4. oc command errors in Red Hat build of MicroShift 링크 복사링크가 클립보드에 복사되었습니다!
Not all OpenShift CLI (oc) tool commands are relevant for Red Hat build of MicroShift deployments. When you use oc to make a request call against an unsupported API, the oc binary usually generates an error message about a resource that cannot be found.
Example output
For example, when the following new-project command is run:
oc new-project test
$ oc new-project test
The following error message can be generated:
Error from server (NotFound): the server could not find the requested resource (get projectrequests.project.openshift.io)
Error from server (NotFound): the server could not find the requested resource (get projectrequests.project.openshift.io)
And when the get projects command is run, another error can be generated as follows:
oc get projects error: the server doesn't have a resource type "projects"
$ oc get projects
error: the server doesn't have a resource type "projects"
Chapter 5. Using oc and kubectl commands 링크 복사링크가 클립보드에 복사되었습니다!
The Kubernetes command-line interface (CLI), kubectl, can be used to run commands against a Kubernetes cluster. Because Red Hat build of MicroShift is a certified Kubernetes distribution, you can use the supported kubectl CLI tool that ships with Red Hat build of MicroShift, or you can gain extended functionality by using the oc CLI tool.
5.1. The kubectl CLI tool 링크 복사링크가 클립보드에 복사되었습니다!
You can use the kubectl CLI tool to interact with Kubernetes primitives on your Red Hat build of MicroShift cluster. You can also use existing kubectl workflows and scripts for new Red Hat build of MicroShift users coming from another Kubernetes environment, or for those who prefer to use the kubectl CLI.
The kubectl CLI tool is included in the archive if you download the oc CLI tool.
For more information, read the Kubernetes CLI tool documentation.
5.2. The oc CLI tool 링크 복사링크가 클립보드에 복사되었습니다!
The oc CLI tool offers the same capabilities as the kubectl CLI tool, but it extends to natively support additional Red Hat build of MicroShift features, including:
Route resource
The
Routeresource object is specific to Red Hat build of MicroShift distributions, and builds upon standard Kubernetes primitives.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.
If you installed an earlier version of the oc CLI tool, you cannot use it to complete all of the commands in Red Hat build of MicroShift 4.13. If you want the latest features, you must download and install the latest version of the oc CLI tool corresponding to your Red Hat build of MicroShift 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.
Chapter 6. OpenShift CLI command reference 링크 복사링크가 클립보드에 복사되었습니다!
Descriptions and example commands for OpenShift CLI (oc) commands are included in this reference document. You must have cluster-admin or equivalent permissions to use these commands. To list administrator commands and information about them, use the following commands:
Enter the
oc adm -hcommand to list all administrator commands:Command syntax
oc adm -h
$ oc adm -hCopy to Clipboard Copied! Toggle word wrap Toggle overflow Enter the
oc <command> --helpcommand to get additional details for a specific command:Command syntax
oc <command> --help
$ oc <command> --helpCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Using oc <command> --help lists details for any oc command. Not all oc commands apply to using Red Hat build of MicroShift.
6.1. OpenShift CLI (oc) developer commands 링크 복사링크가 클립보드에 복사되었습니다!
6.1.1. oc annotate 링크 복사링크가 클립보드에 복사되었습니다!
Update the annotations on a resource
Example usage
6.1.2. oc api-resources 링크 복사링크가 클립보드에 복사되었습니다!
Print the supported API resources on the server
Example usage
6.1.3. oc api-versions 링크 복사링크가 클립보드에 복사되었습니다!
Print the supported API versions on the server, in the form of "group/version"
Example usage
# Print the supported API versions oc api-versions
# Print the supported API versions
oc api-versions
6.1.4. oc apply 링크 복사링크가 클립보드에 복사되었습니다!
Apply a configuration to a resource by file name or stdin
Example usage
6.1.5. oc apply edit-last-applied 링크 복사링크가 클립보드에 복사되었습니다!
Edit latest last-applied-configuration annotations of a resource/object
Example usage
# 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
# 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
6.1.6. oc apply set-last-applied 링크 복사링크가 클립보드에 복사되었습니다!
Set the last-applied-configuration annotation on a live object to match the contents of a file
Example usage
6.1.7. oc apply view-last-applied 링크 복사링크가 클립보드에 복사되었습니다!
View the latest last-applied-configuration annotations of a resource/object
Example usage
# 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
# 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
6.1.8. oc attach 링크 복사링크가 클립보드에 복사되었습니다!
Attach to a running container
Example usage
6.1.9. oc auth can-i 링크 복사링크가 클립보드에 복사되었습니다!
Check whether an action is allowed
Example usage
6.1.10. oc auth reconcile 링크 복사링크가 클립보드에 복사되었습니다!
Reconciles rules for RBAC role, role binding, cluster role, and cluster role binding objects
Example usage
# Reconcile RBAC resources from a file oc auth reconcile -f my-rbac-rules.yaml
# Reconcile RBAC resources from a file
oc auth reconcile -f my-rbac-rules.yaml
6.1.11. oc cluster-info 링크 복사링크가 클립보드에 복사되었습니다!
Display cluster information
Example usage
# Print the address of the control plane and cluster services oc cluster-info
# Print the address of the control plane and cluster services
oc cluster-info
6.1.12. oc cluster-info dump 링크 복사링크가 클립보드에 복사되었습니다!
Dump relevant information for debugging and diagnosis
Example usage
6.1.13. oc completion 링크 복사링크가 클립보드에 복사되었습니다!
Output shell completion code for the specified shell (bash, zsh, fish, or powershell)
Example usage
6.1.14. oc config current-context 링크 복사링크가 클립보드에 복사되었습니다!
Display the current-context
Example usage
# Display the current-context oc config current-context
# Display the current-context
oc config current-context
6.1.15. oc config delete-cluster 링크 복사링크가 클립보드에 복사되었습니다!
Delete the specified cluster from the kubeconfig
Example usage
# Delete the minikube cluster oc config delete-cluster minikube
# Delete the minikube cluster
oc config delete-cluster minikube
6.1.16. oc config delete-context 링크 복사링크가 클립보드에 복사되었습니다!
Delete the specified context from the kubeconfig
Example usage
# Delete the context for the minikube cluster oc config delete-context minikube
# Delete the context for the minikube cluster
oc config delete-context minikube
6.1.17. oc config delete-user 링크 복사링크가 클립보드에 복사되었습니다!
Delete the specified user from the kubeconfig
Example usage
# Delete the minikube user oc config delete-user minikube
# Delete the minikube user
oc config delete-user minikube
6.1.18. oc config get-clusters 링크 복사링크가 클립보드에 복사되었습니다!
Display clusters defined in the kubeconfig
Example usage
# List the clusters that oc knows about oc config get-clusters
# List the clusters that oc knows about
oc config get-clusters
6.1.19. oc config get-contexts 링크 복사링크가 클립보드에 복사되었습니다!
Describe one or many contexts
Example usage
# 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
# 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
6.1.20. oc config get-users 링크 복사링크가 클립보드에 복사되었습니다!
Display users defined in the kubeconfig
Example usage
# List the users that oc knows about oc config get-users
# List the users that oc knows about
oc config get-users
6.1.21. oc config rename-context 링크 복사링크가 클립보드에 복사되었습니다!
Rename a context from the kubeconfig file
Example usage
# Rename the context 'old-name' to 'new-name' in your kubeconfig file oc config rename-context old-name new-name
# Rename the context 'old-name' to 'new-name' in your kubeconfig file
oc config rename-context old-name new-name
6.1.22. oc config set 링크 복사링크가 클립보드에 복사되었습니다!
Set an individual value in a kubeconfig file
Example usage
6.1.23. oc config set-cluster 링크 복사링크가 클립보드에 복사되었습니다!
Set a cluster entry in kubeconfig
Example usage
6.1.24. oc config set-context 링크 복사링크가 클립보드에 복사되었습니다!
Set a context entry in kubeconfig
Example usage
# Set the user field on the gce context entry without touching other values oc config set-context gce --user=cluster-admin
# Set the user field on the gce context entry without touching other values
oc config set-context gce --user=cluster-admin
6.1.25. oc config set-credentials 링크 복사링크가 클립보드에 복사되었습니다!
Set a user entry in kubeconfig
Example usage
6.1.26. oc config unset 링크 복사링크가 클립보드에 복사되었습니다!
Unset an individual value in a kubeconfig file
Example usage
# Unset the current-context oc config unset current-context # Unset namespace in foo context oc config unset contexts.foo.namespace
# Unset the current-context
oc config unset current-context
# Unset namespace in foo context
oc config unset contexts.foo.namespace
6.1.27. oc config use-context 링크 복사링크가 클립보드에 복사되었습니다!
Set the current-context in a kubeconfig file
Example usage
# Use the context for the minikube cluster oc config use-context minikube
# Use the context for the minikube cluster
oc config use-context minikube
6.1.28. oc config view 링크 복사링크가 클립보드에 복사되었습니다!
Display merged kubeconfig settings or a specified kubeconfig file
Example usage
6.1.29. oc cp 링크 복사링크가 클립보드에 복사되었습니다!
Copy files and directories to and from containers
Example usage
6.1.30. oc create 링크 복사링크가 클립보드에 복사되었습니다!
Create a resource from a file or from stdin
Example usage
6.1.31. oc create clusterrole 링크 복사링크가 클립보드에 복사되었습니다!
Create a cluster role
Example usage
6.1.32. oc create clusterrolebinding 링크 복사링크가 클립보드에 복사되었습니다!
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 oc create clusterrolebinding cluster-admin --clusterrole=cluster-admin --user=user1 --user=user2 --group=group1
# 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
6.1.33. oc create configmap 링크 복사링크가 클립보드에 복사되었습니다!
Create a config map from a local file, directory or literal value
Example usage
6.1.34. oc create cronjob 링크 복사링크가 클립보드에 복사되었습니다!
Create a cron job with the specified name
Example usage
# 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
# 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
6.1.35. oc create deployment 링크 복사링크가 클립보드에 복사되었습니다!
Create a deployment with the specified name
Example usage
6.1.36. oc create ingress 링크 복사링크가 클립보드에 복사되었습니다!
Create an ingress with the specified name
Example usage
6.1.37. oc create job 링크 복사링크가 클립보드에 복사되었습니다!
Create a job with the specified name
Example usage
6.1.38. oc create namespace 링크 복사링크가 클립보드에 복사되었습니다!
Create a namespace with the specified name
Example usage
# Create a new namespace named my-namespace oc create namespace my-namespace
# Create a new namespace named my-namespace
oc create namespace my-namespace
6.1.39. oc create poddisruptionbudget 링크 복사링크가 클립보드에 복사되었습니다!
Create a pod disruption budget with the specified name
Example usage
6.1.40. oc create priorityclass 링크 복사링크가 클립보드에 복사되었습니다!
Create a priority class with the specified name
Example usage
6.1.41. oc create quota 링크 복사링크가 클립보드에 복사되었습니다!
Create a quota with the specified name
Example usage
# 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
# 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
6.1.42. oc create role 링크 복사링크가 클립보드에 복사되었습니다!
Create a role with single rule
Example usage
6.1.43. oc create rolebinding 링크 복사링크가 클립보드에 복사되었습니다!
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 oc create rolebinding admin --clusterrole=admin --user=user1 --user=user2 --group=group1
# 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
6.1.44. oc create route edge 링크 복사링크가 클립보드에 복사되었습니다!
Create a route that uses edge TLS termination
Example usage
6.1.45. oc create route passthrough 링크 복사링크가 클립보드에 복사되었습니다!
Create a route that uses passthrough TLS termination
Example usage
6.1.46. oc create route reencrypt 링크 복사링크가 클립보드에 복사되었습니다!
Create a route that uses reencrypt TLS termination
Example usage
6.1.47. oc create secret docker-registry 링크 복사링크가 클립보드에 복사되었습니다!
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: 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
# 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
6.1.48. oc create secret generic 링크 복사링크가 클립보드에 복사되었습니다!
Create a secret from a local file, directory, or literal value
Example usage
6.1.49. oc create secret tls 링크 복사링크가 클립보드에 복사되었습니다!
Create a TLS secret
Example usage
# 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
# 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
6.1.50. oc create service clusterip 링크 복사링크가 클립보드에 복사되었습니다!
Create a ClusterIP service
Example usage
# 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"
# 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"
6.1.51. oc create service externalname 링크 복사링크가 클립보드에 복사되었습니다!
Create an ExternalName service
Example usage
# Create a new ExternalName service named my-ns oc create service externalname my-ns --external-name bar.com
# Create a new ExternalName service named my-ns
oc create service externalname my-ns --external-name bar.com
6.1.52. oc create service loadbalancer 링크 복사링크가 클립보드에 복사되었습니다!
Create a LoadBalancer service
Example usage
# Create a new LoadBalancer service named my-lbs oc create service loadbalancer my-lbs --tcp=5678:8080
# Create a new LoadBalancer service named my-lbs
oc create service loadbalancer my-lbs --tcp=5678:8080
6.1.53. oc create service nodeport 링크 복사링크가 클립보드에 복사되었습니다!
Create a NodePort service
Example usage
# Create a new NodePort service named my-ns oc create service nodeport my-ns --tcp=5678:8080
# Create a new NodePort service named my-ns
oc create service nodeport my-ns --tcp=5678:8080
6.1.54. oc create serviceaccount 링크 복사링크가 클립보드에 복사되었습니다!
Create a service account with the specified name
Example usage
# Create a new service account named my-service-account oc create serviceaccount my-service-account
# Create a new service account named my-service-account
oc create serviceaccount my-service-account
6.1.55. oc create token 링크 복사링크가 클립보드에 복사되었습니다!
Request a service account token
Example usage
6.1.56. oc debug 링크 복사링크가 클립보드에 복사되었습니다!
Launch a new instance of a pod for debugging
Example usage
6.1.57. oc delete 링크 복사링크가 클립보드에 복사되었습니다!
Delete resources by file names, stdin, resources and names, or by resources and label selector
Example usage
6.1.58. oc describe 링크 복사링크가 클립보드에 복사되었습니다!
Show details of a specific resource or group of resources
Example usage
6.1.59. oc diff 링크 복사링크가 클립보드에 복사되었습니다!
Diff the live version against a would-be applied version
Example usage
# Diff resources included in pod.json oc diff -f pod.json # Diff file read from stdin cat service.yaml | oc diff -f -
# Diff resources included in pod.json
oc diff -f pod.json
# Diff file read from stdin
cat service.yaml | oc diff -f -
6.1.60. oc edit 링크 복사링크가 클립보드에 복사되었습니다!
Edit a resource on the server
Example usage
6.1.61. oc events 링크 복사링크가 클립보드에 복사되었습니다!
List events
Example usage
6.1.62. oc exec 링크 복사링크가 클립보드에 복사되었습니다!
Execute a command in a container
Example usage
6.1.63. oc explain 링크 복사링크가 클립보드에 복사되었습니다!
Get documentation for a resource
Example usage
# 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
# 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
6.1.64. oc expose 링크 복사링크가 클립보드에 복사되었습니다!
Expose a replicated application as a service or route
Example usage
6.1.65. oc extract 링크 복사링크가 클립보드에 복사되었습니다!
Extract secrets or config maps to disk
Example usage
6.1.66. oc get 링크 복사링크가 클립보드에 복사되었습니다!
Display one or many resources
Example usage
6.1.67. oc image append 링크 복사링크가 클립보드에 복사되었습니다!
Add layers to images and push them to a registry
Example usage
6.1.68. oc image extract 링크 복사링크가 클립보드에 복사되었습니다!
Copy files from an image to the file system
Example usage
6.1.69. oc image info 링크 복사링크가 클립보드에 복사되었습니다!
Display information about an image
Example usage
6.1.70. oc image mirror 링크 복사링크가 클립보드에 복사되었습니다!
Mirror images from one repository to another
Example usage
6.1.71. oc kustomize 링크 복사링크가 클립보드에 복사되었습니다!
Build a kustomization target from a directory or URL.
Example usage
6.1.72. oc label 링크 복사링크가 클립보드에 복사되었습니다!
Update the labels on a resource
Example usage
6.1.73. oc logs 링크 복사링크가 클립보드에 복사되었습니다!
Print the logs for a container in a pod
Example usage
6.1.74. oc observe 링크 복사링크가 클립보드에 복사되었습니다!
Observe changes to resources and react to them (experimental)
Example usage
6.1.75. oc patch 링크 복사링크가 클립보드에 복사되었습니다!
Update fields of a resource
Example usage
6.1.76. oc plugin list 링크 복사링크가 클립보드에 복사되었습니다!
List all visible plugin executables on a user’s PATH
Example usage
# List all available plugins oc plugin list
# List all available plugins
oc plugin list
6.1.77. oc policy add-role-to-user 링크 복사링크가 클립보드에 복사되었습니다!
Add a role to users or service accounts for the current project
Example usage
# 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
# 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
6.1.78. oc policy scc-review 링크 복사링크가 클립보드에 복사되었습니다!
Check which service account can create a pod
Example usage
6.1.79. oc policy scc-subject-review 링크 복사링크가 클립보드에 복사되었습니다!
Check whether a user or a service account can create a pod
Example usage
6.1.80. oc port-forward 링크 복사링크가 클립보드에 복사되었습니다!
Forward one or more local ports to a pod
Example usage
6.1.81. oc proxy 링크 복사링크가 클립보드에 복사되었습니다!
Run a proxy to the Kubernetes API server
Example usage
6.1.82. oc rollback 링크 복사링크가 클립보드에 복사되었습니다!
Revert part of an application back to a previous deployment
Example usage
6.1.83. oc rollout cancel 링크 복사링크가 클립보드에 복사되었습니다!
Cancel the in-progress deployment
Example usage
# Cancel the in-progress deployment based on 'nginx' oc rollout cancel dc/nginx
# Cancel the in-progress deployment based on 'nginx'
oc rollout cancel dc/nginx
6.1.84. oc rollout history 링크 복사링크가 클립보드에 복사되었습니다!
View rollout history
Example usage
# 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
# 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
6.1.85. oc rollout latest 링크 복사링크가 클립보드에 복사되었습니다!
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 oc rollout latest dc/nginx # Print the rolled out deployment config oc rollout latest dc/nginx -o json
# 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
6.1.86. oc rollout pause 링크 복사링크가 클립보드에 복사되었습니다!
Mark the provided resource as paused
Example usage
# 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
# 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
6.1.87. oc rollout restart 링크 복사링크가 클립보드에 복사되었습니다!
Restart a resource
Example usage
6.1.88. oc rollout resume 링크 복사링크가 클립보드에 복사되었습니다!
Resume a paused resource
Example usage
# Resume an already paused deployment oc rollout resume dc/nginx
# Resume an already paused deployment
oc rollout resume dc/nginx
6.1.89. oc rollout retry 링크 복사링크가 클립보드에 복사되었습니다!
Retry the latest failed rollout
Example usage
# 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
# 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
6.1.90. oc rollout status 링크 복사링크가 클립보드에 복사되었습니다!
Show the status of the rollout
Example usage
# Watch the status of the latest rollout oc rollout status dc/nginx
# Watch the status of the latest rollout
oc rollout status dc/nginx
6.1.91. oc rollout undo 링크 복사링크가 클립보드에 복사되었습니다!
Undo a previous rollout
Example usage
# 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
# 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
6.1.92. oc rsh 링크 복사링크가 클립보드에 복사되었습니다!
Start a shell session in a container
Example usage
6.1.93. oc rsync 링크 복사링크가 클립보드에 복사되었습니다!
Copy files between a local file system and a pod
Example usage
# 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
# 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
6.1.94. oc run 링크 복사링크가 클립보드에 복사되었습니다!
Run a particular image on the cluster
Example usage
6.1.95. oc scale 링크 복사링크가 클립보드에 복사되었습니다!
Set a new size for a deployment, replica set, or replication controller
Example usage
6.1.96. oc secrets link 링크 복사링크가 클립보드에 복사되었습니다!
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 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
# 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
6.1.97. oc secrets unlink 링크 복사링크가 클립보드에 복사되었습니다!
Detach secrets from a service account
Example usage
# Unlink a secret currently associated with a service account oc secrets unlink serviceaccount-name secret-name another-secret-name ...
# Unlink a secret currently associated with a service account
oc secrets unlink serviceaccount-name secret-name another-secret-name ...
6.1.98. oc set data 링크 복사링크가 클립보드에 복사되었습니다!
Update the data within a config map or secret
Example usage
6.1.99. oc set env 링크 복사링크가 클립보드에 복사되었습니다!
Update environment variables on a pod template
Example usage
6.1.100. oc set image 링크 복사링크가 클립보드에 복사되었습니다!
Update the image of a pod template
Example usage
6.1.101. oc set image-lookup 링크 복사링크가 클립보드에 복사되었습니다!
Change how images are resolved when deploying applications
Example usage
6.1.102. oc set probe 링크 복사링크가 클립보드에 복사되었습니다!
Update a probe on a pod template
Example usage
6.1.103. oc set resources 링크 복사링크가 클립보드에 복사되었습니다!
Update resource requests/limits on objects with pod templates
Example usage
6.1.104. oc set route-backends 링크 복사링크가 클립보드에 복사되었습니다!
Update the backends for a route
Example usage
6.1.105. oc set selector 링크 복사링크가 클립보드에 복사되었습니다!
Set the selector on a resource
Example usage
# 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 -
# 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 -
6.1.106. oc set serviceaccount 링크 복사링크가 클립보드에 복사되었습니다!
Update the service account of a resource
Example usage
# 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
# 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
6.1.107. oc set subject 링크 복사링크가 클립보드에 복사되었습니다!
Update the user, group, or service account in a role binding or cluster role binding
Example usage
6.1.108. oc set volumes 링크 복사링크가 클립보드에 복사되었습니다!
Update volumes on a pod template
Example usage
6.1.109. oc tag 링크 복사링크가 클립보드에 복사되었습니다!
Tag existing images into image streams
Example usage
6.1.110. oc version 링크 복사링크가 클립보드에 복사되었습니다!
Print the client and server version information
Example usage
6.1.111. oc wait 링크 복사링크가 클립보드에 복사되었습니다!
Experimental: Wait for a specific condition on one or many resources
Example usage
6.2. OpenShift CLI (oc) administrator commands 링크 복사링크가 클립보드에 복사되었습니다!
6.2.1. oc adm catalog mirror 링크 복사링크가 클립보드에 복사되었습니다!
Mirror an operator-registry catalog
Example usage
6.2.2. oc adm inspect 링크 복사링크가 클립보드에 복사되었습니다!
Collect debugging data for a given resource .Example usage
6.2.3. oc adm migrate icsp 링크 복사링크가 클립보드에 복사되었습니다!
Update imagecontentsourcepolicy file(s) to imagedigestmirrorset file(s).
Example usage
update the imagecontentsourcepolicy.yaml to new imagedigestmirrorset file under directory mydir oc adm migrate icsp imagecontentsourcepolicy.yaml --dest-dir mydir
# update the imagecontentsourcepolicy.yaml to new imagedigestmirrorset file under directory mydir
oc adm migrate icsp imagecontentsourcepolicy.yaml --dest-dir mydir
Display and filter node logs
Example usage
6.2.4. oc adm release extract 링크 복사링크가 클립보드에 복사되었습니다!
Extract the contents of an update payload to disk
Example usage
6.2.5. oc adm release info 링크 복사링크가 클립보드에 복사되었습니다!
Display information about a release
Example usage
6.2.6. oc adm release mirror 링크 복사링크가 클립보드에 복사되었습니다!
Mirror a release to a different image registry location
Example usage
6.2.7. oc adm taint 링크 복사링크가 클립보드에 복사되었습니다!
Update the taints on one or more nodes
Example usage
6.2.8. oc adm top pod 링크 복사링크가 클립보드에 복사되었습니다!
Display resource (CPU/memory) usage of pods
Example usage