CLI ツール
Red Hat OpenShift Service on AWS コマンドラインツールの使用方法
概要
第1章 Red Hat OpenShift Service on AWS CLI ツールの概要 リンクのコピーリンクがクリップボードにコピーされました!
ユーザーは、Red Hat OpenShift Service on AWS での作業中に、次のようなさまざまな操作を実行します。
- クラスターの管理
- アプリケーションのビルド、デプロイ、および管理
- デプロイメントプロセスの管理
- Operator カタログの作成と保守
Red Hat OpenShift Service on AWS は、コマンドラインインターフェイス (CLI) ツール群を備えており、ユーザーがターミナルからさまざまな管理および開発操作を実行できるようにすることで、上記のタスクを簡素化します。これらのツールでは、アプリケーションの管理だけでなく、システムの各コンポーネントを操作する簡単なコマンドを利用できます。
1.1. CLI ツールのリスト リンクのコピーリンクがクリップボードにコピーされました!
Red Hat OpenShift Service on AWS では、次の CLI ツール群を利用できます。
-
OpenShift CLI (
oc): これは、Red Hat OpenShift Service on AWS ユーザーが最もよく使用する CLI ツールです。クラスター管理者と開発者の両方が、ターミナルを使用して Red Hat OpenShift Service on AWS 全体にわたるエンドツーエンドの操作を実行するのに役立ちます。Web コンソールとは異なり、ユーザーはコマンドスクリプトを使用してプロジェクトのソースコードを直接操作できます。 -
Knative CLI (kn): (
kn) CLI ツールは、Knative Serving や Eventing などの OpenShift サーバーレスコンポーネントの操作に使用できるシンプルで直感的なターミナルコマンドを提供します。 -
Pipelines CLI (tkn): OpenShift Pipelines は、Red Hat OpenShift Service on AWS の継続的インテグレーションおよび継続的デリバリー (CI/CD) ソリューションであり、内部で Tekton を使用します。
tknCLI ツールには、シンプルで直感的なコマンドが同梱されており、ターミナルを使用して OpenShift パイプラインを操作できます。 -
opm CLI:
opmCLI ツールは、Operator 開発者とクラスター管理者がターミナルから Operator のカタログを作成および管理するのに役立ちます。 -
ROSA CLI (
rosa):rosaCLI は、Red Hat OpenShift Service on AWS クラスターおよびリソースを作成、更新、管理、削除するために使用します。
第2章 OpenShift CLI (oc) リンクのコピーリンクがクリップボードにコピーされました!
2.1. OpenShift CLI のスタートガイド リンクのコピーリンクがクリップボードにコピーされました!
2.1.1. OpenShift CLI について リンクのコピーリンクがクリップボードにコピーされました!
OpenShift CLI (oc) を使用すると、ターミナルからアプリケーションを作成し、Red Hat OpenShift Service on AWS プロジェクトを管理できます。OpenShift CLI は以下の状況に適しています。
- プロジェクトのソースコードを直接操作する。
- Red Hat OpenShift Service on AWS の操作のスクリプト化
- 帯域幅リソースが制限されており、Web コンソールが利用できない状況でプロジェクトを管理する。
2.1.2. OpenShift CLI のインストール リンクのコピーリンクがクリップボードにコピーされました!
OpenShift CLI (oc) をインストールするには、バイナリーをダウンロードするか、RPM を使用します。
2.1.2.1. OpenShift CLI のインストール リンクのコピーリンクがクリップボードにコピーされました!
OpenShift CLI (oc) をインストールすると、コマンドラインインターフェイスから Red Hat OpenShift Service on AWS を操作できます。oc は Linux、Windows、または macOS にインストールできます。
以前のバージョンの oc をインストールしている場合、それを使用して Red Hat OpenShift Service on AWS のすべてのコマンドを完了することはできません。
新しいバージョンの oc をダウンロードしてインストールしてください。
2.1.2.1.1. Linux への OpenShift CLI のインストール リンクのコピーリンクがクリップボードにコピーされました!
以下の手順を使用して、OpenShift CLI (oc) バイナリーを Linux にインストールできます。
手順
- Red Hat カスタマーポータルの Download OpenShift Container Platform ページに移動します。
- Product Variant リストからアーキテクチャーを選択します。
- Version リストから適切なバージョンを選択します。
- OpenShift v4 Linux Client エントリーの横にある Download Now をクリックして、ファイルを保存します。
アーカイブを展開します。
$ tar xvf <file>ocバイナリーを、PATHにあるディレクトリーに配置します。PATHを確認するには、以下のコマンドを実行します。$ echo $PATH
検証
OpenShift CLI のインストール後に、
ocコマンドを使用して利用できます。$ oc <command>
2.1.2.1.2. Windows への OpenShift CLI のインストール リンクのコピーリンクがクリップボードにコピーされました!
以下の手順を使用して、OpenShift CLI (oc) バイナリーを Windows にインストールできます。
手順
- Red Hat カスタマーポータルの Download OpenShift Container Platform ページに移動します。
- Version リストから適切なバージョンを選択します。
- OpenShift v4 Windows Client エントリーの横にある Download Now をクリックして、ファイルを保存します。
- ZIP プログラムでアーカイブを展開します。
ocバイナリーを、PATHにあるディレクトリーに移動します。PATHを確認するには、コマンドプロンプトを開いて以下のコマンドを実行します。C:\> path
検証
OpenShift CLI のインストール後に、
ocコマンドを使用して利用できます。C:\> oc <command>
2.1.2.1.3. macOS への OpenShift CLI のインストール リンクのコピーリンクがクリップボードにコピーされました!
以下の手順を使用して、OpenShift CLI (oc) バイナリーを macOS にインストールできます。
手順
- Red Hat カスタマーポータルの Download OpenShift Container Platform に移動します。
- バージョン ドロップダウンリストから適切なバージョンを選択します。
- OpenShift v4 macOS Client エントリーの横にある Download Now をクリックして、ファイルを保存します。
- アーカイブを展開し、解凍します。
ocバイナリーをパスにあるディレクトリーに移動します。PATHを確認するには、ターミナルを開き、以下のコマンドを実行します。$ echo $PATH
検証
ocコマンドを使用してインストールを確認します。$ oc <command>
2.1.2.2. Web コンソールを使用した OpenShift CLI のインストール リンクのコピーリンクがクリップボードにコピーされました!
Web コンソールから、Red Hat OpenShift Service on AWS クラスターを操作するための OpenShift CLI (oc) をインストールできます。oc は Linux、Windows、または macOS にインストールできます。
以前のバージョンの oc をインストールしている場合、それを使用して Red Hat OpenShift Service on AWS のすべてのコマンドを完了することはできません。新しいバージョンの oc をダウンロードしてインストールしてください。
2.1.2.2.1. Web コンソールを使用した Linux への OpenShift CLI のインストール リンクのコピーリンクがクリップボードにコピーされました!
以下の手順を使用して、OpenShift CLI (oc) バイナリーを Linux にインストールできます。
手順
Web コンソールで ? をクリックします。
コマンドラインツール をクリックします。
-
Linux プラットフォームに適した
ocbinary を選択してから、Download oc for Linux をクリックします。 - ファイルを保存します。
アーカイブを展開します。
$ tar xvf <file>ocバイナリーを、PATHにあるディレクトリーに移動します。PATHを確認するには、以下のコマンドを実行します。$ echo $PATH
OpenShift CLI のインストール後に、oc コマンドを使用して利用できます。
$ oc <command>
2.1.2.2.2. Web コンソールを使用した Windows への OpenShift CLI のインストール リンクのコピーリンクがクリップボードにコピーされました!
以下の手順を使用して、OpenShift CLI (oc) バイナリーを Windows にインストールできます。
手順
Web コンソールで ? をクリックします。
コマンドラインツール をクリックします。
-
Windows プラットフォームの
ocバイナリーを選択してから、Download oc for Windows for x86_64 をクリックします。 - ファイルを保存します。
- ZIP プログラムでアーカイブを展開します。
ocバイナリーを、PATHにあるディレクトリーに移動します。PATHを確認するには、コマンドプロンプトを開いて以下のコマンドを実行します。C:\> path
OpenShift CLI のインストール後に、oc コマンドを使用して利用できます。
C:\> oc <command>
2.1.2.2.3. Web コンソールを使用した macOS への OpenShift CLI のインストール リンクのコピーリンクがクリップボードにコピーされました!
以下の手順を使用して、OpenShift CLI (oc) バイナリーを macOS にインストールできます。
手順
Web コンソールで ? をクリックします。
コマンドラインツール をクリックします。
macOS プラットフォームの
ocバイナリーを選択し、Download oc for Mac for x86_64 をクリックします。注記macOS arm64 の場合は、Download oc for Mac for ARM 64 をクリックします。
- ファイルを保存します。
- アーカイブを展開し、解凍します。
ocバイナリーをパスにあるディレクトリーに移動します。PATHを確認するには、ターミナルを開き、以下のコマンドを実行します。$ echo $PATH
OpenShift CLI のインストール後に、oc コマンドを使用して利用できます。
$ oc <command>
2.1.2.3. RPM を使用した OpenShift CLI のインストール リンクのコピーリンクがクリップボードにコピーされました!
Red Hat Enterprise Linux (RHEL) の場合、Red Hat アカウントにアクティブな Red Hat OpenShift Service on AWS サブスクリプションをお持ちであれば、OpenShift CLI (oc) を RPM としてインストールできます。
バイナリーをダウンロードして、RHEL 9 用の oc をインストールする必要があります。RPM パッケージを使用した oc のインストールは、Red Hat Enterprise Linux (RHEL) 9 ではサポートされていません。
前提条件
- root または sudo の権限がある。
手順
Red Hat Subscription Manager に登録します。
# subscription-manager register最新のサブスクリプションデータをプルします。
# subscription-manager refresh利用可能なサブスクリプションをリスト表示します。
# subscription-manager list --available --matches '*OpenShift*'直前のコマンドの出力で、Red Hat OpenShift Service on AWS サブスクリプションのプール ID を見つけ、そのサブスクリプションを登録されたシステムにアタッチします。
# subscription-manager attach --pool=<pool_id>Red Hat OpenShift Service on AWS 4 で必要なリポジトリーを有効にします。
# subscription-manager repos --enable="rhocp-4-for-rhel-8-x86_64-rpms"openshift-clientsパッケージをインストールします。# yum install openshift-clients
検証
-
ocコマンドを使用してインストールを確認します。
$ oc <command>
2.1.2.4. Homebrew を使用した OpenShift CLI のインストール リンクのコピーリンクがクリップボードにコピーされました!
macOS の場合は、Homebrew パッケージマネージャーを使用して OpenShift CLI (oc) をインストールできます。
前提条件
-
Homebrew (
brew) がインストールされている。
手順
以下のコマンドを実行して openshift-cli パッケージをインストールします。
$ brew install openshift-cli
検証
-
ocコマンドを使用してインストールを確認します。
$ oc <command>
2.1.3. OpenShift CLI へのログイン リンクのコピーリンクがクリップボードにコピーされました!
OpenShift CLI (oc) にログインしてクラスターにアクセスし、これを管理できます。
前提条件
- Red Hat OpenShift Service on AWS クラスターにアクセスできる。
-
OpenShift CLI (
oc) がインストールされている。
HTTP プロキシーサーバー上でのみアクセスできるクラスターにアクセスするには、HTTP_PROXY、HTTPS_PROXY および NO_PROXY 変数を設定できます。これらの環境変数は、クラスターとのすべての通信が HTTP プロキシーを経由するように oc CLI で使用されます。
認証ヘッダーは、HTTPS トランスポートを使用する場合にのみ送信されます。
手順
oc loginコマンドを入力し、ユーザー名を渡します。$ oc login -u user1プロンプトが表示されたら、必要な情報を入力します。
出力例
Server [https://localhost:8443]: https://openshift.example.com:64431 The server uses a certificate signed by an unknown authority. You can bypass the certificate check, but any data you send to the server could be intercepted by others. Use insecure connections? (y/n): y2 Authentication required for https://openshift.example.com:6443 (openshift) Username: user1 Password:3 Login successful. You don't have any projects. You can try to create a new project, by running oc new-project <projectname> Welcome! See 'oc help' to get started.
Web コンソールにログインしている場合には、トークンおよびサーバー情報を含む oc login コマンドを生成できます。コマンドを使用して、対話型プロンプトなしで OpenShift CLI (oc) にログインできます。コマンドを生成するには、Web コンソールの右上にあるユーザー名のドロップダウンメニューから Copy login command を選択します。
これで、プロジェクトを作成でき、クラスターを管理するための他のコマンドを実行することができます。
2.1.4. Web ブラウザーを使用した OpenShift CLI へのログイン リンクのコピーリンクがクリップボードにコピーされました!
Web ブラウザーを使用して OpenShift CLI (oc) にログインし、クラスターにアクセスして管理できます。これにより、ユーザーはアクセストークンをコマンドラインに挿入する必要がなくなります。
Web ブラウザー経由で CLI にログインすると、HTTPS ではなく HTTP を使用してローカルホスト上のサーバーが実行します。マルチユーザーワークステーションでは注意して使用してください。
前提条件
- Red Hat OpenShift Service on AWS クラスターへアクセスできること。
-
OpenShift CLI (
oc) がインストールされている。 - ブラウザーがインストールされている。
手順
--webフラグを指定してoc loginコマンドを入力します。$ oc login <cluster_url> --web1 - 1
- オプションで、サーバー URL とコールバックポートを指定できます。たとえば、
oc login <cluster_url> --web --callback-port 8280 localhost:8443です。
Web ブラウザーが自動的に開きます。表示されない場合は、コマンド出力内のリンクをクリックします。Red Hat OpenShift Service on AWS を指定しなかった場合、
ocが現在のoc設定ファイルで指定されているクラスターの Web コンソールを開こうとします。oc設定が存在しない場合、ocはサーバー URL を対話的に要求します。出力例
Opening login URL in the default browser: https://openshift.example.com Opening in existing browser session.- 複数の認証プロバイダーが使用できる場合は、提供されるオプションから選択します。
-
ユーザー名とパスワードをブラウザーの対応するフィールドに入力します。ログインすると、ブラウザーには
access token received successfully; please return to your terminalと表示されます。 CLI でログイン確認を確認します。
出力例
Login successful. You don't have any projects. You can try to create a new project, by running oc new-project <projectname>
Web コンソールのデフォルトは、前のセッションで使用されたプロファイルになります。管理者プロファイルと開発者プロファイルを切り替えるには、Red Hat OpenShift Service on AWS からログアウトし、キャッシュをクリアします。
これで、プロジェクトを作成でき、クラスターを管理するための他のコマンドを実行することができます。
2.1.5. OpenShift CLI の使用 リンクのコピーリンクがクリップボードにコピーされました!
以下のセクションで、CLI を使用して一般的なタスクを実行する方法を確認します。
2.1.5.1. プロジェクトの作成 リンクのコピーリンクがクリップボードにコピーされました!
新規プロジェクトを作成するには、oc new-project コマンドを使用します。
$ oc new-project my-project
出力例
Now using project "my-project" on server "https://openshift.example.com:6443".
2.1.5.2. 新しいアプリケーションの作成 リンクのコピーリンクがクリップボードにコピーされました!
新規アプリケーションを作成するには、oc new-app コマンドを使用します。
$ oc new-app https://github.com/sclorg/cakephp-ex
出力例
--> 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. Pod の表示 リンクのコピーリンクがクリップボードにコピーされました!
現在のプロジェクトの Pod を表示するには、oc get pods コマンドを使用します。
Pod 内で oc を実行し、namespace を指定しない場合は、Pod の namespace がデフォルトで使用されます。
$ oc get pods -o wide
出力例
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. Pod ログの表示 リンクのコピーリンクがクリップボードにコピーされました!
特定の Pod のログを表示するには、oc logs コマンドを使用します。
$ oc logs cakephp-ex-1-deploy
出力例
--> Scaling cakephp-ex-1 to 1
--> Success
2.1.5.5. 現在のプロジェクトの表示 リンクのコピーリンクがクリップボードにコピーされました!
現在のプロジェクトを表示するには、oc project コマンドを使用します。
$ oc project
出力例
Using project "my-project" on server "https://openshift.example.com:6443".
2.1.5.6. 現在のプロジェクトのステータスの表示 リンクのコピーリンクがクリップボードにコピーされました!
サービス、デプロイメント、およびビルド設定などの現在のプロジェクトに関する情報を表示するには、oc status コマンドを使用します。
$ oc status
出力例
In project my-project on server https://openshift.example.com:6443
svc/cakephp-ex - 172.30.236.80 ports 8080, 8443
dc/cakephp-ex deploys istag/cakephp-ex:latest <-
bc/cakephp-ex source builds https://github.com/sclorg/cakephp-ex on openshift/php:7.2
deployment #1 deployed 2 minutes ago - 1 pod
3 infos identified, use 'oc status --suggest' to see details.
2.1.5.7. サポートされる API のリソースのリスト表示 リンクのコピーリンクがクリップボードにコピーされました!
サーバー上でサポートされる API リソースのリストを表示するには、oc api-resources コマンドを使用します。
$ oc api-resources
出力例
NAME SHORTNAMES APIGROUP NAMESPACED KIND
bindings true Binding
componentstatuses cs false ComponentStatus
configmaps cm true ConfigMap
...
2.1.6. ヘルプの表示 リンクのコピーリンクがクリップボードにコピーされました!
CLI コマンドおよび Red Hat OpenShift Service on AWS リソースに関するヘルプを以下の方法で表示することができます。
利用可能なすべての CLI コマンドのリストおよび説明を表示するには、
oc helpを使用します。例: CLI に関する一般的なヘルプの表示
$ oc help出力例
OpenShift Client This client helps you develop, build, deploy, and run your applications on any OpenShift or Kubernetes compatible platform. It also includes the administrative commands for managing a cluster under the 'adm' subcommand. Usage: oc [flags] Basic Commands: login Log in to a server new-project Request a new project new-app Create a new application ...特定の CLI コマンドに関するヘルプを表示するには、
--helpフラグを使用します。例:
oc createコマンドに関するヘルプの表示$ oc create --help出力例
Create a resource by filename or stdin JSON and YAML formats are accepted. Usage: oc create -f FILENAME [flags] ...特定リソースに関する説明およびフィールドを表示するには、
oc explainコマンドを使用します。例:
Podリソースのドキュメントの表示$ oc explain pods出力例
KIND: Pod VERSION: v1 DESCRIPTION: Pod is a collection of containers that can run on a host. This resource is created by clients and scheduled onto hosts. FIELDS: apiVersion <string> APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources ...
2.1.7. OpenShift CLI からのログアウト リンクのコピーリンクがクリップボードにコピーされました!
OpenShift CLI からログアウトし、現在のセッションを終了することができます。
oc logoutコマンドを使用します。$ oc logout出力例
Logged "user1" out on "https://openshift.example.com"
これにより、サーバーから保存された認証トークンが削除され、設定ファイルから除去されます。
2.2. OpenShift CLI の設定 リンクのコピーリンクがクリップボードにコピーされました!
2.2.1. タブ補完の有効化 リンクのコピーリンクがクリップボードにコピーされました!
Bash または Zsh シェルのタブ補完を有効にできます。
2.2.1.1. Bash のタブ補完の有効化 リンクのコピーリンクがクリップボードにコピーされました!
OpenShift CLI (oc) ツールをインストールした後に、タブ補完を有効にして oc コマンドの自動補完を実行するか、Tab キーを押す際にオプションの提案が表示されるようにできます。次の手順では、Bash シェルのタブ補完を有効にします。
前提条件
-
OpenShift CLI (
oc) がインストールされている。 -
bash-completionパッケージがインストールされている。
手順
Bash 補完コードをファイルに保存します。
$ oc completion bash > oc_bash_completionファイルを
/etc/bash_completion.d/にコピーします。$ sudo cp oc_bash_completion /etc/bash_completion.d/さらにファイルをローカルディレクトリーに保存した後に、これを
.bashrcファイルから取得できるようにすることができます。
タブ補完は、新規ターミナルを開くと有効になります。
2.2.1.2. Zsh のタブ補完の有効化 リンクのコピーリンクがクリップボードにコピーされました!
OpenShift CLI (oc) ツールをインストールした後に、タブ補完を有効にして oc コマンドの自動補完を実行するか、Tab キーを押す際にオプションの提案が表示されるようにできます。次の手順では、Zsh シェルのタブ補完を有効にします。
前提条件
-
OpenShift CLI (
oc) がインストールされている。
手順
ocのタブ補完を.zshrcファイルに追加するには、次のコマンドを実行します。$ cat >>~/.zshrc<<EOF autoload -Uz compinit compinit if [ $commands[oc] ]; then source <(oc completion zsh) compdef _oc oc fi EOF
タブ補完は、新規ターミナルを開くと有効になります。
2.2.2. oc CLI を使用して kubeconfig にアクセスする リンクのコピーリンクがクリップボードにコピーされました!
oc CLI を使用して OpenShift クラスターにログインし、コマンドラインからクラスターにアクセスするための kubeconfig ファイルを取得できます。
前提条件
- Red Hat OpenShift Service on AWS Web コンソールまたは API サーバーエンドポイントにアクセスできる。
手順
次のコマンドを実行して、OpenShift クラスターにログインします。
$ oc login <api-server-url> -u <username> -p <password>1 2 3 - 1
- 完全な API サーバー URL を指定します。たとえば、
https://api.my-cluster.example.com:6443などです。 - 2
- 有効なユーザー名を指定します。たとえば、
kubeadminなどです - 3
- 指定されたユーザーのパスワードを入力します。たとえば、クラスターのインストール中に生成される
kubeadminパスワードなどです。
次のコマンドを実行して、クラスター設定をローカルファイルに保存します。
$ oc config view --raw > kubeconfig次のコマンドを実行して、エクスポートされたファイルを指すように
KUBECONFIG環境変数を設定します。$ export KUBECONFIG=./kubeconfig次のコマンドを実行し、
ocを使用して OpenShift クラスターと対話します。$ oc get nodes
エクスポートした kubeconfig ファイルをセッション間またはマシン間で再利用する予定の場合は、ファイルを安全に保存し、ソース管理にコミットしないようにしてください。
2.3. oc および kubectl コマンドの使用 リンクのコピーリンクがクリップボードにコピーされました!
Kubernetes のコマンドラインインターフェイス (CLI) kubectl は、Kubernetes クラスターに対してコマンドを実行するのに使用されます。Red Hat OpenShift Service on AWS は認定された Kubernetes ディストリビューションであるため、Red Hat OpenShift Service on AWS に同梱されているサポート対象の kubectl バイナリーを使用することも、oc バイナリーを使用して拡張機能を利用することもできます。
2.3.1. oc バイナリー リンクのコピーリンクがクリップボードにコピーされました!
oc バイナリーは kubectl バイナリーと同じ機能を提供しますが、以下を含む Red Hat OpenShift Service on AWS の追加の機能をネイティブにサポートするように拡張されています。
Red Hat OpenShift Service on AWS リソースの完全サポート
DeploymentConfig、BuildConfig、Route、ImageStream、およびImageStreamTagオブジェクトなどのリソースは、Red Hat OpenShift Service on AWS ディストリビューションに固有のリソースであり、標準の Kubernetes プリミティブにビルドされます。- 認証
追加コマンド
追加コマンドの
oc new-appなどは、既存のソースコードまたは事前にビルドされたイメージを使用して新規アプリケーションを起動することを容易にします。同様に、追加コマンドのoc new-projectにより、デフォルトとして切り替えることができるプロジェクトを簡単に開始できるようになります。
以前のバージョンの oc バイナリーをインストールしている場合、それを使用して Red Hat OpenShift Service on AWS のすべてのコマンドを完了することはできません。最新の機能が必要な場合は、Red Hat OpenShift Service on AWS サーバーのバージョンに対応する oc バイナリーの最新バージョンをダウンロードしてインストールする必要があります。
セキュリティー以外の API の変更は、古い oc バイナリーの更新を可能にするために、2 つ以上のマイナーリリース (例: 4.1 から 4.2、そして 4.3 へ) が必要です。新機能を使用するには新規の oc バイナリーが必要になる場合があります。4.3 サーバーには、4.2 oc バイナリーが使用できない機能が追加されている場合や、4.3 oc バイナリーには 4.2 サーバーでサポートされていない追加機能が含まれる場合があります。
|
X.Y ( |
X.Y+N footnote:versionpolicyn[N は 1 以上の数値です] ( | |
| X.Y (サーバー) |
|
|
| X.Y+N footnote:versionpolicyn[] (サーバー) |
|
|
完全に互換性がある。
oc クライアントは、サーバー機能にアクセスできない場合があります。
oc クライアントは、アクセスされるサーバーと互換性のないオプションおよび機能を提供する可能性があります。
2.3.2. kubectl バイナリー リンクのコピーリンクがクリップボードにコピーされました!
kubectl バイナリーは、標準の Kubernetes 環境を使用する Red Hat OpenShift Service on AWS の新規ユーザー、または kubectl CLI を優先的に使用するユーザーの既存ワークフローおよびスクリプトをサポートする手段として提供されます。kubectl の既存ユーザーはバイナリーを引き続き使用し、Red Hat OpenShift Service on AWS クラスターへの変更なしに Kubernetes のプリミティブと対話できます。
OpenShift CLI のインストール 手順に従って、サポートされている kubectl バイナリーをインストールできます。kubectl バイナリーは、バイナリーをダウンロードする場合にアーカイブに含まれます。または RPM を使用して CLI のインストール時にインストールされます。
詳細は、kubectl のドキュメント を参照してください。
2.4. CLI プロファイルの管理 リンクのコピーリンクがクリップボードにコピーされました!
CLI 設定ファイルでは、CLI ツールの概要 で使用するさまざまなプロファイルまたはコンテキストを設定できます。コンテキストは、ニックネーム に関連付けられた Red Hat OpenShift Service on AWS サーバー情報で構成されます。
2.4.1. CLI プロファイルの切り替えについて リンクのコピーリンクがクリップボードにコピーされました!
コンテキストを使用すると、CLI 操作を使用するときに、複数の Red Hat OpenShift Service on AWS サーバーまたはクラスター間で複数のユーザーを簡単に切り替えることができます。ニックネームを使用すると、コンテキスト、ユーザーの認証情報およびクラスターの詳細情報の省略された参照を提供することで、CLI 設定の管理が容易になります。ユーザーが oc CLI を使用して初めてログインすると、Red Hat OpenShift Service on AWS が ~/.kube/config ファイルを作成します (存在しない場合)。oc login 操作中に自動的に、または CLI プロファイルを手動で設定することにより、より多くの認証と接続の詳細が CLI に提供されると、更新された情報が設定ファイルに保存されます。
CLI 設定ファイル
apiVersion: v1
clusters:
- cluster:
insecure-skip-tls-verify: true
server: https://openshift1.example.com:8443
name: openshift1.example.com:8443
- cluster:
insecure-skip-tls-verify: true
server: https://openshift2.example.com:8443
name: openshift2.example.com:8443
contexts:
- context:
cluster: openshift1.example.com:8443
namespace: alice-project
user: alice/openshift1.example.com:8443
name: alice-project/openshift1.example.com:8443/alice
- context:
cluster: openshift1.example.com:8443
namespace: joe-project
user: alice/openshift1.example.com:8443
name: joe-project/openshift1/alice
current-context: joe-project/openshift1.example.com:8443/alice
kind: Config
preferences: {}
users:
- name: alice/openshift1.example.com:8443
user:
token: xZHd2piv5_9vQrg-SKXRJ2Dsl9SceNJdhNTljEKTb8k
- 1
clustersセクションでは、マスターサーバーのアドレスなど、Red Hat OpenShift Service on AWS クラスターの接続の詳細を定義します。この例では、1 つのクラスターのニックネームはopenshift1.example.com:8443で、もう 1 つのクラスターのニックネームはopenshift2.example.com:8443となっています。- 2
- この
contextsセクションでは、2 つのコンテキストを定義します。1 つはalice-project/openshift1.example.com:8443/aliceというニックネームで、alice-projectプロジェクト、openshift1.example.com:8443クラスター、およびaliceユーザーを使用します。もう 1 つはjoe-project/openshift1.example.com:8443/aliceというニックネームで、joe-projectプロジェクト、openshift1.example.com:8443クラスター、およびaliceユーザーを使用します。 - 3
current-contextパラメーターは、joe-project/openshift1.example.com:8443/aliceコンテキストが現在使用中であることを示しています。これにより、aliceユーザーはopenshift1.example.com:8443クラスターのjoe-projectプロジェクトで作業することが可能になります。- 4
usersセクションは、ユーザーの認証情報を定義します。この例では、ユーザーニックネームalice/openshift1.example.com:8443は、アクセストークンを使用します。
CLI は、実行時にロードされ、コマンドラインから指定されたオーバーライドオプションとともにマージされる複数の設定ファイルをサポートできます。ログイン後に、oc status または oc project コマンドを使用して、現在の作業環境を確認できます。
現在の作業環境の確認
$ oc status
出力例
oc status
In project Joe's Project (joe-project)
service database (172.30.43.12:5434 -> 3306)
database deploys docker.io/openshift/mysql-55-centos7:latest
#1 deployed 25 minutes ago - 1 pod
service frontend (172.30.159.137:5432 -> 8080)
frontend deploys origin-ruby-sample:latest <-
builds https://github.com/openshift/ruby-hello-world with joe-project/ruby-20-centos7:latest
#1 deployed 22 minutes ago - 2 pods
To see more information about a service or deployment, use 'oc describe service <name>' or 'oc describe dc <name>'.
You can use 'oc get all' to see lists of each of the types described in this example.
現在のプロジェクトのリスト表示
$ oc project
出力例
Using project "joe-project" from context named "joe-project/openshift1.example.com:8443/alice" on server "https://openshift1.example.com:8443".
oc login コマンドを再度実行し、対話式プロセス中に必要な情報を指定して、ユーザー認証情報およびクラスターの詳細の他の組み合わせを使用してログインできます。コンテキストが存在しない場合は、コンテキストが指定される情報に基づいて作成されます。すでにログインしている場合で、現行ユーザーがアクセス可能な別のプロジェクトに切り替える場合には、oc project コマンドを使用してプロジェクトの名前を入力します。
$ oc project alice-project
出力例
Now using project "alice-project" on server "https://openshift1.example.com:8443".
出力に示されるように、いつでも oc config view コマンドを使用して、現在の CLI 設定を表示できます。高度な使用方法で利用できる CLI 設定コマンドが他にもあります。
管理者の認証情報にアクセスできるが、デフォルトのシステムユーザー system:admin としてログインしていない場合は、CLI 設定ファイルに認証情報が残っている限り、いつでもこのユーザーとして再度ログインできます。以下のコマンドはログインを実行し、デフォルトプロジェクトに切り替えます。
$ oc login -u system:admin -n default
2.4.2. CLI プロファイルの手動設定 リンクのコピーリンクがクリップボードにコピーされました!
このセクションでは、CLI 設定の高度な使用方法を説明します。ほとんどの場合、oc login コマンドおよび oc project コマンドを使用してログインし、コンテキスト間とプロジェクト間の切り替えを実行できます。
CLI 設定ファイルを手動で設定する必要がある場合は、ファイルを直接変更せずに oc config コマンドを使用することができます。oc config コマンドには、この目的で役立ついくつかのサブコマンドが含まれています。
| サブコマンド | 使用法 |
|---|---|
|
| CLI 設定ファイルにクラスターエントリーを設定します。参照されるクラスターのニックネームがすでに存在する場合、指定情報はマージされます。
|
|
| CLI 設定ファイルにコンテキストエントリーを設定します。参照されるコンテキストのニックネームがすでに存在する場合、指定情報はマージされます。
|
|
| 指定されたコンテキストのニックネームを使用して、現在のコンテキストを設定します。
|
|
| CLI 設定ファイルに個別の値を設定します。
|
|
| CLI 設定ファイルでの個別の値の設定を解除します。
|
|
| 現在使用中のマージされた CLI 設定を表示します。
指定された CLI 設定ファイルの結果を表示します。
|
使用例
-
アクセストークンを使用するユーザーとしてログインします。このトークンは
aliceユーザーによって使用されます。
$ oc login https://openshift1.example.com --token=ns7yVhuRNpDM9cgzfhhxQ7bM5s7N2ZVrkZepSRf4LC0
- 自動的に作成されたクラスターエントリーを表示します。
$ oc config view
出力例
apiVersion: v1
clusters:
- cluster:
insecure-skip-tls-verify: true
server: https://openshift1.example.com
name: openshift1-example-com
contexts:
- context:
cluster: openshift1-example-com
namespace: default
user: alice/openshift1-example-com
name: default/openshift1-example-com/alice
current-context: default/openshift1-example-com/alice
kind: Config
preferences: {}
users:
- name: alice/openshift1.example.com
user:
token: ns7yVhuRNpDM9cgzfhhxQ7bM5s7N2ZVrkZepSRf4LC0
- 現在のコンテキストを更新して、ユーザーが必要な namespace にログインできるようにします。
$ oc config set-context `oc config current-context` --namespace=<project_name>
- 現在のコンテキストを調べて、変更が実装されていることを確認します。
$ oc whoami -c
後続のすべての CLI 操作は、オーバーライドする CLI オプションにより特に指定されていない限り、またはコンテキストが切り替わるまで、新しいコンテキストを使用します。
2.4.3. ルールの読み込みおよびマージ リンクのコピーリンクがクリップボードにコピーされました!
CLI 設定のロードおよびマージ順序の CLI 操作を実行する際に、以下のルールを実行できます。
CLI 設定ファイルは、以下の階層とマージルールを使用してワークステーションから取得されます。
-
--configオプションが設定されている場合、そのファイルのみが読み込まれます。フラグは一度設定され、マージは実行されません。 -
$KUBECONFIG環境変数が設定されている場合は、これが使用されます。変数はパスの一覧である可能性があり、その場合、パスは 1 つにマージされます。値が変更される場合は、スタンザを定義するファイルで変更されます。値が作成される場合は、存在する最初のファイルで作成されます。ファイルがチェーン内に存在しない場合は、一覧の最後のファイルが作成されます。 -
または、
~/.kube/configファイルが使用され、マージは実行されません。
-
使用するコンテキストは、以下のフローの最初の一致に基づいて決定されます。
-
--contextオプションの値。 -
CLI 設定ファイルの
current-context値。 - この段階では空の値が許可されます。
-
使用するユーザーおよびクラスターが決定されます。この時点では、コンテキストがある場合とない場合があります。コンテキストは、以下のフローの最初の一致に基づいて作成されます。このフローは、ユーザー用に 1 回、クラスター用に 1 回実行されます。
-
ユーザー名の
--userの値、およびクラスター名の--clusterオプション。 -
--contextオプションがある場合は、コンテキストの値を使用します。 - この段階では空の値が許可されます。
-
ユーザー名の
使用する実際のクラスター情報が決定されます。この時点では、クラスター情報がある場合とない場合があります。各クラスター情報は、以下のフローの最初の一致に基づいて構築されます。
以下のコマンドラインオプションのいずれかの値。
-
--server -
--api-version -
--certificate-authority -
--insecure-skip-tls-verify
-
- クラスター情報および属性の値がある場合は、それを使用します。
- サーバーロケーションがない場合は、エラーが生じます。
使用する実際のユーザー情報が決定されます。ユーザーは、クラスターと同じルールを使用して作成されます。ただし、複数の手法が競合することによって操作が失敗することから、ユーザーごとの 1 つの認証手法のみを使用できます。コマンドラインのオプションは、設定ファイルの値よりも優先されます。以下は、有効なコマンドラインのオプションです。
-
--auth-path -
--client-certificate -
--client-key -
--token
-
- 欠落している情報がある場合には、デフォルト値が使用され、追加情報を求めるプロンプトが出されます。
2.5. プラグインによる OpenShift CLI の拡張 リンクのコピーリンクがクリップボードにコピーされました!
デフォルトの oc コマンドを拡張するためにプラグインを作成およびインストールし、これを使用して OpenShift CLI で新規および追加の複雑なタスクを実行できます。
2.5.1. CLI プラグインの作成 リンクのコピーリンクがクリップボードにコピーされました!
コマンドラインコマンドを記述できる任意のプログラミング言語またはスクリプトで、OpenShift CLI のプラグインを記述できます。既存の oc コマンドを上書きするプラグインを使用することはできない点に注意してください。
手順
以下の手順では、oc foo コマンドの実行時にターミナルにメッセージを出力する単純な Bash プラグインを作成します。
oc-fooというファイルを作成します。プラグインファイルの名前を付ける際には、以下の点に留意してください。
-
プログインとして認識されるように、ファイルの名前は
oc-またはkubectl-で開始する必要があります。 -
ファイル名は、プラグインを起動するコマンドを判別するものとなります。たとえば、ファイル名が
oc-foo-barのプラグインは、oc foo barのコマンドで起動します。また、コマンドにダッシュを含める必要がある場合には、アンダースコアを使用することもできます。たとえば、ファイル名がoc-foo_barのプラグインは、oc foo-barのコマンドで起動します。
-
プログインとして認識されるように、ファイルの名前は
以下の内容をファイルに追加します。
#!/bin/bash # optional argument handling if [[ "$1" == "version" ]] then echo "1.0.0" exit 0 fi # optional argument handling if [[ "$1" == "config" ]] then echo $KUBECONFIG exit 0 fi echo "I am a plugin named kubectl-foo"
OpenShift CLI 用のこのプラグインをインストールすると、oc foo コマンドを使用して呼び出すことができます。
2.5.2. CLI プラグインのインストールおよび使用 リンクのコピーリンクがクリップボードにコピーされました!
OpenShift CLI のカスタムプラグインを作成した後、使用する前にプラグインをインストールする必要があります。
前提条件
-
ocCLI ツールをインストールしていること。 -
oc-またはkubectl-で始まる CLI プラグインファイルがあること。
手順
必要に応じて、プラグインファイルを更新して実行可能にします。
$ chmod +x <plugin_file>ファイルを
PATHの任意の場所に置きます (例:/usr/local/bin/)。$ sudo mv <plugin_file> /usr/local/bin/.oc plugin listを実行し、プラグインが一覧表示されることを確認します。$ oc plugin list出力例
The following compatible plugins are available: /usr/local/bin/<plugin_file>プラグインがここに一覧表示されていない場合、ファイルが
oc-またはkubectl-で開始されるものであり、実行可能な状態でPATH上にあることを確認します。プラグインによって導入される新規コマンドまたはオプションを起動します。
たとえば、
kubectl-nsプラグインを サンプルのプラグインリポジトリー からビルドし、インストールしている場合、以下のコマンドを使用して現在の namespace を表示できます。$ oc nsプラグインを呼び出すコマンドは、プラグインのファイル名に依存することに注意してください。たとえば、ファイル名が
oc-foo-barのプラグインはoc foo barコマンドによって起動します。
2.6. OpenShift CLI 開発者コマンドリファレンス リンクのコピーリンクがクリップボードにコピーされました!
このリファレンスは、OpenShift CLI (oc) 開発者コマンドの説明とコマンド例を示しています。
oc help を実行して、すべてのコマンドを表示するか、oc <command> --help を実行して、特定のコマンドに関する追加情報を取得します。
2.6.1. OpenShift CLI (oc) 開発者コマンド リンクのコピーリンクがクリップボードにコピーされました!
2.6.1.1. oc annotate リンクのコピーリンクがクリップボードにコピーされました!
リソースへのアノテーションを更新します。
使用例
# Update pod 'foo' with the annotation 'description' and the value 'my frontend'
# If the same annotation is set multiple times, only the last value will be applied
oc annotate pods foo description='my frontend'
# Update a pod identified by type and name in "pod.json"
oc annotate -f pod.json description='my frontend'
# Update pod 'foo' with the annotation 'description' and the value 'my frontend running nginx', overwriting any existing value
oc annotate --overwrite pods foo description='my frontend running nginx'
# Update all pods in the namespace
oc annotate pods --all description='my frontend running nginx'
# Update pod 'foo' only if the resource is unchanged from version 1
oc annotate pods foo description='my frontend running nginx' --resource-version=1
# Update pod 'foo' by removing an annotation named 'description' if it exists
# Does not require the --overwrite flag
oc annotate pods foo description-
2.6.1.2. oc api-resources リンクのコピーリンクがクリップボードにコピーされました!
サーバー上のサポートされている API リソースを出力します。
使用例
# Print the supported API resources
oc api-resources
# Print the supported API resources with more information
oc api-resources -o wide
# Print the supported API resources sorted by a column
oc api-resources --sort-by=name
# Print the supported namespaced resources
oc api-resources --namespaced=true
# Print the supported non-namespaced resources
oc api-resources --namespaced=false
# Print the supported API resources with a specific APIGroup
oc api-resources --api-group=rbac.authorization.k8s.io
2.6.1.3. oc api-versions リンクのコピーリンクがクリップボードにコピーされました!
"group/version" という形式で、サーバー上でサポートされる API バージョンを出力します。
使用例
# Print the supported API versions
oc api-versions
2.6.1.4. oc apply リンクのコピーリンクがクリップボードにコピーされました!
設定をファイル名または標準入力 (stdin) 別のリソースに適用します。
使用例
# Apply the configuration in pod.json to a pod
oc apply -f ./pod.json
# Apply resources from a directory containing kustomization.yaml - e.g. dir/kustomization.yaml
oc apply -k dir/
# Apply the JSON passed into stdin to a pod
cat pod.json | oc apply -f -
# Apply the configuration from all files that end with '.json'
oc apply -f '*.json'
# Note: --prune is still in Alpha
# Apply the configuration in manifest.yaml that matches label app=nginx and delete all other resources that are not in the file and match label app=nginx
oc apply --prune -f manifest.yaml -l app=nginx
# Apply the configuration in manifest.yaml and delete all the other config maps that are not in the file
oc apply --prune -f manifest.yaml --all --prune-allowlist=core/v1/ConfigMap
2.6.1.5. oc apply edit-last-applied リンクのコピーリンクがクリップボードにコピーされました!
リソース/オブジェクトの最新の last-applied-configuration アノテーションを編集します。
使用例
# 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.6.1.6. oc apply set-last-applied リンクのコピーリンクがクリップボードにコピーされました!
ファイルの内容に一致するように、ライブオブジェクトに last-applied-configuration アノテーションを設定します。
使用例
# Set the last-applied-configuration of a resource to match the contents of a file
oc apply set-last-applied -f deploy.yaml
# Execute set-last-applied against each configuration file in a directory
oc apply set-last-applied -f path/
# Set the last-applied-configuration of a resource to match the contents of a file; will create the annotation if it does not already exist
oc apply set-last-applied -f deploy.yaml --create-annotation=true
2.6.1.7. oc apply view-last-applied リンクのコピーリンクがクリップボードにコピーされました!
リソース/オブジェクトの最新の last-applied-configuration アノテーションを表示します。
使用例
# 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.6.1.8. oc attach リンクのコピーリンクがクリップボードにコピーされました!
実行中のコンテナーに割り当てます。
使用例
# Get output from running pod mypod; use the 'oc.kubernetes.io/default-container' annotation
# for selecting the container to be attached or the first container in the pod will be chosen
oc attach mypod
# Get output from ruby-container from pod mypod
oc attach mypod -c ruby-container
# Switch to raw terminal mode; sends stdin to 'bash' in ruby-container from pod mypod
# and sends stdout/stderr from 'bash' back to the client
oc attach mypod -c ruby-container -i -t
# Get output from the first pod of a replica set named nginx
oc attach rs/nginx
2.6.1.9. oc auth can-i リンクのコピーリンクがクリップボードにコピーされました!
アクションが可能かどうかを確認します。
使用例
# Check to see if I can create pods in any namespace
oc auth can-i create pods --all-namespaces
# Check to see if I can list deployments in my current namespace
oc auth can-i list deployments.apps
# Check to see if service account "foo" of namespace "dev" can list pods in the namespace "prod"
# You must be allowed to use impersonation for the global option "--as"
oc auth can-i list pods --as=system:serviceaccount:dev:foo -n prod
# Check to see if I can do everything in my current namespace ("*" means all)
oc auth can-i '*' '*'
# Check to see if I can get the job named "bar" in namespace "foo"
oc auth can-i list jobs.batch/bar -n foo
# Check to see if I can read pod logs
oc auth can-i get pods --subresource=log
# Check to see if I can access the URL /logs/
oc auth can-i get /logs/
# Check to see if I can approve certificates.k8s.io
oc auth can-i approve certificates.k8s.io
# List all allowed actions in namespace "foo"
oc auth can-i --list --namespace=foo
2.6.1.10. oc auth reconcile リンクのコピーリンクがクリップボードにコピーされました!
RBAC ロール、ロールバインディング、クラスターロール、およびクラスターロールバインディングオブジェクトのルールを調整します。
使用例
# Reconcile RBAC resources from a file
oc auth reconcile -f my-rbac-rules.yaml
2.6.1.11. oc auth whoami リンクのコピーリンクがクリップボードにコピーされました!
実験的: 自己サブジェクトの属性を確認します。
使用例
# Get your subject attributes
oc auth whoami
# Get your subject attributes in JSON format
oc auth whoami -o json
2.6.1.12. oc autoscale リンクのコピーリンクがクリップボードにコピーされました!
デプロイメント設定、デプロイメント、レプリカセット、ステートフルセット、またはレプリケーションコントローラーを自動スケーリングします。
使用例
# 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.6.1.13. oc cancel-build リンクのコピーリンクがクリップボードにコピーされました!
実行中、保留中、または新規のビルドを取り消します。
使用例
# Cancel the build with the given name
oc cancel-build ruby-build-2
# Cancel the named build and print the build logs
oc cancel-build ruby-build-2 --dump-logs
# Cancel the named build and create a new one with the same parameters
oc cancel-build ruby-build-2 --restart
# Cancel multiple builds
oc cancel-build ruby-build-1 ruby-build-2 ruby-build-3
# Cancel all builds created from the 'ruby-build' build config that are in the 'new' state
oc cancel-build bc/ruby-build --state=new
2.6.1.14. oc cluster-info リンクのコピーリンクがクリップボードにコピーされました!
クラスター情報を表示します。
使用例
# Print the address of the control plane and cluster services
oc cluster-info
2.6.1.15. oc cluster-info dump リンクのコピーリンクがクリップボードにコピーされました!
デバッグおよび診断に関する関連情報をダンプします。
使用例
# Dump current cluster state to stdout
oc cluster-info dump
# Dump current cluster state to /path/to/cluster-state
oc cluster-info dump --output-directory=/path/to/cluster-state
# Dump all namespaces to stdout
oc cluster-info dump --all-namespaces
# Dump a set of namespaces to /path/to/cluster-state
oc cluster-info dump --namespaces default,kube-system --output-directory=/path/to/cluster-state
2.6.1.16. oc completion リンクのコピーリンクがクリップボードにコピーされました!
指定されたシェル (bash、zsh、fish、または powershell) のシェル補完コードを出力します。
使用例
# Installing bash completion on macOS using homebrew
## If running Bash 3.2 included with macOS
brew install bash-completion
## or, if running Bash 4.1+
brew install bash-completion@2
## If oc is installed via homebrew, this should start working immediately
## If you've installed via other means, you may need add the completion to your completion directory
oc completion bash > $(brew --prefix)/etc/bash_completion.d/oc
# Installing bash completion on Linux
## If bash-completion is not installed on Linux, install the 'bash-completion' package
## via your distribution's package manager.
## Load the oc completion code for bash into the current shell
source <(oc completion bash)
## Write bash completion code to a file and source it from .bash_profile
oc completion bash > ~/.kube/completion.bash.inc
printf "
# oc shell completion
source '$HOME/.kube/completion.bash.inc'
" >> $HOME/.bash_profile
source $HOME/.bash_profile
# Load the oc completion code for zsh[1] into the current shell
source <(oc completion zsh)
# Set the oc completion code for zsh[1] to autoload on startup
oc completion zsh > "${fpath[1]}/_oc"
# Load the oc completion code for fish[2] into the current shell
oc completion fish | source
# To load completions for each session, execute once:
oc completion fish > ~/.config/fish/completions/oc.fish
# Load the oc completion code for powershell into the current shell
oc completion powershell | Out-String | Invoke-Expression
# Set oc completion code for powershell to run on startup
## Save completion code to a script and execute in the profile
oc completion powershell > $HOME\.kube\completion.ps1
Add-Content $PROFILE "$HOME\.kube\completion.ps1"
## Execute completion code in the profile
Add-Content $PROFILE "if (Get-Command oc -ErrorAction SilentlyContinue) {
oc completion powershell | Out-String | Invoke-Expression
}"
## Add completion code directly to the $PROFILE script
oc completion powershell >> $PROFILE
2.6.1.17. oc config current-context リンクのコピーリンクがクリップボードにコピーされました!
current-context を表示します。
使用例
# Display the current-context
oc config current-context
2.6.1.18. oc config delete-cluster リンクのコピーリンクがクリップボードにコピーされました!
kubeconfig から指定されたクラスターを削除します。
使用例
# Delete the minikube cluster
oc config delete-cluster minikube
2.6.1.19. oc config delete-context リンクのコピーリンクがクリップボードにコピーされました!
kubeconfig から指定されたコンテキストを削除します。
使用例
# Delete the context for the minikube cluster
oc config delete-context minikube
2.6.1.20. oc config delete-user リンクのコピーリンクがクリップボードにコピーされました!
kubeconfig から指定されたユーザーを削除します。
使用例
# Delete the minikube user
oc config delete-user minikube
2.6.1.21. oc config get-clusters リンクのコピーリンクがクリップボードにコピーされました!
kubeconfig に定義されるクラスターを表示します。
使用例
# List the clusters that oc knows about
oc config get-clusters
2.6.1.22. oc config get-contexts リンクのコピーリンクがクリップボードにコピーされました!
コンテキストを 1 つまたは複数記述します。
使用例
# 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.6.1.23. oc config get-users リンクのコピーリンクがクリップボードにコピーされました!
kubeconfig で定義されるユーザーを表示します。
使用例
# List the users that oc knows about
oc config get-users
2.6.1.24. oc config new-admin-kubeconfig リンクのコピーリンクがクリップボードにコピーされました!
新しい admin.kubeconfig を生成してサーバーを信頼させ、表示します。
使用例
# Generate a new admin kubeconfig
oc config new-admin-kubeconfig
2.6.1.25. oc config new-kubelet-bootstrap-kubeconfig リンクのコピーリンクがクリップボードにコピーされました!
新しい kubelet /etc/kubernetes/kubeconfig を生成し、サーバーを信頼させて表示します。
使用例
# Generate a new kubelet bootstrap kubeconfig
oc config new-kubelet-bootstrap-kubeconfig
2.6.1.26. oc config refresh-ca-bundle リンクのコピーリンクがクリップボードにコピーされました!
API サーバーに接続して OpenShift CA バンドルを更新する
使用例
# Refresh the CA bundle for the current context's cluster
oc config refresh-ca-bundle
# Refresh the CA bundle for the cluster named e2e in your kubeconfig
oc config refresh-ca-bundle e2e
# Print the CA bundle from the current OpenShift cluster's API server
oc config refresh-ca-bundle --dry-run
2.6.1.27. oc config rename-context リンクのコピーリンクがクリップボードにコピーされました!
kubeconfig ファイルからのコンテキストの名前を変更します。
使用例
# Rename the context 'old-name' to 'new-name' in your kubeconfig file
oc config rename-context old-name new-name
2.6.1.28. oc config set リンクのコピーリンクがクリップボードにコピーされました!
kubeconfig ファイルに個別の値を設定します。
使用例
# Set the server field on the my-cluster cluster to https://1.2.3.4
oc config set clusters.my-cluster.server https://1.2.3.4
# Set the certificate-authority-data field on the my-cluster cluster
oc config set clusters.my-cluster.certificate-authority-data $(echo "cert_data_here" | base64 -i -)
# Set the cluster field in the my-context context to my-cluster
oc config set contexts.my-context.cluster my-cluster
# Set the client-key-data field in the cluster-admin user using --set-raw-bytes option
oc config set users.cluster-admin.client-key-data cert_data_here --set-raw-bytes=true
2.6.1.29. oc config set-cluster リンクのコピーリンクがクリップボードにコピーされました!
kubeconfig でクラスターエントリーを設定します。
使用例
# Set only the server field on the e2e cluster entry without touching other values
oc config set-cluster e2e --server=https://1.2.3.4
# Embed certificate authority data for the e2e cluster entry
oc config set-cluster e2e --embed-certs --certificate-authority=~/.kube/e2e/kubernetes.ca.crt
# Disable cert checking for the e2e cluster entry
oc config set-cluster e2e --insecure-skip-tls-verify=true
# Set the custom TLS server name to use for validation for the e2e cluster entry
oc config set-cluster e2e --tls-server-name=my-cluster-name
# Set the proxy URL for the e2e cluster entry
oc config set-cluster e2e --proxy-url=https://1.2.3.4
2.6.1.30. oc config set-context リンクのコピーリンクがクリップボードにコピーされました!
kubeconfig のコンテキストエントリーを設定します。
使用例
# Set the user field on the gce context entry without touching other values
oc config set-context gce --user=cluster-admin
2.6.1.31. oc config set-credentials リンクのコピーリンクがクリップボードにコピーされました!
kubeconfig のユーザーエントリーを設定します。
使用例
# Set only the "client-key" field on the "cluster-admin"
# entry, without touching other values
oc config set-credentials cluster-admin --client-key=~/.kube/admin.key
# Set basic auth for the "cluster-admin" entry
oc config set-credentials cluster-admin --username=admin --password=uXFGweU9l35qcif
# Embed client certificate data in the "cluster-admin" entry
oc config set-credentials cluster-admin --client-certificate=~/.kube/admin.crt --embed-certs=true
# Enable the Google Compute Platform auth provider for the "cluster-admin" entry
oc config set-credentials cluster-admin --auth-provider=gcp
# Enable the OpenID Connect auth provider for the "cluster-admin" entry with additional arguments
oc config set-credentials cluster-admin --auth-provider=oidc --auth-provider-arg=client-id=foo --auth-provider-arg=client-secret=bar
# Remove the "client-secret" config value for the OpenID Connect auth provider for the "cluster-admin" entry
oc config set-credentials cluster-admin --auth-provider=oidc --auth-provider-arg=client-secret-
# Enable new exec auth plugin for the "cluster-admin" entry
oc config set-credentials cluster-admin --exec-command=/path/to/the/executable --exec-api-version=client.authentication.k8s.io/v1beta1
# Enable new exec auth plugin for the "cluster-admin" entry with interactive mode
oc config set-credentials cluster-admin --exec-command=/path/to/the/executable --exec-api-version=client.authentication.k8s.io/v1beta1 --exec-interactive-mode=Never
# Define new exec auth plugin arguments for the "cluster-admin" entry
oc config set-credentials cluster-admin --exec-arg=arg1 --exec-arg=arg2
# Create or update exec auth plugin environment variables for the "cluster-admin" entry
oc config set-credentials cluster-admin --exec-env=key1=val1 --exec-env=key2=val2
# Remove exec auth plugin environment variables for the "cluster-admin" entry
oc config set-credentials cluster-admin --exec-env=var-to-remove-
2.6.1.32. oc config unset リンクのコピーリンクがクリップボードにコピーされました!
kubeconfig ファイルの個別の値の設定を解除します。
使用例
# Unset the current-context
oc config unset current-context
# Unset namespace in foo context
oc config unset contexts.foo.namespace
2.6.1.33. oc config use-context リンクのコピーリンクがクリップボードにコピーされました!
kubeconfig ファイルで current-context を設定します。
使用例
# Use the context for the minikube cluster
oc config use-context minikube
2.6.1.34. oc config view リンクのコピーリンクがクリップボードにコピーされました!
マージされた kubeconfig 設定または指定された kubeconfig ファイルを表示します。
使用例
# Show merged kubeconfig settings
oc config view
# Show merged kubeconfig settings, raw certificate data, and exposed secrets
oc config view --raw
# Get the password for the e2e user
oc config view -o jsonpath='{.users[?(@.name == "e2e")].user.password}'
2.6.1.35. oc cp リンクのコピーリンクがクリップボードにコピーされました!
ファイルおよびディレクトリーのコンテナーへの/からのコピーを実行します。
使用例
# !!!Important Note!!!
# Requires that the 'tar' binary is present in your container
# image. If 'tar' is not present, 'oc cp' will fail.
#
# For advanced use cases, such as symlinks, wildcard expansion or
# file mode preservation, consider using 'oc exec'.
# Copy /tmp/foo local file to /tmp/bar in a remote pod in namespace <some-namespace>
tar cf - /tmp/foo | oc exec -i -n <some-namespace> <some-pod> -- tar xf - -C /tmp/bar
# Copy /tmp/foo from a remote pod to /tmp/bar locally
oc exec -n <some-namespace> <some-pod> -- tar cf - /tmp/foo | tar xf - -C /tmp/bar
# Copy /tmp/foo_dir local directory to /tmp/bar_dir in a remote pod in the default namespace
oc cp /tmp/foo_dir <some-pod>:/tmp/bar_dir
# Copy /tmp/foo local file to /tmp/bar in a remote pod in a specific container
oc cp /tmp/foo <some-pod>:/tmp/bar -c <specific-container>
# Copy /tmp/foo local file to /tmp/bar in a remote pod in namespace <some-namespace>
oc cp /tmp/foo <some-namespace>/<some-pod>:/tmp/bar
# Copy /tmp/foo from a remote pod to /tmp/bar locally
oc cp <some-namespace>/<some-pod>:/tmp/foo /tmp/bar
2.6.1.36. oc create リンクのコピーリンクがクリップボードにコピーされました!
ファイルまたは標準入力 (stdin) からリソースを作成します。
使用例
# Create a pod using the data in pod.json
oc create -f ./pod.json
# Create a pod based on the JSON passed into stdin
cat pod.json | oc create -f -
# Edit the data in registry.yaml in JSON then create the resource using the edited data
oc create -f registry.yaml --edit -o json
2.6.1.37. oc create build リンクのコピーリンクがクリップボードにコピーされました!
新規ビルドを作成します。
使用例
# Create a new build
oc create build myapp
2.6.1.38. oc create clusterresourcequota リンクのコピーリンクがクリップボードにコピーされました!
クラスターリソースクォータを作成します。
使用例
# 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.6.1.39. oc create clusterrole リンクのコピーリンクがクリップボードにコピーされました!
クラスターロールを作成します。
使用例
# Create a cluster role named "pod-reader" that allows user to perform "get", "watch" and "list" on pods
oc create clusterrole pod-reader --verb=get,list,watch --resource=pods
# Create a cluster role named "pod-reader" with ResourceName specified
oc create clusterrole pod-reader --verb=get --resource=pods --resource-name=readablepod --resource-name=anotherpod
# Create a cluster role named "foo" with API Group specified
oc create clusterrole foo --verb=get,list,watch --resource=rs.apps
# Create a cluster role named "foo" with SubResource specified
oc create clusterrole foo --verb=get,list,watch --resource=pods,pods/status
# Create a cluster role name "foo" with NonResourceURL specified
oc create clusterrole "foo" --verb=get --non-resource-url=/logs/*
# Create a cluster role name "monitoring" with AggregationRule specified
oc create clusterrole monitoring --aggregation-rule="rbac.example.com/aggregate-to-monitoring=true"
2.6.1.40. oc create clusterrolebinding リンクのコピーリンクがクリップボードにコピーされました!
特定のクラスターロールのクラスターロールバインディングを作成します。
使用例
# 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.6.1.41. oc create configmap リンクのコピーリンクがクリップボードにコピーされました!
ローカルファイル、ディレクトリー、またはリテラル値から config map を作成します。
使用例
# Create a new config map named my-config based on folder bar
oc create configmap my-config --from-file=path/to/bar
# Create a new config map named my-config with specified keys instead of file basenames on disk
oc create configmap my-config --from-file=key1=/path/to/bar/file1.txt --from-file=key2=/path/to/bar/file2.txt
# Create a new config map named my-config with key1=config1 and key2=config2
oc create configmap my-config --from-literal=key1=config1 --from-literal=key2=config2
# Create a new config map named my-config from the key=value pairs in the file
oc create configmap my-config --from-file=path/to/bar
# Create a new config map named my-config from an env file
oc create configmap my-config --from-env-file=path/to/foo.env --from-env-file=path/to/bar.env
2.6.1.42. oc create cronjob リンクのコピーリンクがクリップボードにコピーされました!
指定の名前で 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.6.1.43. oc create deployment リンクのコピーリンクがクリップボードにコピーされました!
指定の名前のデプロイメントを作成します。
使用例
# Create a deployment named my-dep that runs the busybox image
oc create deployment my-dep --image=busybox
# Create a deployment with a command
oc create deployment my-dep --image=busybox -- date
# Create a deployment named my-dep that runs the nginx image with 3 replicas
oc create deployment my-dep --image=nginx --replicas=3
# Create a deployment named my-dep that runs the busybox image and expose port 5701
oc create deployment my-dep --image=busybox --port=5701
# Create a deployment named my-dep that runs multiple containers
oc create deployment my-dep --image=busybox:latest --image=ubuntu:latest --image=nginx
2.6.1.44. oc create deploymentconfig リンクのコピーリンクがクリップボードにコピーされました!
デフォルトのオプションを指定して特定のイメージを使用するデプロイメント設定を作成します。
使用例
# Create an nginx deployment config named my-nginx
oc create deploymentconfig my-nginx --image=nginx
2.6.1.45. oc create identity リンクのコピーリンクがクリップボードにコピーされました!
アイデンティティーを手動で作成します (自動作成が無効になっている場合のみが必要)。
使用例
# Create an identity with identity provider "acme_ldap" and the identity provider username "adamjones"
oc create identity acme_ldap:adamjones
2.6.1.46. oc create imagestream リンクのコピーリンクがクリップボードにコピーされました!
空のイメージストリームを新たに作成します。
使用例
# Create a new image stream
oc create imagestream mysql
2.6.1.47. oc create imagestreamtag リンクのコピーリンクがクリップボードにコピーされました!
新規イメージストリームタグを作成します。
使用例
# 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.6.1.48. oc create ingress リンクのコピーリンクがクリップボードにコピーされました!
指定の名前で Ingress を作成します。
使用例
# Create a single ingress called 'simple' that directs requests to foo.com/bar to svc
# svc1:8080 with a TLS secret "my-cert"
oc create ingress simple --rule="foo.com/bar=svc1:8080,tls=my-cert"
# Create a catch all ingress of "/path" pointing to service svc:port and Ingress Class as "otheringress"
oc create ingress catch-all --class=otheringress --rule="/path=svc:port"
# Create an ingress with two annotations: ingress.annotation1 and ingress.annotations2
oc create ingress annotated --class=default --rule="foo.com/bar=svc:port" \
--annotation ingress.annotation1=foo \
--annotation ingress.annotation2=bla
# Create an ingress with the same host and multiple paths
oc create ingress multipath --class=default \
--rule="foo.com/=svc:port" \
--rule="foo.com/admin/=svcadmin:portadmin"
# Create an ingress with multiple hosts and the pathType as Prefix
oc create ingress ingress1 --class=default \
--rule="foo.com/path*=svc:8080" \
--rule="bar.com/admin*=svc2:http"
# Create an ingress with TLS enabled using the default ingress certificate and different path types
oc create ingress ingtls --class=default \
--rule="foo.com/=svc:https,tls" \
--rule="foo.com/path/subpath*=othersvc:8080"
# Create an ingress with TLS enabled using a specific secret and pathType as Prefix
oc create ingress ingsecret --class=default \
--rule="foo.com/*=svc:8080,tls=secret1"
# Create an ingress with a default backend
oc create ingress ingdefault --class=default \
--default-backend=defaultsvc:http \
--rule="foo.com/*=svc:8080,tls=secret1"
2.6.1.49. oc create job リンクのコピーリンクがクリップボードにコピーされました!
指定の名前でジョブを作成します。
使用例
# Create a job
oc create job my-job --image=busybox
# Create a job with a command
oc create job my-job --image=busybox -- date
# Create a job from a cron job named "a-cronjob"
oc create job test-job --from=cronjob/a-cronjob
2.6.1.50. oc create namespace リンクのコピーリンクがクリップボードにコピーされました!
指定の名前で namespace を作成します。
使用例
# Create a new namespace named my-namespace
oc create namespace my-namespace
2.6.1.51. oc create poddisruptionbudget リンクのコピーリンクがクリップボードにコピーされました!
指定の名前で Pod Disruption Budget を作成します。
使用例
# Create a pod disruption budget named my-pdb that will select all pods with the app=rails label
# and require at least one of them being available at any point in time
oc create poddisruptionbudget my-pdb --selector=app=rails --min-available=1
# Create a pod disruption budget named my-pdb that will select all pods with the app=nginx label
# and require at least half of the pods selected to be available at any point in time
oc create pdb my-pdb --selector=app=nginx --min-available=50%
2.6.1.52. oc create priorityclass リンクのコピーリンクがクリップボードにコピーされました!
指定の名前で priority class を作成します。
使用例
# Create a priority class named high-priority
oc create priorityclass high-priority --value=1000 --description="high priority"
# Create a priority class named default-priority that is considered as the global default priority
oc create priorityclass default-priority --value=1000 --global-default=true --description="default priority"
# Create a priority class named high-priority that cannot preempt pods with lower priority
oc create priorityclass high-priority --value=1000 --description="high priority" --preemption-policy="Never"
2.6.1.53. oc create 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.6.1.54. oc create role リンクのコピーリンクがクリップボードにコピーされました!
単一ルールでロールを作成します。
使用例
# Create a role named "pod-reader" that allows user to perform "get", "watch" and "list" on pods
oc create role pod-reader --verb=get --verb=list --verb=watch --resource=pods
# Create a role named "pod-reader" with ResourceName specified
oc create role pod-reader --verb=get --resource=pods --resource-name=readablepod --resource-name=anotherpod
# Create a role named "foo" with API Group specified
oc create role foo --verb=get,list,watch --resource=rs.apps
# Create a role named "foo" with SubResource specified
oc create role foo --verb=get,list,watch --resource=pods,pods/status
2.6.1.55. oc create rolebinding リンクのコピーリンクがクリップボードにコピーされました!
特定のロールまたはクラスターロールのロールバインディングを作成します。
使用例
# 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 service account monitoring:sa-dev using the admin role
oc create rolebinding admin-binding --role=admin --serviceaccount=monitoring:sa-dev
2.6.1.56. oc create route edge リンクのコピーリンクがクリップボードにコピーされました!
edge TLS termination を使用するルートを作成します。
使用例
# Create an edge route named "my-route" that exposes the frontend service
oc create route edge my-route --service=frontend
# Create an edge route that exposes the frontend service and specify a path
# If the route name is omitted, the service name will be used
oc create route edge --service=frontend --path /assets
2.6.1.57. oc create route passthrough リンクのコピーリンクがクリップボードにコピーされました!
passthrough TLS Termination を使用するルートを作成します。
使用例
# Create a passthrough route named "my-route" that exposes the frontend service
oc create route passthrough my-route --service=frontend
# Create a passthrough route that exposes the frontend service and specify
# a host name. If the route name is omitted, the service name will be used
oc create route passthrough --service=frontend --hostname=www.example.com
2.6.1.58. oc create route reencrypt リンクのコピーリンクがクリップボードにコピーされました!
reencrypt TLS Termination を使用するルートを作成します。
使用例
# Create a route named "my-route" that exposes the frontend service
oc create route reencrypt my-route --service=frontend --dest-ca-cert cert.cert
# Create a reencrypt route that exposes the frontend service, letting the
# route name default to the service name and the destination CA certificate
# default to the service CA
oc create route reencrypt --service=frontend
2.6.1.59. oc create secret docker-registry リンクのコピーリンクがクリップボードにコピーされました!
Docker レジストリーで使用するシークレットを作成します。
使用例
# If you do not already have a .dockercfg file, create a dockercfg secret directly
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=path/to/.docker/config.json
2.6.1.60. oc create secret generic リンクのコピーリンクがクリップボードにコピーされました!
ローカルファイル、ディレクトリー、またはリテラル値からシークレットを作成します。
使用例
# Create a new secret named my-secret with keys for each file in folder bar
oc create secret generic my-secret --from-file=path/to/bar
# Create a new secret named my-secret with specified keys instead of names on disk
oc create secret generic my-secret --from-file=ssh-privatekey=path/to/id_rsa --from-file=ssh-publickey=path/to/id_rsa.pub
# Create a new secret named my-secret with key1=supersecret and key2=topsecret
oc create secret generic my-secret --from-literal=key1=supersecret --from-literal=key2=topsecret
# Create a new secret named my-secret using a combination of a file and a literal
oc create secret generic my-secret --from-file=ssh-privatekey=path/to/id_rsa --from-literal=passphrase=topsecret
# Create a new secret named my-secret from env files
oc create secret generic my-secret --from-env-file=path/to/foo.env --from-env-file=path/to/bar.env
2.6.1.61. oc create secret tls リンクのコピーリンクがクリップボードにコピーされました!
TLS シークレットを作成します。
使用例
# Create a new TLS secret named tls-secret with the given key pair
oc create secret tls tls-secret --cert=path/to/tls.crt --key=path/to/tls.key
2.6.1.62. oc create service clusterip リンクのコピーリンクがクリップボードにコピーされました!
ClusterIP サービスを作成します。
使用例
# 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.6.1.63. oc create service externalname リンクのコピーリンクがクリップボードにコピーされました!
ExternalName サービスを作成します。
使用例
# Create a new ExternalName service named my-ns
oc create service externalname my-ns --external-name bar.com
2.6.1.64. oc create service loadbalancer リンクのコピーリンクがクリップボードにコピーされました!
LoadBalancer サービスを作成します。
使用例
# Create a new LoadBalancer service named my-lbs
oc create service loadbalancer my-lbs --tcp=5678:8080
2.6.1.65. oc create service nodeport リンクのコピーリンクがクリップボードにコピーされました!
NodePort サービスを作成します。
使用例
# Create a new NodePort service named my-ns
oc create service nodeport my-ns --tcp=5678:8080
2.6.1.66. oc create serviceaccount リンクのコピーリンクがクリップボードにコピーされました!
指定の名前でサービスアカウントを作成します。
使用例
# Create a new service account named my-service-account
oc create serviceaccount my-service-account
2.6.1.67. oc create token リンクのコピーリンクがクリップボードにコピーされました!
サービスアカウントトークンをリクエストします。
使用例
# Request a token to authenticate to the kube-apiserver as the service account "myapp" in the current namespace
oc create token myapp
# Request a token for a service account in a custom namespace
oc create token myapp --namespace myns
# Request a token with a custom expiration
oc create token myapp --duration 10m
# Request a token with a custom audience
oc create token myapp --audience https://example.com
# Request a token bound to an instance of a Secret object
oc create token myapp --bound-object-kind Secret --bound-object-name mysecret
# Request a token bound to an instance of a Secret object with a specific UID
oc create token myapp --bound-object-kind Secret --bound-object-name mysecret --bound-object-uid 0d4691ed-659b-4935-a832-355f77ee47cc
2.6.1.68. oc create user リンクのコピーリンクがクリップボードにコピーされました!
ユーザーを手動で作成します (自動作成が無効になっている場合のみ必要)。
使用例
# Create a user with the username "ajones" and the display name "Adam Jones"
oc create user ajones --full-name="Adam Jones"
2.6.1.69. oc create useridentitymapping リンクのコピーリンクがクリップボードにコピーされました!
アイデンティティーをユーザーに手動でマップします。
使用例
# Map the identity "acme_ldap:adamjones" to the user "ajones"
oc create useridentitymapping acme_ldap:adamjones ajones
2.6.1.70. oc debug リンクのコピーリンクがクリップボードにコピーされました!
デバッグ用に Pod の新規インスタンスを起動します。
使用例
# Start a shell session into a pod using the OpenShift tools image
oc debug
# Debug a currently running deployment by creating a new pod
oc debug deploy/test
# Debug a node as an administrator
oc debug node/master-1
# Debug a Windows node
# Note: the chosen image must match the Windows Server version (2019, 2022) of the node
oc debug node/win-worker-1 --image=mcr.microsoft.com/powershell:lts-nanoserver-ltsc2022
# Launch a shell in a pod using the provided image stream tag
oc debug istag/mysql:latest -n openshift
# Test running a job as a non-root user
oc debug job/test --as-user=1000000
# Debug a specific failing container by running the env command in the 'second' container
oc debug daemonset/test -c second -- /bin/env
# See the pod that would be created to debug
oc debug mypod-9xbc -o yaml
# Debug a resource but launch the debug pod in another namespace
# Note: Not all resources can be debugged using --to-namespace without modification. For example,
# volumes and service accounts are namespace-dependent. Add '-o yaml' to output the debug pod definition
# to disk. If necessary, edit the definition then run 'oc debug -f -' or run without --to-namespace
oc debug mypod-9xbc --to-namespace testns
2.6.1.71. oc delete リンクのコピーリンクがクリップボードにコピーされました!
ファイル名、stdin、リソースおよび名前、またはリソースおよびラベルセレクター別にリソースを削除します。
使用例
# Delete a pod using the type and name specified in pod.json
oc delete -f ./pod.json
# Delete resources from a directory containing kustomization.yaml - e.g. dir/kustomization.yaml
oc delete -k dir
# Delete resources from all files that end with '.json'
oc delete -f '*.json'
# Delete a pod based on the type and name in the JSON passed into stdin
cat pod.json | oc delete -f -
# Delete pods and services with same names "baz" and "foo"
oc delete pod,service baz foo
# Delete pods and services with label name=myLabel
oc delete pods,services -l name=myLabel
# Delete a pod with minimal delay
oc delete pod foo --now
# Force delete a pod on a dead node
oc delete pod foo --force
# Delete all pods
oc delete pods --all
# Delete all pods only if the user confirms the deletion
oc delete pods --all --interactive
2.6.1.72. oc describe リンクのコピーリンクがクリップボードにコピーされました!
特定のリソースまたはリソースのグループの詳細を表示します。
使用例
# Describe a node
oc describe nodes kubernetes-node-emt8.c.myproject.internal
# Describe a pod
oc describe pods/nginx
# Describe a pod identified by type and name in "pod.json"
oc describe -f pod.json
# Describe all pods
oc describe pods
# Describe pods by label name=myLabel
oc describe pods -l name=myLabel
# Describe all pods managed by the 'frontend' replication controller
# (rc-created pods get the name of the rc as a prefix in the pod name)
oc describe pods frontend
2.6.1.73. oc diff リンクのコピーリンクがクリップボードにコピーされました!
ライブバージョンと適用バージョンとの差異を確認します。
使用例
# Diff resources included in pod.json
oc diff -f pod.json
# Diff file read from stdin
cat service.yaml | oc diff -f -
2.6.1.74. oc edit リンクのコピーリンクがクリップボードにコピーされました!
サーバーのリソースを編集します。
使用例
# Edit the service named 'registry'
oc edit svc/registry
# Use an alternative editor
KUBE_EDITOR="nano" oc edit svc/registry
# Edit the job 'myjob' in JSON using the v1 API format
oc edit job.v1.batch/myjob -o json
# Edit the deployment 'mydeployment' in YAML and save the modified config in its annotation
oc edit deployment/mydeployment -o yaml --save-config
# Edit the 'status' subresource for the 'mydeployment' deployment
oc edit deployment mydeployment --subresource='status'
2.6.1.75. oc events リンクのコピーリンクがクリップボードにコピーされました!
イベントを一覧表示します。
使用例
# List recent events in the default namespace
oc events
# List recent events in all namespaces
oc events --all-namespaces
# List recent events for the specified pod, then wait for more events and list them as they arrive
oc events --for pod/web-pod-13je7 --watch
# List recent events in YAML format
oc events -oyaml
# List recent only events of type 'Warning' or 'Normal'
oc events --types=Warning,Normal
2.6.1.76. oc exec リンクのコピーリンクがクリップボードにコピーされました!
コンテナーでコマンドを実行します。
使用例
# Get output from running the 'date' command from pod mypod, using the first container by default
oc exec mypod -- date
# Get output from running the 'date' command in ruby-container from pod mypod
oc exec mypod -c ruby-container -- date
# Switch to raw terminal mode; sends stdin to 'bash' in ruby-container from pod mypod
# and sends stdout/stderr from 'bash' back to the client
oc exec mypod -c ruby-container -i -t -- bash -il
# List contents of /usr from the first container of pod mypod and sort by modification time
# If the command you want to execute in the pod has any flags in common (e.g. -i),
# you must use two dashes (--) to separate your command's flags/arguments
# Also note, do not surround your command and its flags/arguments with quotes
# unless that is how you would execute it normally (i.e., do ls -t /usr, not "ls -t /usr")
oc exec mypod -i -t -- ls -t /usr
# Get output from running 'date' command from the first pod of the deployment mydeployment, using the first container by default
oc exec deploy/mydeployment -- date
# Get output from running 'date' command from the first pod of the service myservice, using the first container by default
oc exec svc/myservice -- date
2.6.1.77. oc explain リンクのコピーリンクがクリップボードにコピーされました!
リソースのドキュメントを取得します。
使用例
# Get the documentation of the resource and its fields
oc explain pods
# Get all the fields in the resource
oc explain pods --recursive
# Get the explanation for deployment in supported api versions
oc explain deployments --api-version=apps/v1
# Get the documentation of a specific field of a resource
oc explain pods.spec.containers
# Get the documentation of resources in different format
oc explain deployment --output=plaintext-openapiv2
2.6.1.78. oc expose リンクのコピーリンクがクリップボードにコピーされました!
複製されたアプリケーションをサービスまたはルートとして公開します。
使用例
# Create a route based on service nginx. The new route will reuse nginx's labels
oc expose service nginx
# Create a route and specify your own label and route name
oc expose service nginx -l name=myroute --name=fromdowntown
# Create a route and specify a host name
oc expose service nginx --hostname=www.example.com
# Create a route with a wildcard
oc expose service nginx --hostname=x.example.com --wildcard-policy=Subdomain
# This would be equivalent to *.example.com. NOTE: only hosts are matched by the wildcard; subdomains would not be included
# Expose a deployment configuration as a service and use the specified port
oc expose dc ruby-hello-world --port=8080
# Expose a service as a route in the specified path
oc expose service nginx --path=/nginx
2.6.1.79. oc extract リンクのコピーリンクがクリップボードにコピーされました!
シークレットまたは config map をディスクに抽出します。
使用例
# Extract the secret "test" to the current directory
oc extract secret/test
# Extract the config map "nginx" to the /tmp directory
oc extract configmap/nginx --to=/tmp
# Extract the config map "nginx" to STDOUT
oc extract configmap/nginx --to=-
# Extract only the key "nginx.conf" from config map "nginx" to the /tmp directory
oc extract configmap/nginx --to=/tmp --keys=nginx.conf
2.6.1.80. oc get リンクのコピーリンクがクリップボードにコピーされました!
1 つ以上のリソースを表示します。
使用例
# List all pods in ps output format
oc get pods
# List all pods in ps output format with more information (such as node name)
oc get pods -o wide
# List a single replication controller with specified NAME in ps output format
oc get replicationcontroller web
# List deployments in JSON output format, in the "v1" version of the "apps" API group
oc get deployments.v1.apps -o json
# List a single pod in JSON output format
oc get -o json pod web-pod-13je7
# List a pod identified by type and name specified in "pod.yaml" in JSON output format
oc get -f pod.yaml -o json
# List resources from a directory with kustomization.yaml - e.g. dir/kustomization.yaml
oc get -k dir/
# Return only the phase value of the specified pod
oc get -o template pod/web-pod-13je7 --template={{.status.phase}}
# List resource information in custom columns
oc get pod test-pod -o custom-columns=CONTAINER:.spec.containers[0].name,IMAGE:.spec.containers[0].image
# List all replication controllers and services together in ps output format
oc get rc,services
# List one or more resources by their type and names
oc get rc/web service/frontend pods/web-pod-13je7
# List the 'status' subresource for a single pod
oc get pod web-pod-13je7 --subresource status
# List all deployments in namespace 'backend'
oc get deployments.apps --namespace backend
# List all pods existing in all namespaces
oc get pods --all-namespaces
2.6.1.81. oc get-token リンクのコピーリンクがクリップボードにコピーされました!
実験的機能: 認証情報実行プラグインとして外部の OIDC 発行者からトークンを取得します。
使用例
# Starts an auth code flow to the issuer URL with the client ID and the given extra scopes
oc get-token --client-id=client-id --issuer-url=test.issuer.url --extra-scopes=email,profile
# Starts an auth code flow to the issuer URL with a different callback address
oc get-token --client-id=client-id --issuer-url=test.issuer.url --callback-address=127.0.0.1:8343
2.6.1.82. oc idle リンクのコピーリンクがクリップボードにコピーされました!
スケーラブルなリソースをアイドリングします。
使用例
# Idle the scalable controllers associated with the services listed in to-idle.txt
$ oc idle --resource-names-file to-idle.txt
2.6.1.83. oc image append リンクのコピーリンクがクリップボードにコピーされました!
イメージにレイヤーを追加してレジストリーにプッシュします。
使用例
# Remove the entrypoint on the mysql:latest image
oc image append --from mysql:latest --to myregistry.com/myimage:latest --image '{"Entrypoint":null}'
# Add a new layer to the image
oc image append --from mysql:latest --to myregistry.com/myimage:latest layer.tar.gz
# Add a new layer to the image and store the result on disk
# This results in $(pwd)/v2/mysql/blobs,manifests
oc image append --from mysql:latest --to file://mysql:local layer.tar.gz
# Add a new layer to the image and store the result on disk in a designated directory
# This will result in $(pwd)/mysql-local/v2/mysql/blobs,manifests
oc image append --from mysql:latest --to file://mysql:local --dir mysql-local layer.tar.gz
# Add a new layer to an image that is stored on disk (~/mysql-local/v2/image exists)
oc image append --from-dir ~/mysql-local --to myregistry.com/myimage:latest layer.tar.gz
# Add a new layer to an image that was mirrored to the current directory on disk ($(pwd)/v2/image exists)
oc image append --from-dir v2 --to myregistry.com/myimage:latest layer.tar.gz
# Add a new layer to a multi-architecture image for an os/arch that is different from the system's os/arch
# Note: The first image in the manifest list that matches the filter will be returned when --keep-manifest-list is not specified
oc image append --from docker.io/library/busybox:latest --filter-by-os=linux/s390x --to myregistry.com/myimage:latest layer.tar.gz
# Add a new layer to a multi-architecture image for all the os/arch manifests when keep-manifest-list is specified
oc image append --from docker.io/library/busybox:latest --keep-manifest-list --to myregistry.com/myimage:latest layer.tar.gz
# Add a new layer to a multi-architecture image for all the os/arch manifests that is specified by the filter, while preserving the manifestlist
oc image append --from docker.io/library/busybox:latest --filter-by-os=linux/s390x --keep-manifest-list --to myregistry.com/myimage:latest layer.tar.gz
2.6.1.84. oc image extract リンクのコピーリンクがクリップボードにコピーされました!
イメージからファイルシステムにファイルをコピーします。
使用例
# Extract the busybox image into the current directory
oc image extract docker.io/library/busybox:latest
# Extract the busybox image into a designated directory (must exist)
oc image extract docker.io/library/busybox:latest --path /:/tmp/busybox
# Extract the busybox image into the current directory for linux/s390x platform
# Note: Wildcard filter is not supported with extract; pass a single os/arch to extract
oc image extract docker.io/library/busybox:latest --filter-by-os=linux/s390x
# Extract a single file from the image into the current directory
oc image extract docker.io/library/centos:7 --path /bin/bash:.
# Extract all .repo files from the image's /etc/yum.repos.d/ folder into the current directory
oc image extract docker.io/library/centos:7 --path /etc/yum.repos.d/*.repo:.
# Extract all .repo files from the image's /etc/yum.repos.d/ folder into a designated directory (must exist)
# This results in /tmp/yum.repos.d/*.repo on local system
oc image extract docker.io/library/centos:7 --path /etc/yum.repos.d/*.repo:/tmp/yum.repos.d
# Extract an image stored on disk into the current directory ($(pwd)/v2/busybox/blobs,manifests exists)
# --confirm is required because the current directory is not empty
oc image extract file://busybox:local --confirm
# Extract an image stored on disk in a directory other than $(pwd)/v2 into the current directory
# --confirm is required because the current directory is not empty ($(pwd)/busybox-mirror-dir/v2/busybox exists)
oc image extract file://busybox:local --dir busybox-mirror-dir --confirm
# Extract an image stored on disk in a directory other than $(pwd)/v2 into a designated directory (must exist)
oc image extract file://busybox:local --dir busybox-mirror-dir --path /:/tmp/busybox
# Extract the last layer in the image
oc image extract docker.io/library/centos:7[-1]
# Extract the first three layers of the image
oc image extract docker.io/library/centos:7[:3]
# Extract the last three layers of the image
oc image extract docker.io/library/centos:7[-3:]
2.6.1.85. oc image info リンクのコピーリンクがクリップボードにコピーされました!
イメージに関する情報を表示します。
使用例
# Show information about an image
oc image info quay.io/openshift/cli:latest
# Show information about images matching a wildcard
oc image info quay.io/openshift/cli:4.*
# Show information about a file mirrored to disk under DIR
oc image info --dir=DIR file://library/busybox:latest
# Select which image from a multi-OS image to show
oc image info library/busybox:latest --filter-by-os=linux/arm64
2.6.1.86. oc image mirror リンクのコピーリンクがクリップボードにコピーされました!
別のリポジトリーにイメージをミラーリングします。
使用例
# Copy image to another tag
oc image mirror myregistry.com/myimage:latest myregistry.com/myimage:stable
# Copy image to another registry
oc image mirror myregistry.com/myimage:latest docker.io/myrepository/myimage:stable
# Copy all tags starting with mysql to the destination repository
oc image mirror myregistry.com/myimage:mysql* docker.io/myrepository/myimage
# Copy image to disk, creating a directory structure that can be served as a registry
oc image mirror myregistry.com/myimage:latest file://myrepository/myimage:latest
# Copy image to S3 (pull from <bucket>.s3.amazonaws.com/image:latest)
oc image mirror myregistry.com/myimage:latest s3://s3.amazonaws.com/<region>/<bucket>/image:latest
# Copy image to S3 without setting a tag (pull via @<digest>)
oc image mirror myregistry.com/myimage:latest s3://s3.amazonaws.com/<region>/<bucket>/image
# Copy image to multiple locations
oc image mirror myregistry.com/myimage:latest docker.io/myrepository/myimage:stable \
docker.io/myrepository/myimage:dev
# Copy multiple images
oc image mirror myregistry.com/myimage:latest=myregistry.com/other:test \
myregistry.com/myimage:new=myregistry.com/other:target
# Copy manifest list of a multi-architecture image, even if only a single image is found
oc image mirror myregistry.com/myimage:latest=myregistry.com/other:test \
--keep-manifest-list=true
# Copy specific os/arch manifest of a multi-architecture image
# Run 'oc image info myregistry.com/myimage:latest' to see available os/arch for multi-arch images
# Note that with multi-arch images, this results in a new manifest list digest that includes only the filtered manifests
oc image mirror myregistry.com/myimage:latest=myregistry.com/other:test \
--filter-by-os=os/arch
# Copy all os/arch manifests of a multi-architecture image
# Run 'oc image info myregistry.com/myimage:latest' to see list of os/arch manifests that will be mirrored
oc image mirror myregistry.com/myimage:latest=myregistry.com/other:test \
--keep-manifest-list=true
# Note the above command is equivalent to
oc image mirror myregistry.com/myimage:latest=myregistry.com/other:test \
--filter-by-os=.*
# Copy specific os/arch manifest of a multi-architecture image
# Run 'oc image info myregistry.com/myimage:latest' to see available os/arch for multi-arch images
# Note that the target registry may reject a manifest list if the platform specific images do not all exist
# You must use a registry with sparse registry support enabled
oc image mirror myregistry.com/myimage:latest=myregistry.com/other:test \
--filter-by-os=linux/386 \
--keep-manifest-list=true
2.6.1.87. oc import-image リンクのコピーリンクがクリップボードにコピーされました!
コンテナーイメージレジストリーからイメージをインポートします。
使用例
# Import tag latest into a new image stream
oc import-image mystream --from=registry.io/repo/image:latest --confirm
# Update imported data for tag latest in an already existing image stream
oc import-image mystream
# Update imported data for tag stable in an already existing image stream
oc import-image mystream:stable
# Update imported data for all tags in an existing image stream
oc import-image mystream --all
# Update imported data for a tag that points to a manifest list to include the full manifest list
oc import-image mystream --import-mode=PreserveOriginal
# Import all tags into a new image stream
oc import-image mystream --from=registry.io/repo/image --all --confirm
# Import all tags into a new image stream using a custom timeout
oc --request-timeout=5m import-image mystream --from=registry.io/repo/image --all --confirm
2.6.1.88. oc kustomize リンクのコピーリンクがクリップボードにコピーされました!
ディレクトリーまたは URL から kustomization ターゲットをビルドします。
使用例
# Build the current working directory
oc kustomize
# Build some shared configuration directory
oc kustomize /home/config/production
# Build from github
oc kustomize https://github.com/kubernetes-sigs/kustomize.git/examples/helloWorld?ref=v1.0.6
2.6.1.89. oc label リンクのコピーリンクがクリップボードにコピーされました!
リソースのラベルを更新します。
使用例
# Update pod 'foo' with the label 'unhealthy' and the value 'true'
oc label pods foo unhealthy=true
# Update pod 'foo' with the label 'status' and the value 'unhealthy', overwriting any existing value
oc label --overwrite pods foo status=unhealthy
# Update all pods in the namespace
oc label pods --all status=unhealthy
# Update a pod identified by the type and name in "pod.json"
oc label -f pod.json status=unhealthy
# Update pod 'foo' only if the resource is unchanged from version 1
oc label pods foo status=unhealthy --resource-version=1
# Update pod 'foo' by removing a label named 'bar' if it exists
# Does not require the --overwrite flag
oc label pods foo bar-
2.6.1.90. oc login リンクのコピーリンクがクリップボードにコピーされました!
サーバーにログインします。
使用例
# Log in interactively
oc login --username=myuser
# Log in to the given server with the given certificate authority file
oc login localhost:8443 --certificate-authority=/path/to/cert.crt
# Log in to the given server with the given credentials (will not prompt interactively)
oc login localhost:8443 --username=myuser --password=mypass
# Log in to the given server through a browser
oc login localhost:8443 --web --callback-port 8280
# Log in to the external OIDC issuer through Auth Code + PKCE by starting a local server listening on port 8080
oc login localhost:8443 --exec-plugin=oc-oidc --client-id=client-id --extra-scopes=email,profile --callback-port=8080
2.6.1.91. oc logout リンクのコピーリンクがクリップボードにコピーされました!
現在のサーバーセッションを終了します。
使用例
# Log out
oc logout
2.6.1.92. oc logs リンクのコピーリンクがクリップボードにコピーされました!
Pod 内のコンテナーのログを出力します。
使用例
# Start streaming the logs of the most recent build of the openldap build config
oc logs -f bc/openldap
# Start streaming the logs of the latest deployment of the mysql deployment config
oc logs -f dc/mysql
# Get the logs of the first deployment for the mysql deployment config. Note that logs
# from older deployments may not exist either because the deployment was successful
# or due to deployment pruning or manual deletion of the deployment
oc logs --version=1 dc/mysql
# Return a snapshot of ruby-container logs from pod backend
oc logs backend -c ruby-container
# Start streaming of ruby-container logs from pod backend
oc logs -f pod/backend -c ruby-container
2.6.1.93. oc new-app リンクのコピーリンクがクリップボードにコピーされました!
新規アプリケーションを作成します。
使用例
# List all local templates and image streams that can be used to create an app
oc new-app --list
# Create an application based on the source code in the current git repository (with a public remote) and a container image
oc new-app . --image=registry/repo/langimage
# Create an application myapp with Docker based build strategy expecting binary input
oc new-app --strategy=docker --binary --name myapp
# Create a Ruby application based on the provided [image]~[source code] combination
oc new-app centos/ruby-25-centos7~https://github.com/sclorg/ruby-ex.git
# Use the public container registry MySQL image to create an app. Generated artifacts will be labeled with db=mysql
oc new-app mysql MYSQL_USER=user MYSQL_PASSWORD=pass MYSQL_DATABASE=testdb -l db=mysql
# Use a MySQL image in a private registry to create an app and override application artifacts' names
oc new-app --image=myregistry.com/mycompany/mysql --name=private
# Use an image with the full manifest list to create an app and override application artifacts' names
oc new-app --image=myregistry.com/mycompany/image --name=private --import-mode=PreserveOriginal
# Create an application from a remote repository using its beta4 branch
oc new-app https://github.com/openshift/ruby-hello-world#beta4
# Create an application based on a stored template, explicitly setting a parameter value
oc new-app --template=ruby-helloworld-sample --param=MYSQL_USER=admin
# Create an application from a remote repository and specify a context directory
oc new-app https://github.com/youruser/yourgitrepo --context-dir=src/build
# Create an application from a remote private repository and specify which existing secret to use
oc new-app https://github.com/youruser/yourgitrepo --source-secret=yoursecret
# Create an application based on a template file, explicitly setting a parameter value
oc new-app --file=./example/myapp/template.json --param=MYSQL_USER=admin
# Search all templates, image streams, and container images for the ones that match "ruby"
oc new-app --search ruby
# Search for "ruby", but only in stored templates (--template, --image-stream and --image
# can be used to filter search results)
oc new-app --search --template=ruby
# Search for "ruby" in stored templates and print the output as YAML
oc new-app --search --template=ruby --output=yaml
2.6.1.94. oc new-build リンクのコピーリンクがクリップボードにコピーされました!
新規ビルド設定を作成します。
使用例
# Create a build config based on the source code in the current git repository (with a public
# remote) and a container image
oc new-build . --image=repo/langimage
# Create a NodeJS build config based on the provided [image]~[source code] combination
oc new-build centos/nodejs-8-centos7~https://github.com/sclorg/nodejs-ex.git
# Create a build config from a remote repository using its beta2 branch
oc new-build https://github.com/openshift/ruby-hello-world#beta2
# Create a build config using a Dockerfile specified as an argument
oc new-build -D $'FROM centos:7\nRUN yum install -y httpd'
# Create a build config from a remote repository and add custom environment variables
oc new-build https://github.com/openshift/ruby-hello-world -e RACK_ENV=development
# Create a build config from a remote private repository and specify which existing secret to use
oc new-build https://github.com/youruser/yourgitrepo --source-secret=yoursecret
# Create a build config using an image with the full manifest list to create an app and override application artifacts' names
oc new-build --image=myregistry.com/mycompany/image --name=private --import-mode=PreserveOriginal
# Create a build config from a remote repository and inject the npmrc into a build
oc new-build https://github.com/openshift/ruby-hello-world --build-secret npmrc:.npmrc
# Create a build config from a remote repository and inject environment data into a build
oc new-build https://github.com/openshift/ruby-hello-world --build-config-map env:config
# Create a build config that gets its input from a remote repository and another container image
oc new-build https://github.com/openshift/ruby-hello-world --source-image=openshift/jenkins-1-centos7 --source-image-path=/var/lib/jenkins:tmp
2.6.1.95. oc new-project リンクのコピーリンクがクリップボードにコピーされました!
新規プロジェクトを要求します。
使用例
# 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.6.1.96. oc observe リンクのコピーリンクがクリップボードにコピーされました!
リソースの変更を確認し、リソースに対応します (実験的)。
使用例
# Observe changes to services
oc observe services
# Observe changes to services, including the clusterIP and invoke a script for each
oc observe services --template '{ .spec.clusterIP }' -- register_dns.sh
# Observe changes to services filtered by a label selector
oc observe services -l regist-dns=true --template '{ .spec.clusterIP }' -- register_dns.sh
2.6.1.97. oc patch リンクのコピーリンクがクリップボードにコピーされました!
リソースのフィールドを更新します。
使用例
# Partially update a node using a strategic merge patch, specifying the patch as JSON
oc patch node k8s-node-1 -p '{"spec":{"unschedulable":true}}'
# Partially update a node using a strategic merge patch, specifying the patch as YAML
oc patch node k8s-node-1 -p $'spec:\n unschedulable: true'
# Partially update a node identified by the type and name specified in "node.json" using strategic merge patch
oc patch -f node.json -p '{"spec":{"unschedulable":true}}'
# Update a container's image; spec.containers[*].name is required because it's a merge key
oc patch pod valid-pod -p '{"spec":{"containers":[{"name":"kubernetes-serve-hostname","image":"new image"}]}}'
# Update a container's image using a JSON patch with positional arrays
oc patch pod valid-pod --type='json' -p='[{"op": "replace", "path": "/spec/containers/0/image", "value":"new image"}]'
# Update a deployment's replicas through the 'scale' subresource using a merge patch
oc patch deployment nginx-deployment --subresource='scale' --type='merge' -p '{"spec":{"replicas":2}}'
2.6.1.98. oc plugin リンクのコピーリンクがクリップボードにコピーされました!
プラグインを操作するためのユーティリティーを提供します
使用例
# List all available plugins
oc plugin list
# List only binary names of available plugins without paths
oc plugin list --name-only
2.6.1.99. oc plugin list リンクのコピーリンクがクリップボードにコピーされました!
ユーザーの PATH にあるすべての表示可能なプラグイン実行可能ファイルをリスト表示します。
使用例
# List all available plugins
oc plugin list
# List only binary names of available plugins without paths
oc plugin list --name-only
2.6.1.100. oc policy add-role-to-user リンクのコピーリンクがクリップボードにコピーされました!
現在のプロジェクトのユーザーまたはサービスアカウントをロールに追加します。
使用例
# 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.6.1.101. oc policy scc-review リンクのコピーリンクがクリップボードにコピーされました!
Pod を作成できるサービスアカウントを確認します。
使用例
# Check whether service accounts sa1 and sa2 can admit a pod with a template pod spec specified in my_resource.yaml
# Service Account specified in myresource.yaml file is ignored
oc policy scc-review -z sa1,sa2 -f my_resource.yaml
# Check whether service accounts system:serviceaccount:bob:default can admit a pod with a template pod spec specified in my_resource.yaml
oc policy scc-review -z system:serviceaccount:bob:default -f my_resource.yaml
# Check whether the service account specified in my_resource_with_sa.yaml can admit the pod
oc policy scc-review -f my_resource_with_sa.yaml
# Check whether the default service account can admit the pod; default is taken since no service account is defined in myresource_with_no_sa.yaml
oc policy scc-review -f myresource_with_no_sa.yaml
2.6.1.102. oc policy scc-subject-review リンクのコピーリンクがクリップボードにコピーされました!
ユーザーまたはサービスアカウントが Pod を作成できるかどうかを確認します。
使用例
# Check whether user bob can create a pod specified in myresource.yaml
oc policy scc-subject-review -u bob -f myresource.yaml
# Check whether user bob who belongs to projectAdmin group can create a pod specified in myresource.yaml
oc policy scc-subject-review -u bob -g projectAdmin -f myresource.yaml
# Check whether a service account specified in the pod template spec in myresourcewithsa.yaml can create the pod
oc policy scc-subject-review -f myresourcewithsa.yaml
2.6.1.103. oc port-forward リンクのコピーリンクがクリップボードにコピーされました!
1 つ以上のローカルポートを Pod に転送します。
使用例
# Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in the pod
oc port-forward pod/mypod 5000 6000
# Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in a pod selected by the deployment
oc port-forward deployment/mydeployment 5000 6000
# Listen on port 8443 locally, forwarding to the targetPort of the service's port named "https" in a pod selected by the service
oc port-forward service/myservice 8443:https
# Listen on port 8888 locally, forwarding to 5000 in the pod
oc port-forward pod/mypod 8888:5000
# Listen on port 8888 on all addresses, forwarding to 5000 in the pod
oc port-forward --address 0.0.0.0 pod/mypod 8888:5000
# Listen on port 8888 on localhost and selected IP, forwarding to 5000 in the pod
oc port-forward --address localhost,10.19.21.23 pod/mypod 8888:5000
# Listen on a random port locally, forwarding to 5000 in the pod
oc port-forward pod/mypod :5000
2.6.1.104. oc process リンクのコピーリンクがクリップボードにコピーされました!
リソースのリストに対してテンプレートを処理します。
使用例
# Convert the template.json file into a resource list and pass to create
oc process -f template.json | oc create -f -
# Process a file locally instead of contacting the server
oc process -f template.json --local -o yaml
# Process template while passing a user-defined label
oc process -f template.json -l name=mytemplate
# Convert a stored template into a resource list
oc process foo
# Convert a stored template into a resource list by setting/overriding parameter values
oc process foo PARM1=VALUE1 PARM2=VALUE2
# Convert a template stored in different namespace into a resource list
oc process openshift//foo
# Convert template.json into a resource list
cat template.json | oc process -f -
2.6.1.105. oc project リンクのコピーリンクがクリップボードにコピーされました!
別のプロジェクトに切り替えます。
使用例
# Switch to the 'myapp' project
oc project myapp
# Display the project currently in use
oc project
2.6.1.106. oc projects リンクのコピーリンクがクリップボードにコピーされました!
既存プロジェクトを表示します。
使用例
# List all projects
oc projects
2.6.1.107. oc proxy リンクのコピーリンクがクリップボードにコピーされました!
Kubernetes API サーバーに対してプロキシーを実行します。
使用例
# To proxy all of the Kubernetes API and nothing else
oc proxy --api-prefix=/
# To proxy only part of the Kubernetes API and also some static files
# You can get pods info with 'curl localhost:8001/api/v1/pods'
oc proxy --www=/my/files --www-prefix=/static/ --api-prefix=/api/
# To proxy the entire Kubernetes API at a different root
# You can get pods info with 'curl localhost:8001/custom/api/v1/pods'
oc proxy --api-prefix=/custom/
# Run a proxy to the Kubernetes API server on port 8011, serving static content from ./local/www/
oc proxy --port=8011 --www=./local/www/
# Run a proxy to the Kubernetes API server on an arbitrary local port
# The chosen port for the server will be output to stdout
oc proxy --port=0
# Run a proxy to the Kubernetes API server, changing the API prefix to k8s-api
# This makes e.g. the pods API available at localhost:8001/k8s-api/v1/pods/
oc proxy --api-prefix=/k8s-api
2.6.1.108. oc registry login リンクのコピーリンクがクリップボードにコピーされました!
統合レジストリーにログインします。
使用例
# 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.6.1.109. oc replace リンクのコピーリンクがクリップボードにコピーされました!
リソースをファイル名または標準入力 (stdin) に置き換えます。
使用例
# Replace a pod using the data in pod.json
oc replace -f ./pod.json
# Replace a pod based on the JSON passed into stdin
cat pod.json | oc replace -f -
# Update a single-container pod's image version (tag) to v4
oc get pod mypod -o yaml | sed 's/\(image: myimage\):.*$/\1:v4/' | oc replace -f -
# Force replace, delete and then re-create the resource
oc replace --force -f ./pod.json
2.6.1.110. oc rollback リンクのコピーリンクがクリップボードにコピーされました!
アプリケーションの一部を以前のデプロイメントに戻します。
使用例
# Perform a rollback to the last successfully completed deployment for a deployment config
oc rollback frontend
# See what a rollback to version 3 will look like, but do not perform the rollback
oc rollback frontend --to-version=3 --dry-run
# Perform a rollback to a specific deployment
oc rollback frontend-2
# Perform the rollback manually by piping the JSON of the new config back to oc
oc rollback frontend -o json | oc replace dc/frontend -f -
# Print the updated deployment configuration in JSON format instead of performing the rollback
oc rollback frontend -o json
2.6.1.111. oc rollout リンクのコピーリンクがクリップボードにコピーされました!
リソースのロールアウトを管理します
使用例
# Roll back to the previous deployment
oc rollout undo deployment/abc
# Check the rollout status of a daemonset
oc rollout status daemonset/foo
# Restart a deployment
oc rollout restart deployment/abc
# Restart deployments with the 'app=nginx' label
oc rollout restart deployment --selector=app=nginx
2.6.1.112. oc rollout cancel リンクのコピーリンクがクリップボードにコピーされました!
進行中のデプロイメントをキャンセルします。
使用例
# Cancel the in-progress deployment based on 'nginx'
oc rollout cancel dc/nginx
2.6.1.113. oc rollout history リンクのコピーリンクがクリップボードにコピーされました!
ロールアウト履歴を表示します。
使用例
# View the rollout history of a deployment
oc rollout history deployment/abc
# View the details of daemonset revision 3
oc rollout history daemonset/abc --revision=3
2.6.1.114. oc rollout latest リンクのコピーリンクがクリップボードにコピーされました!
トリガーからの最新状態を使用して、デプロイメント設定の新規ロールアウトを開始します。
使用例
# 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.6.1.115. oc rollout pause リンクのコピーリンクがクリップボードにコピーされました!
提供されたリソースを一時停止としてマークします。
使用例
# 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 deployment/nginx
2.6.1.116. oc rollout restart リンクのコピーリンクがクリップボードにコピーされました!
リソースを再起動します。
使用例
# Restart all deployments in the test-namespace namespace
oc rollout restart deployment -n test-namespace
# Restart a deployment
oc rollout restart deployment/nginx
# Restart a daemon set
oc rollout restart daemonset/abc
# Restart deployments with the app=nginx label
oc rollout restart deployment --selector=app=nginx
2.6.1.117. oc rollout resume リンクのコピーリンクがクリップボードにコピーされました!
一時停止したリソースを再開します。
使用例
# Resume an already paused deployment
oc rollout resume deployment/nginx
2.6.1.118. oc rollout retry リンクのコピーリンクがクリップボードにコピーされました!
失敗したロールアウトを再試行します。
使用例
# 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.6.1.119. oc rollout status リンクのコピーリンクがクリップボードにコピーされました!
ロールアウトのステータスを表示します。
使用例
# Watch the rollout status of a deployment
oc rollout status deployment/nginx
2.6.1.120. oc rollout undo リンクのコピーリンクがクリップボードにコピーされました!
以前のロールアウトを元に戻します。
使用例
# Roll back to the previous deployment
oc rollout undo deployment/abc
# Roll back to daemonset revision 3
oc rollout undo daemonset/abc --to-revision=3
# Roll back to the previous deployment with dry-run
oc rollout undo --dry-run=server deployment/abc
2.6.1.121. oc rsh リンクのコピーリンクがクリップボードにコピーされました!
コンテナーでシェルセッションを開始します。
使用例
# Open a shell session on the first container in pod 'foo'
oc rsh foo
# Open a shell session on the first container in pod 'foo' and namespace 'bar'
# (Note that oc client specific arguments must come before the resource name and its arguments)
oc rsh -n bar foo
# Run the command 'cat /etc/resolv.conf' inside pod 'foo'
oc rsh foo cat /etc/resolv.conf
# See the configuration of your internal registry
oc rsh dc/docker-registry cat config.yml
# Open a shell session on the container named 'index' inside a pod of your job
oc rsh -c index job/scheduled
2.6.1.122. oc rsync リンクのコピーリンクがクリップボードにコピーされました!
ローカルファイルシステムと Pod 間でファイルをコピーします。
使用例
# 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.6.1.123. oc run リンクのコピーリンクがクリップボードにコピーされました!
クラスターで特定のイメージを実行します。
使用例
# Start a nginx pod
oc run nginx --image=nginx
# Start a hazelcast pod and let the container expose port 5701
oc run hazelcast --image=hazelcast/hazelcast --port=5701
# Start a hazelcast pod and set environment variables "DNS_DOMAIN=cluster" and "POD_NAMESPACE=default" in the container
oc run hazelcast --image=hazelcast/hazelcast --env="DNS_DOMAIN=cluster" --env="POD_NAMESPACE=default"
# Start a hazelcast pod and set labels "app=hazelcast" and "env=prod" in the container
oc run hazelcast --image=hazelcast/hazelcast --labels="app=hazelcast,env=prod"
# Dry run; print the corresponding API objects without creating them
oc run nginx --image=nginx --dry-run=client
# Start a nginx pod, but overload the spec with a partial set of values parsed from JSON
oc run nginx --image=nginx --overrides='{ "apiVersion": "v1", "spec": { ... } }'
# Start a busybox pod and keep it in the foreground, don't restart it if it exits
oc run -i -t busybox --image=busybox --restart=Never
# Start the nginx pod using the default command, but use custom arguments (arg1 .. argN) for that command
oc run nginx --image=nginx -- <arg1> <arg2> ... <argN>
# Start the nginx pod using a different command and custom arguments
oc run nginx --image=nginx --command -- <cmd> <arg1> ... <argN>
2.6.1.124. oc scale リンクのコピーリンクがクリップボードにコピーされました!
デプロイメント、レプリカセット、またはレプリケーションコントローラーに新規サイズを設定します。
使用例
# Scale a replica set named 'foo' to 3
oc scale --replicas=3 rs/foo
# Scale a resource identified by type and name specified in "foo.yaml" to 3
oc scale --replicas=3 -f foo.yaml
# If the deployment named mysql's current size is 2, scale mysql to 3
oc scale --current-replicas=2 --replicas=3 deployment/mysql
# Scale multiple replication controllers
oc scale --replicas=5 rc/example1 rc/example2 rc/example3
# Scale stateful set named 'web' to 3
oc scale --replicas=3 statefulset/web
2.6.1.125. oc secrets link リンクのコピーリンクがクリップボードにコピーされました!
サービスアカウントにシークレットをリンクします。
使用例
# 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.6.1.126. oc secrets unlink リンクのコピーリンクがクリップボードにコピーされました!
サービスアカウントからシークレットをデタッチします。
使用例
# Unlink a secret currently associated with a service account
oc secrets unlink serviceaccount-name secret-name another-secret-name ...
2.6.1.127. oc set build-hook リンクのコピーリンクがクリップボードにコピーされました!
ビルド設定のビルドフックを更新します。
使用例
# Clear post-commit hook on a build config
oc set build-hook bc/mybuild --post-commit --remove
# Set the post-commit hook to execute a test suite using a new entrypoint
oc set build-hook bc/mybuild --post-commit --command -- /bin/bash -c /var/lib/test-image.sh
# Set the post-commit hook to execute a shell script
oc set build-hook bc/mybuild --post-commit --script="/var/lib/test-image.sh param1 param2 && /var/lib/done.sh"
2.6.1.128. oc set build-secret リンクのコピーリンクがクリップボードにコピーされました!
ビルド設定のビルドシークレットを更新します。
使用例
# Clear the push secret on a build config
oc set build-secret --push --remove bc/mybuild
# Set the pull secret on a build config
oc set build-secret --pull bc/mybuild mysecret
# Set the push and pull secret on a build config
oc set build-secret --push --pull bc/mybuild mysecret
# Set the source secret on a set of build configs matching a selector
oc set build-secret --source -l app=myapp gitsecret
2.6.1.129. oc set data リンクのコピーリンクがクリップボードにコピーされました!
config map またはシークレット内のデータを更新します。
使用例
# Set the 'password' key of a secret
oc set data secret/foo password=this_is_secret
# Remove the 'password' key from a secret
oc set data secret/foo password-
# Update the 'haproxy.conf' key of a config map from a file on disk
oc set data configmap/bar --from-file=../haproxy.conf
# Update a secret with the contents of a directory, one key per file
oc set data secret/foo --from-file=secret-dir
2.6.1.130. oc set deployment-hook リンクのコピーリンクがクリップボードにコピーされました!
デプロイメント設定のデプロイメントフックを更新します。
使用例
# Clear pre and post hooks on a deployment config
oc set deployment-hook dc/myapp --remove --pre --post
# Set the pre deployment hook to execute a db migration command for an application
# using the data volume from the application
oc set deployment-hook dc/myapp --pre --volumes=data -- /var/lib/migrate-db.sh
# Set a mid deployment hook along with additional environment variables
oc set deployment-hook dc/myapp --mid --volumes=data -e VAR1=value1 -e VAR2=value2 -- /var/lib/prepare-deploy.sh
2.6.1.131. oc set env リンクのコピーリンクがクリップボードにコピーされました!
Pod テンプレートの環境変数を更新します。
使用例
# Update deployment config 'myapp' with a new environment variable
oc set env dc/myapp STORAGE_DIR=/local
# List the environment variables defined on a build config 'sample-build'
oc set env bc/sample-build --list
# List the environment variables defined on all pods
oc set env pods --all --list
# Output modified build config in YAML
oc set env bc/sample-build STORAGE_DIR=/data -o yaml
# Update all containers in all replication controllers in the project to have ENV=prod
oc set env rc --all ENV=prod
# Import environment from a secret
oc set env --from=secret/mysecret dc/myapp
# Import environment from a config map with a prefix
oc set env --from=configmap/myconfigmap --prefix=MYSQL_ dc/myapp
# Remove the environment variable ENV from container 'c1' in all deployment configs
oc set env dc --all --containers="c1" ENV-
# Remove the environment variable ENV from a deployment config definition on disk and
# update the deployment config on the server
oc set env -f dc.json ENV-
# Set some of the local shell environment into a deployment config on the server
oc set env | grep RAILS_ | oc env -e - dc/myapp
2.6.1.132. oc set image リンクのコピーリンクがクリップボードにコピーされました!
Pod テンプレートのイメージを更新します。
使用例
# Set a deployment config's nginx container image to 'nginx:1.9.1', and its busybox container image to 'busybox'.
oc set image dc/nginx busybox=busybox nginx=nginx:1.9.1
# Set a deployment config's app container image to the image referenced by the imagestream tag 'openshift/ruby:2.3'.
oc set image dc/myapp app=openshift/ruby:2.3 --source=imagestreamtag
# Update all deployments' and rc's nginx container's image to 'nginx:1.9.1'
oc set image deployments,rc nginx=nginx:1.9.1 --all
# Update image of all containers of daemonset abc to 'nginx:1.9.1'
oc set image daemonset abc *=nginx:1.9.1
# Print result (in YAML format) of updating nginx container image from local file, without hitting the server
oc set image -f path/to/file.yaml nginx=nginx:1.9.1 --local -o yaml
2.6.1.133. oc set image-lookup リンクのコピーリンクがクリップボードにコピーされました!
アプリケーションのデプロイ時にイメージを解決する方法を変更します。
使用例
# Print all of the image streams and whether they resolve local names
oc set image-lookup
# Use local name lookup on image stream mysql
oc set image-lookup mysql
# Force a deployment to use local name lookup
oc set image-lookup deploy/mysql
# Show the current status of the deployment lookup
oc set image-lookup deploy/mysql --list
# Disable local name lookup on image stream mysql
oc set image-lookup mysql --enabled=false
# Set local name lookup on all image streams
oc set image-lookup --all
2.6.1.134. oc set probe リンクのコピーリンクがクリップボードにコピーされました!
Pod テンプレートでプローブを更新します。
使用例
# Clear both readiness and liveness probes off all containers
oc set probe dc/myapp --remove --readiness --liveness
# Set an exec action as a liveness probe to run 'echo ok'
oc set probe dc/myapp --liveness -- echo ok
# Set a readiness probe to try to open a TCP socket on 3306
oc set probe rc/mysql --readiness --open-tcp=3306
# Set an HTTP startup probe for port 8080 and path /healthz over HTTP on the pod IP
oc set probe dc/webapp --startup --get-url=http://:8080/healthz
# Set an HTTP readiness probe for port 8080 and path /healthz over HTTP on the pod IP
oc set probe dc/webapp --readiness --get-url=http://:8080/healthz
# Set an HTTP readiness probe over HTTPS on 127.0.0.1 for a hostNetwork pod
oc set probe dc/router --readiness --get-url=https://127.0.0.1:1936/stats
# Set only the initial-delay-seconds field on all deployments
oc set probe dc --all --readiness --initial-delay-seconds=30
2.6.1.135. oc set resources リンクのコピーリンクがクリップボードにコピーされました!
オブジェクトのリソース要求/制限を Pod テンプレートで更新します。
使用例
# Set a deployments nginx container CPU limits to "200m and memory to 512Mi"
oc set resources deployment nginx -c=nginx --limits=cpu=200m,memory=512Mi
# Set the resource request and limits for all containers in nginx
oc set resources deployment nginx --limits=cpu=200m,memory=512Mi --requests=cpu=100m,memory=256Mi
# Remove the resource requests for resources on containers in nginx
oc set resources deployment nginx --limits=cpu=0,memory=0 --requests=cpu=0,memory=0
# Print the result (in YAML format) of updating nginx container limits locally, without hitting the server
oc set resources -f path/to/file.yaml --limits=cpu=200m,memory=512Mi --local -o yaml
2.6.1.136. oc set route-backends リンクのコピーリンクがクリップボードにコピーされました!
ルートのバックエンドを更新します。
使用例
# Print the backends on the route 'web'
oc set route-backends web
# Set two backend services on route 'web' with 2/3rds of traffic going to 'a'
oc set route-backends web a=2 b=1
# Increase the traffic percentage going to b by 10%% relative to a
oc set route-backends web --adjust b=+10%%
# Set traffic percentage going to b to 10%% of the traffic going to a
oc set route-backends web --adjust b=10%%
# Set weight of b to 10
oc set route-backends web --adjust b=10
# Set the weight to all backends to zero
oc set route-backends web --zero
2.6.1.137. oc set selector リンクのコピーリンクがクリップボードにコピーされました!
リソースにセレクターを設定します。
使用例
# 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.6.1.138. oc set serviceaccount リンクのコピーリンクがクリップボードにコピーされました!
リソースのサービスアカウントを更新します。
使用例
# 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.6.1.139. oc set subject リンクのコピーリンクがクリップボードにコピーされました!
ロールバインディングまたはクラスターロールバインディングでユーザー、グループ、またはサービスアカウントを更新します。
使用例
# Update a cluster role binding for serviceaccount1
oc set subject clusterrolebinding admin --serviceaccount=namespace:serviceaccount1
# Update a role binding for user1, user2, and group1
oc set subject rolebinding admin --user=user1 --user=user2 --group=group1
# Print the result (in YAML format) of updating role binding subjects locally, without hitting the server
oc create rolebinding admin --role=admin --user=admin -o yaml --dry-run | oc set subject --local -f - --user=foo -o yaml
2.6.1.140. oc set triggers リンクのコピーリンクがクリップボードにコピーされました!
1 つ以上のオブジェクトでトリガーを更新します。
使用例
# Print the triggers on the deployment config 'myapp'
oc set triggers dc/myapp
# Set all triggers to manual
oc set triggers dc/myapp --manual
# Enable all automatic triggers
oc set triggers dc/myapp --auto
# Reset the GitHub webhook on a build to a new, generated secret
oc set triggers bc/webapp --from-github
oc set triggers bc/webapp --from-webhook
# Remove all triggers
oc set triggers bc/webapp --remove-all
# Stop triggering on config change
oc set triggers dc/myapp --from-config --remove
# Add an image trigger to a build config
oc set triggers bc/webapp --from-image=namespace1/image:latest
# Add an image trigger to a stateful set on the main container
oc set triggers statefulset/db --from-image=namespace1/image:latest -c main
2.6.1.141. oc set volumes リンクのコピーリンクがクリップボードにコピーされました!
Pod テンプレートでボリュームを更新します。
使用例
# List volumes defined on all deployment configs in the current project
oc set volume dc --all
# Add a new empty dir volume to deployment config (dc) 'myapp' mounted under
# /var/lib/myapp
oc set volume dc/myapp --add --mount-path=/var/lib/myapp
# Use an existing persistent volume claim (PVC) to overwrite an existing volume 'v1'
oc set volume dc/myapp --add --name=v1 -t pvc --claim-name=pvc1 --overwrite
# Remove volume 'v1' from deployment config 'myapp'
oc set volume dc/myapp --remove --name=v1
# Create a new persistent volume claim that overwrites an existing volume 'v1'
oc set volume dc/myapp --add --name=v1 -t pvc --claim-size=1G --overwrite
# Change the mount point for volume 'v1' to /data
oc set volume dc/myapp --add --name=v1 -m /data --overwrite
# Modify the deployment config by removing volume mount "v1" from container "c1"
# (and by removing the volume "v1" if no other containers have volume mounts that reference it)
oc set volume dc/myapp --remove --name=v1 --containers=c1
# Add new volume based on a more complex volume source (AWS EBS, GCE PD,
# Ceph, Gluster, NFS, ISCSI, ...)
oc set volume dc/myapp --add -m /data --source=<json-string>
2.6.1.142. oc start-build リンクのコピーリンクがクリップボードにコピーされました!
新しいビルドを開始します。
使用例
# Starts build from build config "hello-world"
oc start-build hello-world
# Starts build from a previous build "hello-world-1"
oc start-build --from-build=hello-world-1
# Use the contents of a directory as build input
oc start-build hello-world --from-dir=src/
# Send the contents of a Git repository to the server from tag 'v2'
oc start-build hello-world --from-repo=../hello-world --commit=v2
# Start a new build for build config "hello-world" and watch the logs until the build
# completes or fails
oc start-build hello-world --follow
# Start a new build for build config "hello-world" and wait until the build completes. It
# exits with a non-zero return code if the build fails
oc start-build hello-world --wait
2.6.1.143. oc status リンクのコピーリンクがクリップボードにコピーされました!
現在のプロジェクトの概要を表示します。
使用例
# See an overview of the current project
oc status
# Export the overview of the current project in an svg file
oc status -o dot | dot -T svg -o project.svg
# See an overview of the current project including details for any identified issues
oc status --suggest
2.6.1.144. oc tag リンクのコピーリンクがクリップボードにコピーされました!
既存のイメージをイメージストリームにタグ付けします。
使用例
# Tag the current image for the image stream 'openshift/ruby' and tag '2.0' into the image stream 'yourproject/ruby with tag 'tip'
oc tag openshift/ruby:2.0 yourproject/ruby:tip
# Tag a specific image
oc tag openshift/ruby@sha256:6b646fa6bf5e5e4c7fa41056c27910e679c03ebe7f93e361e6515a9da7e258cc yourproject/ruby:tip
# Tag an external container image
oc tag --source=docker openshift/origin-control-plane:latest yourproject/ruby:tip
# Tag an external container image and request pullthrough for it
oc tag --source=docker openshift/origin-control-plane:latest yourproject/ruby:tip --reference-policy=local
# Tag an external container image and include the full manifest list
oc tag --source=docker openshift/origin-control-plane:latest yourproject/ruby:tip --import-mode=PreserveOriginal
# Remove the specified spec tag from an image stream
oc tag openshift/origin-control-plane:latest -d
2.6.1.145. oc version リンクのコピーリンクがクリップボードにコピーされました!
クライアントおよびサーバーのバージョン情報を出力します。
使用例
# Print the OpenShift client, kube-apiserver, and openshift-apiserver version information for the current context
oc version
# Print the OpenShift client, kube-apiserver, and openshift-apiserver version numbers for the current context in JSON format
oc version --output json
# Print the OpenShift client version information for the current context
oc version --client
2.6.1.146. oc wait リンクのコピーリンクがクリップボードにコピーされました!
実験的: 1 つ以上のリソースの特定の条件を待機します。
使用例
# Wait for the pod "busybox1" to contain the status condition of type "Ready"
oc wait --for=condition=Ready pod/busybox1
# The default value of status condition is true; you can wait for other targets after an equal delimiter (compared after Unicode simple case folding, which is a more general form of case-insensitivity)
oc wait --for=condition=Ready=false pod/busybox1
# Wait for the pod "busybox1" to contain the status phase to be "Running"
oc wait --for=jsonpath='{.status.phase}'=Running pod/busybox1
# Wait for pod "busybox1" to be Ready
oc wait --for='jsonpath={.status.conditions[?(@.type=="Ready")].status}=True' pod/busybox1
# Wait for the service "loadbalancer" to have ingress
oc wait --for=jsonpath='{.status.loadBalancer.ingress}' service/loadbalancer
# Wait for the secret "busybox1" to be created, with a timeout of 30s
oc create secret generic busybox1
oc wait --for=create secret/busybox1 --timeout=30s
# Wait for the pod "busybox1" to be deleted, with a timeout of 60s, after having issued the "delete" command
oc delete pod/busybox1
oc wait --for=delete pod/busybox1 --timeout=60s
2.6.1.147. oc whoami リンクのコピーリンクがクリップボードにコピーされました!
現行セッションに関する情報を返します。
使用例
# Display the currently authenticated user
oc whoami
2.7. OpenShift CLI 管理者コマンドリファレンス リンクのコピーリンクがクリップボードにコピーされました!
このリファレンスは、OpenShift CLI (oc) 管理者コマンドの説明およびコマンド例を示しています。これらのコマンドを使用するには、cluster-admin または同等のパーミッションが必要です。
開発者コマンドは、OpenShift CLI 開発者コマンドリファレンス を参照してください。
oc adm -h を実行して、すべての管理者コマンドを表示するか、oc <command> --help を実行して、特定のコマンドに関する追加情報を取得します。
2.7.1. OpenShift CLI (oc) 管理者コマンド リンクのコピーリンクがクリップボードにコピーされました!
2.7.1.1. oc adm build-chain リンクのコピーリンクがクリップボードにコピーされました!
ビルドの入力と依存関係を出力します。
使用例
# Build the dependency tree for the 'latest' tag in <image-stream>
oc adm build-chain <image-stream>
# Build the dependency tree for the 'v2' tag in dot format and visualize it via the dot utility
oc adm build-chain <image-stream>:v2 -o dot | dot -T svg -o deps.svg
# Build the dependency tree across all namespaces for the specified image stream tag found in the 'test' namespace
oc adm build-chain <image-stream> -n test --all
2.7.1.2. oc adm catalog mirror リンクのコピーリンクがクリップボードにコピーされました!
operator-registry カタログをミラーリングします。
使用例
# Mirror an operator-registry image and its contents to a registry
oc adm catalog mirror quay.io/my/image:latest myregistry.com
# Mirror an operator-registry image and its contents to a particular namespace in a registry
oc adm catalog mirror quay.io/my/image:latest myregistry.com/my-namespace
# Mirror to an airgapped registry by first mirroring to files
oc adm catalog mirror quay.io/my/image:latest file:///local/index
oc adm catalog mirror file:///local/index/my/image:latest my-airgapped-registry.com
# Configure a cluster to use a mirrored registry
oc apply -f manifests/imageDigestMirrorSet.yaml
# Edit the mirroring mappings and mirror with "oc image mirror" manually
oc adm catalog mirror --manifests-only quay.io/my/image:latest myregistry.com
oc image mirror -f manifests/mapping.txt
# Delete all ImageDigestMirrorSets generated by oc adm catalog mirror
oc delete imagedigestmirrorset -l operators.openshift.org/catalog=true
2.7.1.3. oc adm certificate approve リンクのコピーリンクがクリップボードにコピーされました!
証明書署名リクエストを承認します。
使用例
# Approve CSR 'csr-sqgzp'
oc adm certificate approve csr-sqgzp
2.7.1.4. oc adm certificate deny リンクのコピーリンクがクリップボードにコピーされました!
証明書署名リクエストを拒否します。
使用例
# Deny CSR 'csr-sqgzp'
oc adm certificate deny csr-sqgzp
2.7.1.5. oc adm copy-to-node リンクのコピーリンクがクリップボードにコピーされました!
指定されたファイルをノードにコピーする
使用例
# Copy a new bootstrap kubeconfig file to node-0
oc adm copy-to-node --copy=new-bootstrap-kubeconfig=/etc/kubernetes/kubeconfig node/node-0
2.7.1.6. oc adm cordon リンクのコピーリンクがクリップボードにコピーされました!
ノードにスケジュール対象外 (unschedulable) のマークを付けます。
使用例
# Mark node "foo" as unschedulable
oc adm cordon foo
2.7.1.7. oc adm create-bootstrap-project-template リンクのコピーリンクがクリップボードにコピーされました!
ブートストラッププロジェクトテンプレートを作成します。
使用例
# Output a bootstrap project template in YAML format to stdout
oc adm create-bootstrap-project-template -o yaml
2.7.1.8. oc adm create-error-template リンクのコピーリンクがクリップボードにコピーされました!
エラーページのテンプレートを作成します。
使用例
# Output a template for the error page to stdout
oc adm create-error-template
2.7.1.9. oc adm create-login-template リンクのコピーリンクがクリップボードにコピーされました!
ログインテンプレートを作成します。
使用例
# Output a template for the login page to stdout
oc adm create-login-template
2.7.1.10. oc adm create-provider-selection-template リンクのコピーリンクがクリップボードにコピーされました!
プロバイダー選択のテンプレートを作成します。
使用例
# Output a template for the provider selection page to stdout
oc adm create-provider-selection-template
2.7.1.11. oc adm drain リンクのコピーリンクがクリップボードにコピーされました!
ノードをドレイン (解放) してメンテナンスを準備します。
使用例
# 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.7.1.12. oc adm groups add-users リンクのコピーリンクがクリップボードにコピーされました!
ユーザーをグループに追加します。
使用例
# Add user1 and user2 to my-group
oc adm groups add-users my-group user1 user2
2.7.1.13. oc adm groups new リンクのコピーリンクがクリップボードにコピーされました!
新規グループを作成します。
使用例
# Add a group with no users
oc adm groups new my-group
# Add a group with two users
oc adm groups new my-group user1 user2
# Add a group with one user and shorter output
oc adm groups new my-group user1 -o name
2.7.1.14. oc adm groups prune リンクのコピーリンクがクリップボードにコピーされました!
外部プロバイダーから欠落しているレコードを参照する以前の OpenShift グループを削除します。
使用例
# Prune all orphaned groups
oc adm groups prune --sync-config=/path/to/ldap-sync-config.yaml --confirm
# Prune all orphaned groups except the ones from the denylist file
oc adm groups prune --blacklist=/path/to/denylist.txt --sync-config=/path/to/ldap-sync-config.yaml --confirm
# Prune all orphaned groups from a list of specific groups specified in an allowlist file
oc adm groups prune --whitelist=/path/to/allowlist.txt --sync-config=/path/to/ldap-sync-config.yaml --confirm
# Prune all orphaned groups from a list of specific groups specified in a list
oc adm groups prune groups/group_name groups/other_name --sync-config=/path/to/ldap-sync-config.yaml --confirm
2.7.1.15. oc adm groups remove-users リンクのコピーリンクがクリップボードにコピーされました!
グループからユーザーを削除します。
使用例
# Remove user1 and user2 from my-group
oc adm groups remove-users my-group user1 user2
2.7.1.16. oc adm groups sync リンクのコピーリンクがクリップボードにコピーされました!
OpenShift グループと外部プロバイダーからのレコードを同期します。
使用例
# Sync all groups with an LDAP server
oc adm groups sync --sync-config=/path/to/ldap-sync-config.yaml --confirm
# Sync all groups except the ones from the blacklist file with an LDAP server
oc adm groups sync --blacklist=/path/to/blacklist.txt --sync-config=/path/to/ldap-sync-config.yaml --confirm
# Sync specific groups specified in an allowlist file with an LDAP server
oc adm groups sync --whitelist=/path/to/allowlist.txt --sync-config=/path/to/sync-config.yaml --confirm
# Sync all OpenShift groups that have been synced previously with an LDAP server
oc adm groups sync --type=openshift --sync-config=/path/to/ldap-sync-config.yaml --confirm
# Sync specific OpenShift groups if they have been synced previously with an LDAP server
oc adm groups sync groups/group1 groups/group2 groups/group3 --sync-config=/path/to/sync-config.yaml --confirm
2.7.1.17. oc adm inspect リンクのコピーリンクがクリップボードにコピーされました!
指定のリソースのデバッグデータを収集します。
使用例
# Collect debugging data for the "openshift-apiserver" clusteroperator
oc adm inspect clusteroperator/openshift-apiserver
# Collect debugging data for the "openshift-apiserver" and "kube-apiserver" clusteroperators
oc adm inspect clusteroperator/openshift-apiserver clusteroperator/kube-apiserver
# Collect debugging data for all clusteroperators
oc adm inspect clusteroperator
# Collect debugging data for all clusteroperators and clusterversions
oc adm inspect clusteroperators,clusterversions
2.7.1.18. oc adm migrate icsp リンクのコピーリンクがクリップボードにコピーされました!
imagecontentsourcepolicy ファイルを imagedigestmirrorset ファイルに更新します。
使用例
# Update the imagecontentsourcepolicy.yaml file to a new imagedigestmirrorset file under the mydir directory
oc adm migrate icsp imagecontentsourcepolicy.yaml --dest-dir mydir
2.7.1.19. oc adm migrate template-instances リンクのコピーリンクがクリップボードにコピーされました!
テンプレートインスタンスを更新して、最新の group-version-kinds を参照するようにします。
使用例
# 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.7.1.20. oc adm must-gather リンクのコピーリンクがクリップボードにコピーされました!
Pod の新規インスタンスを起動してデバッグ情報を収集します。
使用例
# Gather information using the default plug-in image and command, writing into ./must-gather.local.<rand>
oc adm must-gather
# Gather information with a specific local folder to copy to
oc adm must-gather --dest-dir=/local/directory
# Gather audit information
oc adm must-gather -- /usr/bin/gather_audit_logs
# Gather information using multiple plug-in images
oc adm must-gather --image=quay.io/kubevirt/must-gather --image=quay.io/openshift/origin-must-gather
# Gather information using a specific image stream plug-in
oc adm must-gather --image-stream=openshift/must-gather:latest
# Gather information using a specific image, command, and pod directory
oc adm must-gather --image=my/image:tag --source-dir=/pod/directory -- myspecial-command.sh
2.7.1.21. oc adm new-project リンクのコピーリンクがクリップボードにコピーされました!
新規プロジェクトを作成します。
使用例
# Create a new project using a node selector
oc adm new-project myproject --node-selector='type=user-node,region=east'
2.7.1.22. oc adm node-image create リンクのコピーリンクがクリップボードにコピーされました!
ターゲットクラスターに追加するノードを起動するための ISO イメージを作成する
使用例
# Create the ISO image and download it in the current folder
oc adm node-image create
# Use a different assets folder
oc adm node-image create --dir=/tmp/assets
# Specify a custom image name
oc adm node-image create -o=my-node.iso
# In place of an ISO, creates files that can be used for PXE boot
oc adm node-image create --pxe
# Create an ISO to add a single node without using the configuration file
oc adm node-image create --mac-address=00:d8:e7:c7:4b:bb
# Create an ISO to add a single node with a root device hint and without
# using the configuration file
oc adm node-image create --mac-address=00:d8:e7:c7:4b:bb --root-device-hint=deviceName:/dev/sda
2.7.1.23. oc adm node-image monitor リンクのコピーリンクがクリップボードにコピーされました!
OpenShift クラスターに追加される新しいノードを監視する
使用例
# Monitor a single node being added to a cluster
oc adm node-image monitor --ip-addresses 192.168.111.83
# Monitor multiple nodes being added to a cluster by separating each
# IP address with a comma
oc adm node-image monitor --ip-addresses 192.168.111.83,192.168.111.84
2.7.1.24. oc adm node-logs リンクのコピーリンクがクリップボードにコピーされました!
ノードのログを表示し、フィルターします。
使用例
# Show kubelet logs from all control plane nodes
oc adm node-logs --role master -u kubelet
# See what logs are available in control plane nodes in /var/log
oc adm node-logs --role master --path=/
# Display cron log file from all control plane nodes
oc adm node-logs --role master --path=cron
2.7.1.25. oc adm ocp-certificates monitor-certificates リンクのコピーリンクがクリップボードにコピーされました!
プラットフォーム証明書を監視します。
使用例
# Watch platform certificates
oc adm ocp-certificates monitor-certificates
2.7.1.26. oc adm ocp-certificates regenerate-leaf リンクのコピーリンクがクリップボードにコピーされました!
OpenShift クラスターのクライアント証明書とサービング証明書を再生成する
使用例
# Regenerate a leaf certificate contained in a particular secret
oc adm ocp-certificates regenerate-leaf -n openshift-config-managed secret/kube-controller-manager-client-cert-key
2.7.1.27. oc adm ocp-certificates regenerate-machine-config-server-serving-cert リンクのコピーリンクがクリップボードにコピーされました!
OpenShift クラスターで Machine Config Operator 証明書を再生成する
使用例
# Regenerate the MCO certs without modifying user-data secrets
oc adm ocp-certificates regenerate-machine-config-server-serving-cert --update-ignition=false
# Update the user-data secrets to use new MCS certs
oc adm ocp-certificates update-ignition-ca-bundle-for-machine-config-server
2.7.1.28. oc adm ocp-certificates regenerate-top-level リンクのコピーリンクがクリップボードにコピーされました!
OpenShift クラスター内のトップレベルの証明書を再生成する
使用例
# Regenerate the signing certificate contained in a particular secret
oc adm ocp-certificates regenerate-top-level -n openshift-kube-apiserver-operator secret/loadbalancer-serving-signer-key
2.7.1.29. oc adm ocp-certificates remove-old-trust リンクのコピーリンクがクリップボードにコピーされました!
OpenShift クラスター内のプラットフォーム信頼バンドルを表す ConfigMap から古い CA を削除する
使用例
# Remove a trust bundled contained in a particular config map
oc adm ocp-certificates remove-old-trust -n openshift-config-managed configmaps/kube-apiserver-aggregator-client-ca --created-before 2023-06-05T14:44:06Z
# Remove only CA certificates created before a certain date from all trust bundles
oc adm ocp-certificates remove-old-trust configmaps -A --all --created-before 2023-06-05T14:44:06Z
2.7.1.30. oc adm ocp-certificates update-ignition-ca-bundle-for-machine-config-server リンクのコピーリンクがクリップボードにコピーされました!
更新された MCO 証明書を使用するように OpenShift クラスター内のユーザーデータシークレットを更新する
使用例
# Regenerate the MCO certs without modifying user-data secrets
oc adm ocp-certificates regenerate-machine-config-server-serving-cert --update-ignition=false
# Update the user-data secrets to use new MCS certs
oc adm ocp-certificates update-ignition-ca-bundle-for-machine-config-server
2.7.1.31. oc adm policy add-cluster-role-to-group リンクのコピーリンクがクリップボードにコピーされました!
クラスター内のすべてのプロジェクトのグループにロールを追加する
使用例
# Add the 'cluster-admin' cluster role to the 'cluster-admins' group
oc adm policy add-cluster-role-to-group cluster-admin cluster-admins
2.7.1.32. oc adm policy add-cluster-role-to-user リンクのコピーリンクがクリップボードにコピーされました!
クラスター内のすべてのプロジェクトのユーザーにロールを追加する
使用例
# Add the 'system:build-strategy-docker' cluster role to the 'devuser' user
oc adm policy add-cluster-role-to-user system:build-strategy-docker devuser
2.7.1.33. oc adm policy add-role-to-user リンクのコピーリンクがクリップボードにコピーされました!
現在のプロジェクトのユーザーまたはサービスアカウントをロールに追加します。
使用例
# 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.7.1.34. oc adm policy add-scc-to-group リンクのコピーリンクがクリップボードにコピーされました!
Security Context Constraint オブジェクトをグループに追加します。
使用例
# Add the 'restricted' security context constraint to group1 and group2
oc adm policy add-scc-to-group restricted group1 group2
2.7.1.35. oc adm policy add-scc-to-user リンクのコピーリンクがクリップボードにコピーされました!
Security Context Constraint をユーザーまたはサービスアカウントに追加します。
使用例
# 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.7.1.36. oc adm policy remove-cluster-role-from-group リンクのコピーリンクがクリップボードにコピーされました!
クラスター内のすべてのプロジェクトのグループからロールを削除する
使用例
# Remove the 'cluster-admin' cluster role from the 'cluster-admins' group
oc adm policy remove-cluster-role-from-group cluster-admin cluster-admins
2.7.1.37. oc adm policy remove-cluster-role-from-user リンクのコピーリンクがクリップボードにコピーされました!
クラスター内のすべてのプロジェクトのユーザーからロールを削除する
使用例
# Remove the 'system:build-strategy-docker' cluster role from the 'devuser' user
oc adm policy remove-cluster-role-from-user system:build-strategy-docker devuser
2.7.1.38. oc adm policy scc-review リンクのコピーリンクがクリップボードにコピーされました!
Pod を作成できるサービスアカウントを確認します。
使用例
# Check whether service accounts sa1 and sa2 can admit a pod with a template pod spec specified in my_resource.yaml
# Service Account specified in myresource.yaml file is ignored
oc adm policy scc-review -z sa1,sa2 -f my_resource.yaml
# Check whether service accounts system:serviceaccount:bob:default can admit a pod with a template pod spec specified in my_resource.yaml
oc adm policy scc-review -z system:serviceaccount:bob:default -f my_resource.yaml
# Check whether the service account specified in my_resource_with_sa.yaml can admit the pod
oc adm policy scc-review -f my_resource_with_sa.yaml
# Check whether the default service account can admit the pod; default is taken since no service account is defined in myresource_with_no_sa.yaml
oc adm policy scc-review -f myresource_with_no_sa.yaml
2.7.1.39. oc adm policy scc-subject-review リンクのコピーリンクがクリップボードにコピーされました!
ユーザーまたはサービスアカウントが Pod を作成できるかどうかを確認します。
使用例
# Check whether user bob can create a pod specified in myresource.yaml
oc adm policy scc-subject-review -u bob -f myresource.yaml
# Check whether user bob who belongs to projectAdmin group can create a pod specified in myresource.yaml
oc adm policy scc-subject-review -u bob -g projectAdmin -f myresource.yaml
# Check whether a service account specified in the pod template spec in myresourcewithsa.yaml can create the pod
oc adm policy scc-subject-review -f myresourcewithsa.yaml
2.7.1.40. oc adm prune builds リンクのコピーリンクがクリップボードにコピーされました!
以前の完了済みおよび失敗したビルドを削除します。
使用例
# Dry run deleting older completed and failed builds and also including
# all builds whose associated build config no longer exists
oc adm prune builds --orphans
# To actually perform the prune operation, the confirm flag must be appended
oc adm prune builds --orphans --confirm
2.7.1.41. oc adm prune deployments リンクのコピーリンクがクリップボードにコピーされました!
以前の完了済みおよび失敗したデプロイメント設定を削除します。
使用例
# 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.7.1.42. oc adm prune groups リンクのコピーリンクがクリップボードにコピーされました!
外部プロバイダーから欠落しているレコードを参照する以前の OpenShift グループを削除します。
使用例
# Prune all orphaned groups
oc adm prune groups --sync-config=/path/to/ldap-sync-config.yaml --confirm
# Prune all orphaned groups except the ones from the denylist file
oc adm prune groups --blacklist=/path/to/denylist.txt --sync-config=/path/to/ldap-sync-config.yaml --confirm
# Prune all orphaned groups from a list of specific groups specified in an allowlist file
oc adm prune groups --whitelist=/path/to/allowlist.txt --sync-config=/path/to/ldap-sync-config.yaml --confirm
# Prune all orphaned groups from a list of specific groups specified in a list
oc adm prune groups groups/group_name groups/other_name --sync-config=/path/to/ldap-sync-config.yaml --confirm
2.7.1.43. oc adm prune images リンクのコピーリンクがクリップボードにコピーされました!
参照されていないイメージを削除します。
使用例
# See what the prune command would delete if only images and their referrers were more than an hour old
# and obsoleted by 3 newer revisions under the same tag were considered
oc adm prune images --keep-tag-revisions=3 --keep-younger-than=60m
# To actually perform the prune operation, the confirm flag must be appended
oc adm prune images --keep-tag-revisions=3 --keep-younger-than=60m --confirm
# See what the prune command would delete if we are interested in removing images
# exceeding currently set limit ranges ('openshift.io/Image')
oc adm prune images --prune-over-size-limit
# To actually perform the prune operation, the confirm flag must be appended
oc adm prune images --prune-over-size-limit --confirm
# Force the insecure HTTP protocol with the particular registry host name
oc adm prune images --registry-url=http://registry.example.org --confirm
# Force a secure connection with a custom certificate authority to the particular registry host name
oc adm prune images --registry-url=registry.example.org --certificate-authority=/path/to/custom/ca.crt --confirm
2.7.1.44. oc adm prune renderedmachineconfigs リンクのコピーリンクがクリップボードにコピーされました!
OpenShift クラスターでレンダリングされた MachineConfig をプルーニングします。
使用例
# See what the prune command would delete if run with no options
oc adm prune renderedmachineconfigs
# To actually perform the prune operation, the confirm flag must be appended
oc adm prune renderedmachineconfigs --confirm
# See what the prune command would delete if run on the worker MachineConfigPool
oc adm prune renderedmachineconfigs --pool-name=worker
# Prunes 10 oldest rendered MachineConfigs in the cluster
oc adm prune renderedmachineconfigs --count=10 --confirm
# Prunes 10 oldest rendered MachineConfigs in the cluster for the worker MachineConfigPool
oc adm prune renderedmachineconfigs --count=10 --pool-name=worker --confirm
2.7.1.45. oc adm prune renderedmachineconfigs list リンクのコピーリンクがクリップボードにコピーされました!
OpenShift クラスターでレンダリングされた MachineConfig をリスト表示します。
使用例
# List all rendered MachineConfigs for the worker MachineConfigPool in the cluster
oc adm prune renderedmachineconfigs list --pool-name=worker
# List all rendered MachineConfigs in use by the cluster's MachineConfigPools
oc adm prune renderedmachineconfigs list --in-use
2.7.1.46. oc adm reboot-machine-config-pool リンクのコピーリンクがクリップボードにコピーされました!
指定された MachineConfigPool の再起動を開始します。
使用例
# Reboot all MachineConfigPools
oc adm reboot-machine-config-pool mcp/worker mcp/master
# Reboot all MachineConfigPools that inherit from worker. This include all custom MachineConfigPools and infra.
oc adm reboot-machine-config-pool mcp/worker
# Reboot masters
oc adm reboot-machine-config-pool mcp/master
2.7.1.47. oc adm release extract リンクのコピーリンクがクリップボードにコピーされました!
更新ペイロードの内容をディスクに抽出します。
使用例
# Use git to check out the source code for the current cluster release to DIR
oc adm release extract --git=DIR
# Extract cloud credential requests for AWS
oc adm release extract --credentials-requests --cloud=aws
# Use git to check out the source code for the current cluster release to DIR from linux/s390x image
# Note: Wildcard filter is not supported; pass a single os/arch to extract
oc adm release extract --git=DIR quay.io/openshift-release-dev/ocp-release:4.11.2 --filter-by-os=linux/s390x
2.7.1.48. oc adm release info リンクのコピーリンクがクリップボードにコピーされました!
リリースに関する情報を表示します。
使用例
# Show information about the cluster's current release
oc adm release info
# Show the source code that comprises a release
oc adm release info 4.11.2 --commit-urls
# Show the source code difference between two releases
oc adm release info 4.11.0 4.11.2 --commits
# Show where the images referenced by the release are located
oc adm release info quay.io/openshift-release-dev/ocp-release:4.11.2 --pullspecs
# Show information about linux/s390x image
# Note: Wildcard filter is not supported; pass a single os/arch to extract
oc adm release info quay.io/openshift-release-dev/ocp-release:4.11.2 --filter-by-os=linux/s390x
2.7.1.49. oc adm release mirror リンクのコピーリンクがクリップボードにコピーされました!
リリースを別のイメージレジストリーの場所にミラーリングします。
使用例
# Perform a dry run showing what would be mirrored, including the mirror objects
oc adm release mirror 4.11.0 --to myregistry.local/openshift/release \
--release-image-signature-to-dir /tmp/releases --dry-run
# Mirror a release into the current directory
oc adm release mirror 4.11.0 --to file://openshift/release \
--release-image-signature-to-dir /tmp/releases
# Mirror a release to another directory in the default location
oc adm release mirror 4.11.0 --to-dir /tmp/releases
# Upload a release from the current directory to another server
oc adm release mirror --from file://openshift/release --to myregistry.com/openshift/release \
--release-image-signature-to-dir /tmp/releases
# Mirror the 4.11.0 release to repository registry.example.com and apply signatures to connected cluster
oc adm release mirror --from=quay.io/openshift-release-dev/ocp-release:4.11.0-x86_64 \
--to=registry.example.com/your/repository --apply-release-image-signature
2.7.1.50. oc adm release new リンクのコピーリンクがクリップボードにコピーされました!
新しい OpenShift リリースを作成します。
使用例
# Create a release from the latest origin images and push to a DockerHub repository
oc adm release new --from-image-stream=4.11 -n origin --to-image docker.io/mycompany/myrepo:latest
# Create a new release with updated metadata from a previous release
oc adm release new --from-release registry.ci.openshift.org/origin/release:v4.11 --name 4.11.1 \
--previous 4.11.0 --metadata ... --to-image docker.io/mycompany/myrepo:latest
# Create a new release and override a single image
oc adm release new --from-release registry.ci.openshift.org/origin/release:v4.11 \
cli=docker.io/mycompany/cli:latest --to-image docker.io/mycompany/myrepo:latest
# Run a verification pass to ensure the release can be reproduced
oc adm release new --from-release registry.ci.openshift.org/origin/release:v4.11
2.7.1.51. oc adm restart-kubelet リンクのコピーリンクがクリップボードにコピーされました!
指定されたノードで kubelet を再起動する
使用例
# Restart all the nodes, 10% at a time
oc adm restart-kubelet nodes --all --directive=RemoveKubeletKubeconfig
# Restart all the nodes, 20 nodes at a time
oc adm restart-kubelet nodes --all --parallelism=20 --directive=RemoveKubeletKubeconfig
# Restart all the nodes, 15% at a time
oc adm restart-kubelet nodes --all --parallelism=15% --directive=RemoveKubeletKubeconfig
# Restart all the masters at the same time
oc adm restart-kubelet nodes -l node-role.kubernetes.io/master --parallelism=100% --directive=RemoveKubeletKubeconfig
2.7.1.52. oc adm taint リンクのコピーリンクがクリップボードにコピーされました!
1 つ以上のノードでテイントを更新します。
使用例
# Update node 'foo' with a taint with key 'dedicated' and value 'special-user' and effect 'NoSchedule'
# If a taint with that key and effect already exists, its value is replaced as specified
oc adm taint nodes foo dedicated=special-user:NoSchedule
# Remove from node 'foo' the taint with key 'dedicated' and effect 'NoSchedule' if one exists
oc adm taint nodes foo dedicated:NoSchedule-
# Remove from node 'foo' all the taints with key 'dedicated'
oc adm taint nodes foo dedicated-
# Add a taint with key 'dedicated' on nodes having label myLabel=X
oc adm taint node -l myLabel=X dedicated=foo:PreferNoSchedule
# Add to node 'foo' a taint with key 'bar' and no value
oc adm taint nodes foo bar:NoSchedule
2.7.1.53. oc adm top images リンクのコピーリンクがクリップボードにコピーされました!
イメージの使用状況の統計を表示します。
使用例
# Show usage statistics for images
oc adm top images
2.7.1.54. oc adm top imagestreams リンクのコピーリンクがクリップボードにコピーされました!
イメージストリームの使用状況の統計を表示します。
使用例
# Show usage statistics for image streams
oc adm top imagestreams
2.7.1.55. oc adm top node リンクのコピーリンクがクリップボードにコピーされました!
ノードのリソース (CPU/メモリー) の使用状況を表示します。
使用例
# Show metrics for all nodes
oc adm top node
# Show metrics for a given node
oc adm top node NODE_NAME
2.7.1.56. oc adm top persistentvolumeclaims リンクのコピーリンクがクリップボードにコピーされました!
実験的機能: バインドされた persistentvolumeclaims の使用状況の統計情報を表示します
使用例
# Show usage statistics for all the bound persistentvolumeclaims across the cluster
oc adm top persistentvolumeclaims -A
# Show usage statistics for all the bound persistentvolumeclaims in a specific namespace
oc adm top persistentvolumeclaims -n default
# Show usage statistics for specific bound persistentvolumeclaims
oc adm top persistentvolumeclaims database-pvc app-pvc -n default
2.7.1.57. oc adm top pod リンクのコピーリンクがクリップボードにコピーされました!
Pod のリソース (CPU/メモリー) の使用状況を表示します。
使用例
# Show metrics for all pods in the default namespace
oc adm top pod
# Show metrics for all pods in the given namespace
oc adm top pod --namespace=NAMESPACE
# Show metrics for a given pod and its containers
oc adm top pod POD_NAME --containers
# Show metrics for the pods defined by label name=myLabel
oc adm top pod -l name=myLabel
2.7.1.58. oc adm uncordon リンクのコピーリンクがクリップボードにコピーされました!
ノードにスケジュール対象 (schedulable) のマークを付けます。
使用例
# Mark node "foo" as schedulable
oc adm uncordon foo
2.7.1.59. oc adm upgrade リンクのコピーリンクがクリップボードにコピーされました!
クラスターをアップグレードするか、アップグレードチャネルを調整する
使用例
# View the update status and available cluster updates
oc adm upgrade
# Update to the latest version
oc adm upgrade --to-latest=true
2.7.1.60. oc adm verify-image-signature リンクのコピーリンクがクリップボードにコピーされました!
イメージ署名に含まれるイメージ ID を確認します。
使用例
# Verify the image signature and identity using the local GPG keychain
oc adm verify-image-signature sha256:c841e9b64e4579bd56c794bdd7c36e1c257110fd2404bebbb8b613e4935228c4 \
--expected-identity=registry.local:5000/foo/bar:v1
# Verify the image signature and identity using the local GPG keychain and save the status
oc adm verify-image-signature sha256:c841e9b64e4579bd56c794bdd7c36e1c257110fd2404bebbb8b613e4935228c4 \
--expected-identity=registry.local:5000/foo/bar:v1 --save
# Verify the image signature and identity via exposed registry route
oc adm verify-image-signature sha256:c841e9b64e4579bd56c794bdd7c36e1c257110fd2404bebbb8b613e4935228c4 \
--expected-identity=registry.local:5000/foo/bar:v1 \
--registry-url=docker-registry.foo.com
# Remove all signature verifications from the image
oc adm verify-image-signature sha256:c841e9b64e4579bd56c794bdd7c36e1c257110fd2404bebbb8b613e4935228c4 --remove-all
2.7.1.61. oc adm wait-for-node-reboot リンクのコピーリンクがクリップボードにコピーされました!
oc adm reboot-machine-config-pool の実行後、ノードが再起動するまで待ちます。
使用例
# Wait for all nodes to complete a requested reboot from 'oc adm reboot-machine-config-pool mcp/worker mcp/master'
oc adm wait-for-node-reboot nodes --all
# Wait for masters to complete a requested reboot from 'oc adm reboot-machine-config-pool mcp/master'
oc adm wait-for-node-reboot nodes -l node-role.kubernetes.io/master
# Wait for masters to complete a specific reboot
oc adm wait-for-node-reboot nodes -l node-role.kubernetes.io/master --reboot-number=4
2.7.1.62. oc adm wait-for-stable-cluster リンクのコピーリンクがクリップボードにコピーされました!
プラットフォーム Operator が安定するまで待機します。
使用例
# Wait for all cluster operators to become stable
oc adm wait-for-stable-cluster
# Consider operators to be stable if they report as such for 5 minutes straight
oc adm wait-for-stable-cluster --minimum-stable-period 5m
第3章 odo の重要な更新 リンクのコピーリンクがクリップボードにコピーされました!
Red Hat は、OpenShift Service on AWS ドキュメントサイトで odo に関する情報を提供していません。odo に関連するドキュメント情報は、Red Hat およびアップストリームコミュニティーによって管理されている ドキュメント を参照してください。
アップストリームコミュニティーによって維持される資料は、Red Hat は Cooperative Community Support の下でサポートを提供します。
第4章 OpenShift Serverless で使用する Knative CLI リンクのコピーリンクがクリップボードにコピーされました!
Knative (kn) は、Red Hat OpenShift Service on AWS の Knative コンポーネントとの簡単な対話を有効にします。
4.1. 主な特長 リンクのコピーリンクがクリップボードにコピーされました!
Knative (kn) CLI は、サーバーレスコンピューティングタスクを単純かつ簡潔にするように設計されています。Knative CLI の主な機能は次のとおりです。
- コマンドラインからサーバーレスアプリケーションをデプロイします。
- サービス、リビジョン、およびトラフィック分割などの Knative Serving の機能を管理します。
- イベントソースおよびトリガーなどの Knative Eventing コンポーネントを作成し、管理します。
- 既存の Kubernetes アプリケーションおよび Knative サービスを接続するために、sink binding を作成します。
-
kubectlCLI と同様に、柔軟性のあるプラグインアーキテクチャーで Knative CLI を拡張します。 - Knative サービスの自動スケーリングパラメーターを設定します。
- 操作の結果を待機したり、カスタムロールアウトおよびロールバックストラテジーのデプロイなどのスクリプト化された使用。
4.2. Knative CLI のインストール リンクのコピーリンクがクリップボードにコピーされました!
Knative CLI のインストール を参照してください。
第5章 Pipelines CLI (tkn) リンクのコピーリンクがクリップボードにコピーされました!
5.1. tkn のインストール リンクのコピーリンクがクリップボードにコピーされました!
CLI ツールを使用して、ターミナルから Red Hat OpenShift Pipeline を管理します。以下のセクションでは、各種の異なるプラットフォームに CLI ツールをインストールする方法を説明します。
また、Red Hat OpenShift Service on AWS Web コンソールから最新のバイナリーへの URL を見つけるには、右上隅の ? アイコンをクリックし、Command Line Tools を選択します。
ARM ハードウェアでの Red Hat OpenShift Pipelines の実行は、テクノロジープレビュー機能です。テクノロジープレビュー機能は、Red Hat 製品のサービスレベルアグリーメント (SLA) の対象外であり、機能的に完全ではないことがあります。Red Hat は、実稼働環境でこれらを使用することを推奨していません。テクノロジープレビュー機能は、最新の製品機能をいち早く提供して、開発段階で機能のテストを行い、フィードバックを提供していただくことを目的としています。
Red Hat のテクノロジープレビュー機能のサポート範囲に関する詳細は、テクノロジープレビュー機能のサポート範囲 を参照してください。
アーカイブと RPM の両方に、次の実行可能ファイルが含まれています。
-
tkn -
tkn-pac -
opc
opc CLI ツールを使用した Red Hat OpenShift Pipelines の実行は、テクノロジープレビュー機能です。テクノロジープレビュー機能は、Red Hat 製品のサービスレベルアグリーメント (SLA) の対象外であり、機能的に完全ではないことがあります。Red Hat は、実稼働環境でこれらを使用することを推奨していません。テクノロジープレビュー機能は、最新の製品機能をいち早く提供して、開発段階で機能のテストを行い、フィードバックを提供していただくことを目的としています。
Red Hat のテクノロジープレビュー機能のサポート範囲に関する詳細は、テクノロジープレビュー機能のサポート範囲 を参照してください。
5.1.1. Linux への Red Hat OpenShift Pipelines CLI のインストール リンクのコピーリンクがクリップボードにコピーされました!
Linux ディストリビューションの場合は、CLI を tar.gz アーカイブとしてダウンロードできます。
手順
関連する CLI ツールをダウンロードします。
アーカイブを展開します。
$ tar xvzf <file>-
tknファイルおよびtkn-pacファイルの場所をPATH環境変数に追加します。 PATHを確認するには、以下のコマンドを実行します。$ echo $PATH
5.1.2. RPM を使用した Linux への Red Hat OpenShift Pipelines CLI のインストール リンクのコピーリンクがクリップボードにコピーされました!
Red Hat Enterprise Linux (RHEL) バージョン 8 の場合は、Red Hat OpenShift Pipelines CLI を RPM としてインストールできます。
前提条件
- Red Hat アカウントに有効な Red Hat OpenShift Service on AWS サブスクリプションがある。
- ローカルシステムに root または sudo 権限がある。
手順
Red Hat Subscription Manager に登録します。
# subscription-manager register最新のサブスクリプションデータをプルします。
# subscription-manager refresh利用可能なサブスクリプションをリストします。
# subscription-manager list --available --matches '*pipelines*'直前のコマンドの出力で、Red Hat OpenShift Service on AWS サブスクリプションのプール ID を見つけ、そのサブスクリプションを登録されたシステムにアタッチします。
# subscription-manager attach --pool=<pool_id>Red Hat OpenShift Pipelines で必要なリポジトリーを有効にします。
Linux (x86_64, amd64)
# subscription-manager repos --enable="pipelines-1.18-for-rhel-8-x86_64-rpms"IBM Z® および IBM® LinuxONE (s390x) 上の Linux
# subscription-manager repos --enable="pipelines-1.18-for-rhel-8-s390x-rpms"IBM Power® 上の Linux (ppc64le)
# subscription-manager repos --enable="pipelines-1.18-for-rhel-8-ppc64le-rpms"ARM 上の Linux (aarch64、arm64)
# subscription-manager repos --enable="pipelines-1.18-for-rhel-8-aarch64-rpms"
openshift-pipelines-clientパッケージをインストールします。# yum install openshift-pipelines-client
CLI のインストール後は、tkn コマンドを使用して利用できます。
$ tkn version
5.1.3. Windows への Red Hat OpenShift Pipelines CLI のインストール リンクのコピーリンクがクリップボードにコピーされました!
Windows の場合は、CLI を zip アーカイブとしてダウンロードできます。
手順
- CLI ツール をダウンロードします。
- ZIP プログラムでアーカイブを展開します。
-
tknファイルおよびtkn-pacファイルの場所をPATH環境変数に追加します。 PATHを確認するには、以下のコマンドを実行します。C:\> path
5.1.4. macOS への Red Hat OpenShift Pipelines CLI のインストール リンクのコピーリンクがクリップボードにコピーされました!
macOS の場合は、CLI を tar.gz アーカイブとしてダウンロードできます。
手順
関連する CLI ツールをダウンロードします。
- アーカイブを解凍して解凍します。
-
tknファイルおよびtkn-pacファイルの場所をPATH環境変数に追加します。 PATHを確認するには、以下のコマンドを実行します。$ echo $PATH
5.2. OpenShift Pipelines tkn CLI の設定 リンクのコピーリンクがクリップボードにコピーされました!
タブ補完を有効にするように Red Hat OpenShift Pipelines tkn CLI を設定します。
5.2.1. タブ補完の有効化 リンクのコピーリンクがクリップボードにコピーされました!
tkn CLI ツールのインストール後、タブ補完を有効にして tkn コマンドの自動補完を実行するか、Tab キーを押す際にオプションの提案が表示されるようにすることができます。
前提条件
-
tknCLI ツールがインストールされている。 -
ローカルシステムに
bash-completionがインストールされている。
手順
以下の手順では、Bash のタブ補完を有効にします。
Bash 補完コードをファイルに保存します。
$ tkn completion bash > tkn_bash_completionファイルを
/etc/bash_completion.d/にコピーします。$ sudo cp tkn_bash_completion /etc/bash_completion.d/または、ファイルをローカルディレクトリーに保存してから、これを
.bashrcファイルから取得できるようにすることができます。
タブ補完は、新規ターミナルを開くと有効になります。
5.3. OpenShift Pipelines tkn リファレンス リンクのコピーリンクがクリップボードにコピーされました!
このセクションでは、基本的な tkn CLI コマンドのリストを紹介します。
5.3.1. 基本的な構文 リンクのコピーリンクがクリップボードにコピーされました!
tkn [command or options] [arguments…]
5.3.2. グローバルオプション リンクのコピーリンクがクリップボードにコピーされました!
--help, -h
5.3.3. ユーティリティーコマンド リンクのコピーリンクがクリップボードにコピーされました!
5.3.3.1. tkn リンクのコピーリンクがクリップボードにコピーされました!
tkn CLI の親コマンド。
例: すべてのオプションを表示する
$ tkn
5.3.3.2. completion [shell] リンクのコピーリンクがクリップボードにコピーされました!
インタラクティブな補完を提供するために評価する必要があるシェル補完コードを出力します。サポートされるシェルは bash および zsh です。
例: bash シェルの補完コード
$ tkn completion bash
5.3.3.3. version リンクのコピーリンクがクリップボードにコピーされました!
tkn CLI のバージョン情報を出力します。
例: tkn バージョンを確認する
$ tkn version
5.3.4. Pipelines 管理コマンド リンクのコピーリンクがクリップボードにコピーされました!
5.3.4.1. パイプライン リンクのコピーリンクがクリップボードにコピーされました!
Pipeline を管理します。
例: ヘルプを表示する
$ tkn pipeline --help
5.3.4.2. pipeline delete リンクのコピーリンクがクリップボードにコピーされました!
Pipeline を削除します。
例: namespace から mypipeline Pipeline を削除します。
$ tkn pipeline delete mypipeline -n myspace
5.3.4.3. pipeline describe リンクのコピーリンクがクリップボードにコピーされました!
Pipeline を記述します。
例: mypipeline Pipeline を記述します。
$ tkn pipeline describe mypipeline
5.3.4.4. pipeline list リンクのコピーリンクがクリップボードにコピーされました!
Pipeline のリストを表示します。
例: Pipeline のリストを表示する
$ tkn pipeline list
5.3.4.5. pipeline logs リンクのコピーリンクがクリップボードにコピーされました!
特定の Pipeline のログを表示します。
例: mypipeline Pipeline のライブログのストリーミング
$ tkn pipeline logs -f mypipeline
5.3.4.6. pipeline start リンクのコピーリンクがクリップボードにコピーされました!
Pipeline を起動します。
例: mypipeline Pipeline を起動します。
$ tkn pipeline start mypipeline
5.3.5. Pipeline 実行コマンド リンクのコピーリンクがクリップボードにコピーされました!
5.3.5.1. pipelinerun リンクのコピーリンクがクリップボードにコピーされました!
Pipeline 実行を管理します。
例: ヘルプを表示する
$ tkn pipelinerun -h
5.3.5.2. pipelinerun cancel リンクのコピーリンクがクリップボードにコピーされました!
Pipeline 実行をキャンセルします。
例: namespace からの mypipelinerun Pipeline 実行を取り消します。
$ tkn pipelinerun cancel mypipelinerun -n myspace
5.3.5.3. pipelinerun delete リンクのコピーリンクがクリップボードにコピーされました!
Pipeline 実行を削除します。
例: namespace からの Pipeline 実行を削除する
$ tkn pipelinerun delete mypipelinerun1 mypipelinerun2 -n myspace
例: 最近実行された 5 つの Pipeline 実行を除き、namespace からすべての Pipeline 実行を削除する
$ tkn pipelinerun delete -n myspace --keep 5
- 1
5を、保持する最近実行された Pipeline 実行の数に置き換えます。
例: すべての Pipeline を削除する
$ tkn pipelinerun delete --all
Red Hat OpenShift Pipelines 1.6 以降では、tkn pipelinerun delete --all コマンドは、running 状態のリソースを削除しません。
5.3.5.4. pipelinerun describe リンクのコピーリンクがクリップボードにコピーされました!
Pipeline 実行を記述します。
例: namespace での mypipelinerun Pipeline 実行を記述します。
$ tkn pipelinerun describe mypipelinerun -n myspace
5.3.5.5. pipelinerun list リンクのコピーリンクがクリップボードにコピーされました!
Pipeline 実行をリストします。
例: namespace での Pipeline 実行のリストを表示する
$ tkn pipelinerun list -n myspace
5.3.5.6. pipelinerun logs リンクのコピーリンクがクリップボードにコピーされました!
Pipeline 実行のログを表示します。
例: namespace のすべてのタスクおよび手順を含む mypipelinerun Pipeline 実行のログを表示します。
$ tkn pipelinerun logs mypipelinerun -a -n myspace
5.3.6. タスク管理コマンド リンクのコピーリンクがクリップボードにコピーされました!
5.3.6.1. task リンクのコピーリンクがクリップボードにコピーされました!
タスクを管理します。
例: ヘルプを表示する
$ tkn task -h
5.3.6.2. task delete リンクのコピーリンクがクリップボードにコピーされました!
タスクを削除します。
例: namespace からの mytask1 および mytask2 タスクを削除します。
$ tkn task delete mytask1 mytask2 -n myspace
5.3.6.3. task describe リンクのコピーリンクがクリップボードにコピーされました!
タスクを記述します。
例: namespace の mytask タスクを記述します。
$ tkn task describe mytask -n myspace
5.3.6.4. task list リンクのコピーリンクがクリップボードにコピーされました!
タスクをリストします。
例: namespace のすべてのタスクをリスト表示します。
$ tkn task list -n myspace
5.3.6.5. task logs リンクのコピーリンクがクリップボードにコピーされました!
タスクログを表示します。
例: mytask タスクの mytaskrun タスク実行のログを表示します。
$ tkn task logs mytask mytaskrun -n myspace
5.3.6.6. task start リンクのコピーリンクがクリップボードにコピーされました!
タスクを開始します。
例: namespace の mytask タスクを開始します。
$ tkn task start mytask -s <ServiceAccountName> -n myspace
5.3.7. タスク実行コマンド リンクのコピーリンクがクリップボードにコピーされました!
5.3.7.1. taskrun リンクのコピーリンクがクリップボードにコピーされました!
タスク実行を管理します。
例: ヘルプを表示する
$ tkn taskrun -h
5.3.7.2. taskrun cancel リンクのコピーリンクがクリップボードにコピーされました!
タスク実行をキャンセルします。
例: namespace からの mytaskrun タスク実行を取り消します。
$ tkn taskrun cancel mytaskrun -n myspace
5.3.7.3. taskrun delete リンクのコピーリンクがクリップボードにコピーされました!
TaskRun を削除します。
例: namespace からの mytaskrun1 および mytaskrun2 タスク実行を削除します。
$ tkn taskrun delete mytaskrun1 mytaskrun2 -n myspace
例: namespace から最近実行された 5 つのタスク以外のすべてのタスクを削除します。
$ tkn taskrun delete -n myspace --keep 5
- 1
5を、保持する最近実行したタスク実行の数に置き換えます。
5.3.7.4. taskrun describe リンクのコピーリンクがクリップボードにコピーされました!
タスク実行を記述します。
例: namespace での mytaskrun タスク実行を記述します。
$ tkn taskrun describe mytaskrun -n myspace
5.3.7.5. taskrun list リンクのコピーリンクがクリップボードにコピーされました!
タスク実行をリストします。
例: namespace のすべてのタスク実行をリストする
$ tkn taskrun list -n myspace
5.3.7.6. taskrun logs リンクのコピーリンクがクリップボードにコピーされました!
タスク実行ログを表示します。
例: namespace での mytaskrun タスク実行のライブログを表示します。
$ tkn taskrun logs -f mytaskrun -n myspace
5.3.8. 条件管理コマンド リンクのコピーリンクがクリップボードにコピーされました!
5.3.8.1. condition リンクのコピーリンクがクリップボードにコピーされました!
条件を管理します。
例: ヘルプを表示する
$ tkn condition --help
5.3.8.2. condition delete リンクのコピーリンクがクリップボードにコピーされました!
条件を削除します。
例: namespace からの mycondition1 条件の削除
$ tkn condition delete mycondition1 -n myspace
5.3.8.3. condition describe リンクのコピーリンクがクリップボードにコピーされました!
条件を記述します。
例: namespace での mycondition1 条件の記述
$ tkn condition describe mycondition1 -n myspace
5.3.8.4. condition list リンクのコピーリンクがクリップボードにコピーされました!
条件をリスト表示します。
例: namespace での条件のリスト表示
$ tkn condition list -n myspace
5.3.9. Pipeline リソース管理コマンド リンクのコピーリンクがクリップボードにコピーされました!
5.3.9.1. resource リンクのコピーリンクがクリップボードにコピーされました!
Pipeline リソースを管理します。
例: ヘルプを表示する
$ tkn resource -h
5.3.9.2. resource create リンクのコピーリンクがクリップボードにコピーされました!
Pipeline リソースを作成します。
例: namespace に Pipeline リソースを作成する
$ tkn resource create -n myspace
これは、リソースの名前、リソースのタイプ、およびリソースのタイプに基づく値の入力を要求するインタラクティブなコマンドです。
5.3.9.3. resource delete リンクのコピーリンクがクリップボードにコピーされました!
Pipeline リソースを削除します。
例: namespace から myresource Pipeline リソースを削除する
$ tkn resource delete myresource -n myspace
5.3.9.4. resource describe リンクのコピーリンクがクリップボードにコピーされました!
Pipeline リソースを記述します。
例: myresource Pipeline リソースを記述する
$ tkn resource describe myresource -n myspace
5.3.9.5. resource list リンクのコピーリンクがクリップボードにコピーされました!
Pipeline リソースをリストします。
例: namespace のすべての Pipeline リソースのリスト表示
$ tkn resource list -n myspace
5.3.10. ClusterTask 管理コマンド リンクのコピーリンクがクリップボードにコピーされました!
Red Hat OpenShift Pipelines 1.10 では、tkn コマンドラインユーティリティーの ClusterTask 機能が非推奨となり、今後のリリースで削除される予定です。
5.3.10.1. clustertask リンクのコピーリンクがクリップボードにコピーされました!
ClusterTask を管理します。
例: ヘルプを表示する
$ tkn clustertask --help
5.3.10.2. clustertask delete リンクのコピーリンクがクリップボードにコピーされました!
クラスターの ClusterTask リソースを削除します。
例: mytask1 および mytask2 ClusterTask の削除
$ tkn clustertask delete mytask1 mytask2
5.3.10.3. clustertask describe リンクのコピーリンクがクリップボードにコピーされました!
ClusterTask を記述します。
例: mytask ClusterTask の記述
$ tkn clustertask describe mytask1
5.3.10.4. clustertask list リンクのコピーリンクがクリップボードにコピーされました!
ClusterTask をリスト表示します。
例: ClusterTask のリスト表示
$ tkn clustertask list
5.3.10.5. clustertask start リンクのコピーリンクがクリップボードにコピーされました!
ClusterTask を開始します。
例: mytask ClusterTask の開始
$ tkn clustertask start mytask
5.3.11. 管理コマンドのトリガー リンクのコピーリンクがクリップボードにコピーされました!
5.3.11.1. eventlistener リンクのコピーリンクがクリップボードにコピーされました!
EventListener を管理します。
例: ヘルプを表示する
$ tkn eventlistener -h
5.3.11.2. eventlistener delete リンクのコピーリンクがクリップボードにコピーされました!
EventListener を削除します。
例: namespace の mylistener1 および mylistener2 EventListener を削除する
$ tkn eventlistener delete mylistener1 mylistener2 -n myspace
5.3.11.3. eventlistener describe リンクのコピーリンクがクリップボードにコピーされました!
EventListener を記述します。
例: namespace の mylistener EventListener を記述する
$ tkn eventlistener describe mylistener -n myspace
5.3.11.4. eventlistener list リンクのコピーリンクがクリップボードにコピーされました!
EventListener をリストします。
例: namespace のすべての EventListener をリストする
$ tkn eventlistener list -n myspace
5.3.11.5. eventlistener ログ リンクのコピーリンクがクリップボードにコピーされました!
EventListener のログを表示します。
例: namespace に mylistener EventListener のログを表示する
$ tkn eventlistener logs mylistener -n myspace
5.3.11.6. triggerbinding リンクのコピーリンクがクリップボードにコピーされました!
TriggerBinding を管理します。
例: TriggerBindings ヘルプを表示する
$ tkn triggerbinding -h
5.3.11.7. triggerbinding delete リンクのコピーリンクがクリップボードにコピーされました!
TriggerBinding を削除します。
例: namespace の mybinding1 および mybinding2 TriggerBinding を削除する
$ tkn triggerbinding delete mybinding1 mybinding2 -n myspace
5.3.11.8. triggerbinding describe リンクのコピーリンクがクリップボードにコピーされました!
TriggerBinding を記述します。
例: namespace の mybinding TriggerBinding を記述する
$ tkn triggerbinding describe mybinding -n myspace
5.3.11.9. triggerbinding list リンクのコピーリンクがクリップボードにコピーされました!
TriggerBinding をリストします。
例: namespace のすべての TriggerBinding をリストする
$ tkn triggerbinding list -n myspace
5.3.11.10. triggertemplate リンクのコピーリンクがクリップボードにコピーされました!
TriggerTemplate を管理します。
例: TriggerTemplate ヘルプを表示する
$ tkn triggertemplate -h
5.3.11.11. triggertemplate delete リンクのコピーリンクがクリップボードにコピーされました!
TriggerTemplate を削除します。
例: namespace の mytemplate1 および mytemplate2 TriggerTemplate を削除する
$ tkn triggertemplate delete mytemplate1 mytemplate2 -n `myspace`
5.3.11.12. triggertemplate describe リンクのコピーリンクがクリップボードにコピーされました!
TriggerTemplate を記述します。
例: namespace の mytemplate TriggerTemplate を記述する
$ tkn triggertemplate describe mytemplate -n `myspace`
5.3.11.13. triggertemplate list リンクのコピーリンクがクリップボードにコピーされました!
TriggerTemplate をリストします。
例: namespace のすべての TriggerTemplate をリストする
$ tkn triggertemplate list -n myspace
5.3.11.14. clustertriggerbinding リンクのコピーリンクがクリップボードにコピーされました!
ClusterTriggerBinding を管理します。
例: ClusterTriggerBinding のヘルプを表示する
$ tkn clustertriggerbinding -h
5.3.11.15. clustertriggerbinding delete リンクのコピーリンクがクリップボードにコピーされました!
ClusterTriggerBinding を削除します。
例: myclusterbinding1 および myclusterbinding2 ClusterTriggerBinding を削除する
$ tkn clustertriggerbinding delete myclusterbinding1 myclusterbinding2
5.3.11.16. clustertriggerbinding describe リンクのコピーリンクがクリップボードにコピーされました!
ClusterTriggerBinding を記述します。
例: myclusterbinding ClusterTriggerBinding を記述する
$ tkn clustertriggerbinding describe myclusterbinding
5.3.11.17. clustertriggerbinding list リンクのコピーリンクがクリップボードにコピーされました!
ClusterTriggerBinding のリストを表示します。
例: すべての ClusterTriggerBinding をリストする
$ tkn clustertriggerbinding list
5.3.12. hub 対話コマンド リンクのコピーリンクがクリップボードにコピーされました!
タスクやパイプラインなど、リソースの Tekton Hub と対話します。
5.3.12.1. hub リンクのコピーリンクがクリップボードにコピーされました!
ハブと対話します。
例: ヘルプを表示する
$ tkn hub -h
例: ハブ API サーバーと対話する
$ tkn hub --api-server https://api.hub.tekton.dev
それぞれの例で、対応するサブコマンドとフラグを取得するには、tkn hub <command> --help を実行します。
5.3.12.2. hub downgrade リンクのコピーリンクがクリップボードにコピーされました!
インストール済みのリソースをダウングレードします。
例: mynamespace namespace の mytask タスクを古いバージョンにダウングレードします。
$ tkn hub downgrade task mytask --to version -n mynamespace
5.3.12.3. hub get リンクのコピーリンクがクリップボードにコピーされました!
名前、種類、カタログ、およびバージョン別に、リソースマニフェストを取得します。
例: tekton カタログからの特定バージョンの myresource Pipeline またはタスクのマニフェストを取得する
$ tkn hub get [pipeline | task] myresource --from tekton --version version
5.3.12.4. hub info リンクのコピーリンクがクリップボードにコピーされました!
名前、種類、カタログ、およびバージョン別に、リソースに関する情報を表示します。
例: tekton カタログからの特定バージョンの mytask タスクに関する情報を表示する
$ tkn hub info task mytask --from tekton --version version
5.3.12.5. hub install リンクのコピーリンクがクリップボードにコピーされました!
種類、名前、バージョンごとにカタログからのリソースをインストールします。
例: mynamespace namespace の tekton カタログから mytask タスクの特定バージョンをインストールする
$ tkn hub install task mytask --from tekton --version version -n mynamespace
5.3.12.6. hub reinstall リンクのコピーリンクがクリップボードにコピーされました!
種類および名前ごとにリソースを再インストールします。
例: mynamespace namespace の tekton カタログから mytask タスクの特定バージョンを再インストールする
$ tkn hub reinstall task mytask --from tekton --version version -n mynamespace
5.3.12.7. hub search リンクのコピーリンクがクリップボードにコピーされました!
名前、種類、およびタグの組み合わせでリソースを検索します。
例: タグ cli でリソースを検索する
$ tkn hub search --tags cli
5.3.12.8. hub upgrade リンクのコピーリンクがクリップボードにコピーされました!
インストール済みのリソースをアップグレードします。
例: mynamespace namespace のインストールされた mytask タスクの新規バージョンへのアップグレード
$ tkn hub upgrade task mytask --to version -n mynamespace
第6章 opm CLI リンクのコピーリンクがクリップボードにコピーされました!
6.1. opm CLI のインストール リンクのコピーリンクがクリップボードにコピーされました!
6.1.1. opm CLI について リンクのコピーリンクがクリップボードにコピーされました!
opm CLI ツールは、Operator Bundle Format で使用するために Operator Framework によって提供されます。このツールを使用して、ソフトウェアリポジトリーに相当する Operator バンドルのリストから Operator のカタログを作成し、維持することができます。結果として、コンテナーイメージをコンテナーレジストリーに保存し、その後にクラスターにインストールできます。
カタログには、コンテナーイメージの実行時に提供される組み込まれた API を使用してクエリーできる、Operator マニフェストコンテンツへのポインターのデータベースが含まれます。Red Hat OpenShift Service on AWS では、Operator Lifecycle Manager (OLM) は、CatalogSource オブジェクトが定義したカタログソース内のイメージ参照できます。これにより、クラスター上にインストールされた Operator への頻度の高い更新を可能にするためにイメージを一定の間隔でポーリングできます。
6.1.2. opm CLI のインストール リンクのコピーリンクがクリップボードにコピーされました!
opm CLI ツールは、Linux、macOS、または Windows ワークステーションにインストールできます。
前提条件
Linux の場合は、以下のパッケージを指定する必要があります。RHEL 8 は、以下の要件を満たすようにします。
-
podmanバージョン 1.9.3 以降 (バージョン 2.0 以降を推奨) -
glibcバージョン 2.28 以降
-
手順
- OpenShift mirror site に移動し、お使いのオペレーティングシステムに一致する最新バージョンの tarball をダウンロードします。
アーカイブを展開します。
Linux または macOS の場合:
$ tar xvf <file>- Windows の場合、ZIP プログラムでアーカイブを展開します。
ファイルを
PATHの任意の場所に置きます。Linux または macOS の場合:
PATHを確認します。$ echo $PATHファイルを移動します。以下に例を示します。
$ sudo mv ./opm /usr/local/bin/
Windows の場合:
PATHを確認します。C:\> pathファイルを移動します。
C:\> move opm.exe <directory>
検証
opmCLI のインストール後に、これが利用可能であることを確認します。$ opm version
6.2. opm CLI リファレンス リンクのコピーリンクがクリップボードにコピーされました!
opm コマンドラインインターフェイス (CLI) は、Operator カタログを作成して保守するためのツールです。
opm CLI 構文
$ opm <command> [<subcommand>] [<argument>] [<flags>]
opm CLI には前方互換性がありません。カタログコンテンツの生成に使用される opm CLI のバージョンは、クラスター上でコンテンツを提供するために使用されるバージョンと同じかそれより前である必要があります。
| フラグ | 説明 |
|---|---|
|
| バンドルまたはインデックスをプルする時に、コンテナーイメージレジストリーの TLS 証明書の検証を省略します。 |
|
| バンドルをプルするときは、コンテナーイメージレジストリーにプレーン HTTP を使用します。 |
関連する CLI コマンドを含む、SQLite ベースのカタログ形式は非推奨の機能です。非推奨の機能は依然として Red Hat OpenShift Service on AWS に含まれており、引き続きサポートされますが、この製品の今後のリリースで削除されるため、新規デプロイメントでの使用は推奨されません。
Red Hat OpenShift Service on AWS で非推奨化または削除された主な機能の最新のリストは、Red Hat OpenShift Service on AWS リリースノートの 非推奨および削除された機能 セクションを参照してください。
6.2.1. generate リンクのコピーリンクがクリップボードにコピーされました!
宣言型設定インデックスのさまざまなアーティファクトを生成します。
コマンド構文
$ opm generate <subcommand> [<flags>]
| サブコマンド | 説明 |
|---|---|
|
| 宣言型設定インデックスの Dockerfile を生成します。 |
| フラグ | 説明 |
|---|---|
|
| generate のヘルプ。 |
6.2.1.1. dockerfile リンクのコピーリンクがクリップボードにコピーされました!
宣言型設定インデックスの Dockerfile を生成します。
このコマンドは、インデックスの構築に使用される Dockerfile を <dcRootDir> と同じディレクトリーに作成します (<dcDirName>.Dockerfile という名前)。同じ名前の Dockerfile がすでに存在する場合、このコマンドは失敗します。
追加のラベルを指定するときに重複キーが存在する場合、各重複キーの最後の値のみが生成された Dockerfile に追加されます。
コマンド構文
$ opm generate dockerfile <dcRootDir> [<flags>]
| フラグ | 説明 |
|---|---|
|
|
カタログを作成するイメージ。デフォルト値は |
|
|
生成された Dockerfile に含める追加のラベル。ラベルの形式は |
|
| Dockerfile のヘルプ。 |
公式の Red Hat イメージを使用してビルドするには、registry.redhat.io/openshift4/ose-operator-registry-rhel9:v4 値と -i フラグを使用します。
6.2.2. index リンクのコピーリンクがクリップボードにコピーされました!
既存の Operator バンドルから SQLite データベース形式のコンテナーイメージに Operator インデックスを生成します。
Red Hat OpenShift Service on AWS 4.11 の時点で、デフォルトの Red Hat が提供する Operator カタログは、ファイルベースのカタログ形式でリリースされます。Red Hat OpenShift Service on AWS 4.6 から 4.10 までのデフォルトの Red Hat が提供する Operator カタログは、非推奨の SQLite データベース形式でリリースされました。
opm サブコマンド、フラグ、および SQLite データベース形式に関連する機能も非推奨となり、今後のリリースで削除されます。機能は引き続きサポートされており、非推奨の SQLite データベース形式を使用するカタログに使用する必要があります。
opm index prune などの SQLite データベース形式を使用する opm サブコマンドおよびフラグの多くは、ファイルベースのカタログ形式では機能しません。
コマンド構文
$ opm index <subcommand> [<flags>]
| サブコマンド | 説明 |
|---|---|
|
| Operator バンドルをインデックスに追加します。 |
|
| 指定されたパッケージ以外の全パッケージのインデックスをプルーニングします。 |
|
| 特定のイメージに関連付けられていない標準バンドルのインデックスをプルーニングします。 |
|
| Operator 全体をインデックスから削除します。 |
6.2.2.1. add リンクのコピーリンクがクリップボードにコピーされました!
Operator バンドルをインデックスに追加します。
コマンド構文
$ opm index add [<flags>]
| フラグ | 説明 |
|---|---|
|
|
on-image |
|
|
コンテナーイメージをビルドするツール: |
|
| 追加するバンドルのコンマ区切りのリスト。 |
|
|
保存およびビルドなど、コンテナーイメージと対話するためのツール: |
|
| 追加する以前のインデックス。 |
|
| 有効な場合には、Dockerfile のみを作成してローカルディスクに保存します。 |
|
|
チャネルグラフの更新方法を定義するグラフ更新モード: |
|
| オプション: Dockerfile を生成する場合は、ファイル名を指定します。 |
|
| レジストリーの読み込みエラーを許可します。 |
|
|
コンテナーイメージをプルするツール: |
|
| ビルドするコンテナーイメージのカスタムタグ。 |
6.2.2.2. prune リンクのコピーリンクがクリップボードにコピーされました!
指定されたパッケージ以外の全パッケージのインデックスをプルーニングします。
コマンド構文
$ opm index prune [<flags>]
| フラグ | 説明 |
|---|---|
|
|
on-image |
|
|
保存およびビルドなど、コンテナーイメージと対話するためのツール: |
|
| プルーニングするインデックス。 |
|
| 有効な場合には、Dockerfile のみを作成してローカルディスクに保存します。 |
|
| オプション: Dockerfile を生成する場合は、ファイル名を指定します。 |
|
| 保持するパッケージのコンマ区切りリスト。 |
|
| レジストリーの読み込みエラーを許可します。 |
|
| ビルドするコンテナーイメージのカスタムタグ。 |
6.2.2.3. prune-stranded リンクのコピーリンクがクリップボードにコピーされました!
特定のイメージに関連付けられていない標準バンドルのインデックスをプルーニングします。
コマンド構文
$ opm index prune-stranded [<flags>]
| フラグ | 説明 |
|---|---|
|
|
on-image |
|
|
保存およびビルドなど、コンテナーイメージと対話するためのツール: |
|
| プルーニングするインデックス。 |
|
| 有効な場合には、Dockerfile のみを作成してローカルディスクに保存します。 |
|
| オプション: Dockerfile を生成する場合は、ファイル名を指定します。 |
|
| 保持するパッケージのコンマ区切りリスト。 |
|
| レジストリーの読み込みエラーを許可します。 |
|
| ビルドするコンテナーイメージのカスタムタグ。 |
6.2.2.4. rm リンクのコピーリンクがクリップボードにコピーされました!
Operator 全体をインデックスから削除します。
コマンド構文
$ opm index rm [<flags>]
| フラグ | 説明 |
|---|---|
|
|
on-image |
|
|
コンテナーイメージをビルドするツール: |
|
|
保存およびビルドなど、コンテナーイメージと対話するためのツール: |
|
| 削除する以前のインデックス。 |
|
| 有効な場合には、Dockerfile のみを作成してローカルディスクに保存します。 |
|
| 削除する Operator のコンマ区切りのリスト。 |
|
| オプション: Dockerfile を生成する場合は、ファイル名を指定します。 |
|
| 保持するパッケージのコンマ区切りリスト。 |
|
| レジストリーの読み込みエラーを許可します。 |
|
|
コンテナーイメージをプルするツール: |
|
| ビルドするコンテナーイメージのカスタムタグ。 |
6.2.3. init リンクのコピーリンクがクリップボードにコピーされました!
olm.package 宣言型設定 blob を生成します。
コマンド構文
$ opm init <package_name> [<flags>]
| フラグ | 説明 |
|---|---|
|
| 指定されていない場合に、サブスクリプションがデフォルトで設定されるチャネル。 |
|
|
Operator の |
|
| パッケージのアイコンへのパス。 |
|
|
出力形式: |
6.2.4. migrate リンクのコピーリンクがクリップボードにコピーされました!
SQLite データベース形式のインデックスイメージまたはデータベースファイルをファイルベースのカタログに移行します。
関連する CLI コマンドを含む、SQLite ベースのカタログ形式は非推奨の機能です。非推奨の機能は依然として Red Hat OpenShift Service on AWS に含まれており、引き続きサポートされますが、この製品の今後のリリースで削除されるため、新規デプロイメントでの使用は推奨されません。
Red Hat OpenShift Service on AWS で非推奨化または削除された主な機能の最新のリストは、Red Hat OpenShift Service on AWS リリースノートの 非推奨および削除された機能 セクションを参照してください。
コマンド構文
$ opm migrate <index_ref> <output_dir> [<flags>]
| フラグ | 説明 |
|---|---|
|
|
出力形式: |
6.2.5. render リンクのコピーリンクがクリップボードにコピーされました!
提供されるインデックスイメージ、バンドルイメージ、および SQLite データベースファイルから宣言型の設定 Blob を生成します。
コマンド構文
$ opm render <index_image | bundle_image | sqlite_file> [<flags>]
| フラグ | 説明 |
|---|---|
|
|
出力形式: |
6.2.6. serve リンクのコピーリンクがクリップボードにコピーされました!
GRPC サーバーを介して宣言型の設定を提供します。
宣言的な config ディレクトリーは、起動時に serve コマンドで読み込まれます。このコマンド開始後に宣言型設定に加えられた変更は、提供されるコンテンツには反映されません。
コマンド構文
$ opm serve <source_path> [<flags>]
| フラグ | 説明 |
|---|---|
|
| このフラグが設定されている場合、サーバーキャッシュディレクトリーを同期して永続化します。 |
|
|
キャッシュが存在しないか無効化されている場合、エラーで終了します。 |
|
| サービスキャッシュを同期し、サービスを提供せずに終了します。 |
|
| デバッグロギングを有効にします。 |
|
| serve のヘルプ。 |
|
|
サービスのポート番号。デフォルト値は |
|
|
起動プロファイリングエンドポイントのアドレス。形式は |
|
|
コンテナー終了ログファイルへのパス。デフォルト値は |
6.2.7. validate リンクのコピーリンクがクリップボードにコピーされました!
指定されたディレクトリーの宣言型設定 JSON ファイルを検証します。
コマンド構文
$ opm validate <directory> [<flags>]
第7章 ROSA CLI リンクのコピーリンクがクリップボードにコピーされました!
7.1. ROSA CLI の使用を開始する リンクのコピーリンクがクリップボードにコピーされました!
7.1.1. ROSA CLI について リンクのコピーリンクがクリップボードにコピーされました!
ROSA コマンドラインインターフェイス (CLI) (rosa) は、Red Hat OpenShift Service on AWS クラスターおよびリソースを作成、更新、管理、削除するために使用します。
7.1.2. ROSA CLI のセットアップ リンクのコピーリンクがクリップボードにコピーされました!
以下の手順を使用して、インストールホストに ROSA CLI (rosa) をインストールし、設定します。
手順
最新の AWS CLI (
aws) をインストールして設定します。AWS コマンドラインインターフェイス ドキュメントに従って、お使いのオペレーティングシステム用の AWS CLI をインストールし、設定します。
.aws/credentialsファイルにaws_access_key_id、aws_secret_access_key、およびregionを指定します。AWS ドキュメントの AWS 設定の基本 を参照してください。注記オプションで
AWS_DEFAULT_REGION環境変数を使用して、デフォルトの AWS リージョンを設定できます。AWS API をクエリーし、AWS CLI が適切にインストールおよび設定されているかどうかを確認します。
$ aws sts get-caller-identity --output text出力例
<aws_account_id> arn:aws:iam::<aws_account_id>:user/<username> <aws_user_id>
-
OpenShift Cluster Manager の Downloads ページから、お使いのオペレーティングシステムの ROSA CLI (
rosa) の最新バージョンをダウンロードします。 ダウンロードしたアーカイブから
rosaバイナリーファイルを展開します。次の例では、Linux tar アーカイブからバイナリーを展開します。$ tar xvf rosa-linux.tar.gzパスに
rosaを加えてください。以下の例では、/usr/local/binディレクトリーがユーザーのパスに含まれます。$ sudo mv rosa /usr/local/bin/rosarosaバージョンをクエリーして、ROSA CLI ツールが適切にインストールされていることを確認します。$ rosa version出力例
1.2.15 Your ROSA CLI is up to date.オプション: ROSA CLI のタブ補完を有効にします。タブ補完を有効にすると、
Tabキーを 2 回押すことでサブコマンドが自動的に補完され、コマンドの提案が表示されます。Linux ホストで Bash のタブ補完を永続的に有効にするには、以下を実行します。
Bash 用の
rosaタブ補完設定ファイルを生成し、/etc/bash_completion.d/ディレクトリーに保存します。# rosa completion bash > /etc/bash_completion.d/rosa- 新しいターミナルを開き、設定を有効にします。
macOS ホストで Bash のタブ補完を永続的に有効にするには、以下を実行します。
Bash 用の
rosaタブ補完設定ファイルを生成し、/usr/local/etc/bash_completion.d/ディレクトリーに保存します。$ rosa completion bash > /usr/local/etc/bash_completion.d/rosa- 新しいターミナルを開き、設定を有効にします。
Zsh ホストのタブ補完を永続的に有効にするには、以下を実行します。
Zsh 環境でタブ補完が有効になっていない場合は、以下のコマンドを実行して有効にします。
$ echo "autoload -U compinit; compinit" >> ~/.zshrcZsh の
rosaタブ補完設定ファイルを生成し、関数パスの最初のディレクトリーに保存します。$ rosa completion zsh > "${fpath[1]}/_rosa"- 新しいターミナルを開き、設定を有効にします。
fish のタブ補完を永続的に有効にするには、以下を実行します。
fish 用の
rosaタブ補完設定ファイルを生成し、~/.config/fish/completions/ディレクトリーに保存します。$ rosa completion fish > ~/.config/fish/completions/rosa.fish- 新しいターミナルを開き、設定を有効にします。
PowerShell のタブ補完を永続的に有効にするには、以下を実行します。
PowerShell の
rosaタブ補完設定ファイルを生成し、rosa.ps1という名前のファイルに保存します。PS> rosa completion powershell | Out-String | Invoke-Expression-
PowerShell プロファイルから
rosa.ps1ファイルを取得します。
注記rosaタブ補完の設定に関する詳細は、rosa completion --helpコマンドを実行してヘルプメニューを参照してください。
7.1.3. ROSA CLI の設定 リンクのコピーリンクがクリップボードにコピーされました!
ROSA コマンドラインインターフェイス (CLI) (rosa) を設定するには、次のコマンドを使用します。
7.1.3.1. login リンクのコピーリンクがクリップボードにコピーされました!
ROSA コマンドラインインターフェイス (CLI) (rosa) を使用して Red Hat アカウントにログインする方法は複数あります。ログイン方法については以下で詳しく説明します。
7.1.3.1.1. Red Hat Single Sign-On を使用した ROSA CLI の認証 リンクのコピーリンクがクリップボードにコピーされました!
Red Hat Single Sign-On を使用して ROSA CLI (rosa) にログインできます。Red Hat では、オフライン認証トークンを使用する代わりに、Red Hat Single Sign-On で rosa コマンドラインツールを使用することを推奨しています。
オフライン認証トークンは長期間有効で、オペレーティングシステムに保存され、取り消すことはできません。このような要因が原因で、全体的なセキュリティーリスクが高まり、アカウントへの不正アクセスの可能性が高まります。
または、Red Hat Single Sign-On 方法で認証すると、rosa インスタンスに 10 時間有効な更新トークンが自動的に送信されます。この一意の一時認可コードにより、セキュリティーが強化され、不正アクセスのリスクが軽減されます。
Red Hat Single Sign-On を使用した認証方法では、オフライントークンに依存する既存の自動化が損なわれることはありません。Red Hat では、自動化の目的で サービスアカウント を使用することを推奨しています。自動化やその他の目的でオフライントークンを引き続き使用する必要がある場合は、OpenShift Cluster Manager API Token ページから OpenShift Cluster Manager API トークンをダウンロードできます。
次のいずれかの認証方法を使用します。
- システムに Web ブラウザーがある場合は、「Single Sign-On 認可コードによる ROSA CLI の認証」セクションを参照して、Red Hat Single Sign-On で認証してください。
- Web ブラウザーのないコンテナー、リモートホスト、またはその他の環境を使用している場合は、「Single Sign-On デバイスコードによる ROSA CLI の認証」セクションを参照して、Red Hat Single Sign-On で認証します。
- オフライントークンを使用して ROSA CLI を認証するには、「オフライントークンを使用した ROSA CLI の認証」セクションを参照してください。
Single Sign-On 認可は、ROSA CLI (rosa) バージョン 1.2.36 以降でサポートされています。
7.1.3.1.2. Single Sign-On 認可コードによる ROSA CLI の認証 リンクのコピーリンクがクリップボードにコピーされました!
Red Hat Single Sign-On 認可コードを使用して ROSA CLI (
rosa) にログインするには、次のコマンドを実行します。構文
$ rosa login --use-auth-codeこのコマンドを実行すると、Red Hat Single Sign-On ログインにリダイレクトされます。Red Hat のログインまたはメールでログインします。
Expand 表7.1 親コマンドから継承された任意の引数 オプション 定義 --help
このコマンドのヘルプを表示します。
--debug
デバッグモードを有効にします。
アカウントを切り替えるには、https://sso.redhat.com からログアウトし、端末で
rosa logoutコマンドを実行してから再度ログインを試みます。
7.1.3.1.3. Single Sign-On デバイスコードによる ROSA CLI の認証 リンクのコピーリンクがクリップボードにコピーされました!
コンテナー、リモートホスト、および Web ブラウザーのないその他の環境で作業している場合は、セキュアな認証のために Red Hat Single Sign-On デバイスコードを使用できます。そのためには、Web ブラウザーを搭載した 2 台目のデバイスを使用してログインを承認する必要があります。
Single Sign-On 認可は、ROSA CLI (rosa) バージョン 1.2.36 以降でサポートされています。
Red Hat Single Sign-On デバイスコードを使用して ROSA CLI (
rosa) にログインするには、次のコマンドを実行します。構文
$ rosa login --use-device-codeこのコマンドを実行すると、Red Hat SSO ログインにリダイレクトされ、ログインコードが提供されます。
Expand 表7.2 親コマンドから継承された任意の引数 オプション 定義 --help
このコマンドのヘルプを表示します。
--debug
デバッグモードを有効にします。
アカウントを切り替えるには、https://sso.redhat.com からログアウトし、端末で
rosa logoutコマンドを実行してから再度ログインを試みます。
7.1.3.1.4. オフライントークンを使用した ROSA CLI の認証 リンクのコピーリンクがクリップボードにコピーされました!
Red Hat アカウントにログインし、認証情報を rosa 設定ファイルに保存します。
自動化の目的でオフライントークンを使用するには、OpenShift Cluster Manager API Token ページから OpenShift Cluster Manager API トークンをダウンロードできます。自動化の目的でサービスアカウントを使用するには、Service Accounts ページを参照してください。
Red Hat では、自動化の目的でサービスアカウントを使用することを推奨しています。
Red Hat オフライントークンを使用して ROSA CLI (
rosa) にログインするには、次のコマンドを実行します。構文
$ rosa login [arguments]Expand 表7.3 引数 オプション 定義 --client-id
OpenID クライアント識別子 (文字列)。デフォルトは、
cloud-servicesです。--client-secret
OpenID クライアントシークレット (文字列)。
--insecure
サーバーとの非セキュアな通信を有効にします。これにより、TLS 証明書およびホスト名の検証が無効になります。
--scope
OpenID スコープ (文字列)。このオプションを使用する場合、デフォルトのスコープはこのオプションに置き換えられます。これは複数回繰り返して、複数のスコープを指定できます。デフォルトは、
openidです。--token
トークンにアクセスまたは更新します (文字列)。
--token-url
OpenID トークン URL (文字列)。デフォルトは、
https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/tokenです。Expand 表7.4 親コマンドから継承された任意の引数 オプション 定義 --help
このコマンドのヘルプを表示します。
--debug
デバッグモードを有効にします。
--profile
認証情報ファイルから AWS プロファイル (文字列) を指定します。
7.1.3.2. logout リンクのコピーリンクがクリップボードにコピーされました!
rosa からログアウトします。ログアウトすると、rosa 設定ファイルも削除されます。
構文
$ rosa logout [arguments]
| オプション | 定義 |
|---|---|
| --help | このコマンドのヘルプを表示します。 |
| --debug | デバッグモードを有効にします。 |
| --profile | 認証情報ファイルから AWS プロファイル (文字列) を指定します。 |
7.1.3.3. verify permissions リンクのコピーリンクがクリップボードにコピーされました!
Red Hat OpenShift Service on AWS クラスターの作成に必要な AWS 権限が正しく設定されていることを確認します。
構文
$ rosa verify permissions [arguments]
このコマンドは、AWS Security Token Service(STS) を使用しないクラスターに対してのみパーミッションを検証します。
| オプション | 定義 |
|---|---|
| --help | このコマンドのヘルプを表示します。 |
| --debug | デバッグモードを有効にします。 |
| --region |
コマンドを実行する AWS リージョン (文字列)。この値は |
| --profile | 認証情報ファイルから AWS プロファイル (文字列) を指定します。 |
例
AWS パーミッションが正しく設定されていることを確認します。
$ rosa verify permissions
AWS パーミッションが特定のリージョンで正しく設定されていることを確認します。
$ rosa verify permissions --region=us-west-2
7.1.3.4. verify quota リンクのコピーリンクがクリップボードにコピーされました!
AWS クォータがデフォルトのリージョンに正しく設定されていることを確認します。
構文
$ rosa verify quota [arguments]
| オプション | 定義 |
|---|---|
| --help | このコマンドのヘルプを表示します。 |
| --debug | デバッグモードを有効にします。 |
| --region |
コマンドを実行する AWS リージョン (文字列)。この値は |
| --profile | 認証情報ファイルから AWS プロファイル (文字列) を指定します。 |
例
AWS クォータがデフォルトのリージョンで正しく設定されていることを確認します。
$ rosa verify quota
AWS クォータが特定のリージョンで正しく設定されていることを確認します。
$ rosa verify quota --region=us-west-2
7.1.3.5. download rosa リンクのコピーリンクがクリップボードにコピーされました!
rosa CLI の互換性のある最新バージョンをダウンロードします。
rosa をダウンロードした後、アーカイブの内容を抽出し、パスに追加します。
構文
$ rosa download rosa [arguments]
| オプション | 定義 |
|---|---|
| --help | このコマンドのヘルプを表示します。 |
| --debug | デバッグモードを有効にします。 |
7.1.3.6. download oc リンクのコピーリンクがクリップボードにコピーされました!
OpenShift Container Platform CLI (oc) の最新の互換性のあるバージョンをダウンロードします。
oc をダウンロードした後、アーカイブの内容を抽出してパスに追加する必要があります。
構文
$ rosa download oc [arguments]
| オプション | 定義 |
|---|---|
| --help | このコマンドのヘルプを表示します。 |
| --debug | デバッグモードを有効にします。 |
例
oc クライアントツールをダウンロードします。
$ rosa download oc
7.1.3.7. verify oc リンクのコピーリンクがクリップボードにコピーされました!
OpenShift Container Platform CLI (oc) が正常にインストールされていることを確認します。
構文
$ rosa verify oc [arguments]
| オプション | 定義 |
|---|---|
| --help | このコマンドのヘルプを表示します。 |
| --debug | デバッグモードを有効にします。 |
例
oc クライアントツールを確認します。
$ rosa verify oc
7.1.4. ROSA CLI の更新 リンクのコピーリンクがクリップボードにコピーされました!
ROSA CLI (rosa) の互換性のある最新バージョンに更新します。
手順
ROSA CLI (
rosa) の新しいバージョンが利用可能であることを確認します。$ rosa version出力例
1.2.12 There is a newer release version '1.2.15', please consider updating: https://mirror.openshift.com/pub/openshift-v4/clients/rosa/latest/ROSA CLI の互換性のある最新バージョンをダウンロードします。
$ rosa download rosaこのコマンドは、
rosa-*.tar.gzというアーカイブをカレントディレクトリーにダウンロードします。ファイルの正確な名前は、オペレーティングシステムとシステムアーキテクチャーによって異なります。アーカイブの内容を展開します。
$ tar -xzf rosa-linux.tar.gz抽出したファイルをパスに移動して、新しいバージョンの ROSA CLI をインストールします。以下の例では、
/usr/local/binディレクトリーがユーザーのパスに含まれます。$ sudo mv rosa /usr/local/bin/rosa
検証
ROSA CLI の新しいバージョンがインストールされていることを確認します。
$ rosa version出力例
1.2.15 Your ROSA CLI is up to date.
7.2. ROSA CLI コマンドリファレンス リンクのコピーリンクがクリップボードにコピーされました!
このリファレンスは、ROSA CLI (rosa)コマンドの説明とコマンド例を示しています。
rosa -h を実行してすべてのコマンドを表示するか、rosa <command> --help を実行して、特定のコマンドに関する追加情報を取得します。
7.2.1. ROSA CLI コマンド リンクのコピーリンクがクリップボードにコピーされました!
7.2.1.1. rosa create account-roles リンクのコピーリンクがクリップボードにコピーされました!
クラスターを作成する前に、アカウント全体の IAM ロールを作成します。
使用例
# Create default account roles for ROSA clusters using STS
rosa create account-roles
# Create account roles with a specific permissions boundary
rosa create account-roles --permissions-boundary arn:aws:iam::123456789012:policy/perm-boundary
7.2.1.2. ROSA 作成管理者 リンクのコピーリンクがクリップボードにコピーされました!
クラスターにログインするための管理者ユーザーを作成します。
使用例
# Create an admin user to login to the cluster
rosa create admin -c mycluster -p MasterKey123
7.2.1.3. ROSA 作成オートスケーラー リンクのコピーリンクがクリップボードにコピーされました!
クラスターの Autoscaler の作成
使用例
# Interactively create an autoscaler to a cluster named "mycluster"
rosa create autoscaler --cluster=mycluster --interactive
# Create a cluster-autoscaler where it should skip nodes with local storage
rosa create autoscaler --cluster=mycluster --skip-nodes-with-local-storage
# Create a cluster-autoscaler with log verbosity of '3'
rosa create autoscaler --cluster=mycluster --log-verbosity 3
# Create a cluster-autoscaler with total CPU constraints
rosa create autoscaler --cluster=mycluster --min-cores 10 --max-cores 100
7.2.1.4. rosa create break-glass-credential リンクのコピーリンクがクリップボードにコピーされました!
クラスターの破損したグラス認証情報を作成します。
使用例
# Interactively create a break glass credential to a cluster named "mycluster"
rosa create break-glass-credential --cluster=mycluster --interactive
7.2.1.5. rosa create cluster リンクのコピーリンクがクリップボードにコピーされました!
クラスターの作成
使用例
# Create a cluster named "mycluster"
rosa create cluster --cluster-name=mycluster
# Create a cluster in the us-east-2 region
rosa create cluster --cluster-name=mycluster --region=us-east-2
7.2.1.6. rosa create decision リンクのコピーリンクがクリップボードにコピーされました!
アクセス要求の意思決定を作成する
使用例
# Create a decision for an Access Request to approve it
rosa create decision --access-request <access_request_id> --decision Approved
7.2.1.7. rosa create dns-domain リンクのコピーリンクがクリップボードにコピーされました!
DNS ドメインの作成
使用例
# Create DNS Domain
rosa create dns-domain
7.2.1.8. rosa create external-auth-provider リンクのコピーリンクがクリップボードにコピーされました!
クラスターの外部認証プロバイダーを作成します。
使用例
# Interactively create an external authentication provider to a cluster named "mycluster"
rosa create external-auth-provider --cluster=mycluster --interactive
7.2.1.9. rosa create iamserviceaccount リンクのコピーリンクがクリップボードにコピーされました!
Kubernetes サービスアカウントの IAM ロールを作成します。
使用例
# Create an IAM role for a service account
rosa create iamserviceaccount --cluster my-cluster --name my-app --namespace default
7.2.1.10. rosa create idp リンクのコピーリンクがクリップボードにコピーされました!
クラスターの IDP の追加
使用例
# Add a GitHub identity provider to a cluster named "mycluster"
rosa create idp --type=github --cluster=mycluster
# Add an identity provider following interactive prompts
rosa create idp --cluster=mycluster --interactive
7.2.1.11. rosa create image-mirror リンクのコピーリンクがクリップボードにコピーされました!
クラスターのイメージミラーの作成
使用例
# Create an image mirror for cluster "mycluster"
rosa create image-mirror --cluster=mycluster \
--source=registry.example.com/team \
--mirrors=mirror.corp.com/team,backup.corp.com/team
# Create with a specific type (digest is default and only supported type)
rosa create image-mirror --cluster=mycluster \
--type=digest --source=docker.io/library \
--mirrors=internal-registry.company.com/dockerhub
7.2.1.12. rosa create kubeletconfig リンクのコピーリンクがクリップボードにコピーされました!
クラスターのカスタム kubeletconfig の作成
使用例
# Create a custom kubeletconfig with a pod-pids-limit of 5000
rosa create kubeletconfig --cluster=mycluster --pod-pids-limit=5000
7.2.1.13. rosa create machinepool リンクのコピーリンクがクリップボードにコピーされました!
クラスターへのマシンプールの追加
使用例
# Interactively add a machine pool to a cluster named "mycluster"
rosa create machinepool --cluster=mycluster --interactive
# Add a machine pool mp-1 with 3 replicas of m5.xlarge to a cluster
rosa create machinepool --cluster=mycluster --name=mp-1 --replicas=3 --instance-type=m5.xlarge
# Add a machine pool mp-1 with autoscaling enabled and 3 to 6 replicas of m5.xlarge to a cluster
rosa create machinepool --cluster=mycluster --name=mp-1 --enable-autoscaling \
--min-replicas=3 --max-replicas=6 --instance-type=m5.xlarge
# Add a machine pool with labels to a cluster
rosa create machinepool -c mycluster --name=mp-1 --replicas=2 --instance-type=r5.2xlarge --labels=foo=bar,bar=baz,
# Add a machine pool with spot instances to a cluster
rosa create machinepool -c mycluster --name=mp-1 --replicas=2 --instance-type=r5.2xlarge --use-spot-instances \
--spot-max-price=0.5
# Add a machine pool to a cluster and set the node drain grace period
rosa create machinepool -c mycluster --name=mp-1 --node-drain-grace-period="90 minutes"
7.2.1.14. ROSA ネットワークの作成 リンクのコピーリンクがクリップボードにコピーされました!
ネットワーク AWS クラウド形式スタック
使用例
# Create a AWS cloudformation stack
rosa create network <template-name> --param Param1=Value1 --param Param2=Value2
# ROSA quick start HCP VPC example with one availability zone
rosa create network rosa-quickstart-default-vpc --param Region=us-west-2 --param Name=quickstart-stack --param AvailabilityZoneCount=1 --param VpcCidr=10.0.0.0/16
# ROSA quick start HCP VPC example with two explicit availability zones
rosa create network rosa-quickstart-default-vpc --param Region=us-west-2 --param Name=quickstart-stack --param AZ1=us-west-2b --param AZ2=us-west-2d --param VpcCidr=10.0.0.0/16
# To delete the AWS cloudformation stack
aws cloudformation delete-stack --stack-name <name> --region <region>
# TEMPLATE_NAME:
Specifies the name of the template to use. This should match the name of a directory
under the path specified by '--template-dir' or the 'OCM_TEMPLATE_DIR' environment variable.
The directory should contain a YAML file defining the custom template structure.
If no TEMPLATE_NAME is provided, or if no matching directory is found, the default
built-in template 'rosa-quickstart-default-vpc' will be used.
7.2.1.15. rosa create ocm-role リンクのコピーリンクがクリップボードにコピーされました!
OCM によって使用されるロールの作成
使用例
# Create default ocm role for ROSA clusters using STS
rosa create ocm-role
# Create ocm role with a specific permissions boundary
rosa create ocm-role --permissions-boundary arn:aws:iam::123456789012:policy/perm-boundary
7.2.1.16. ROSA create oidc-config リンクのコピーリンクがクリップボードにコピーされました!
OIDC プロトコルに準拠する OIDC 設定を作成します。
使用例
# Create OIDC config
rosa create oidc-config
7.2.1.17. ROSA create oidc-provider リンクのコピーリンクがクリップボードにコピーされました!
STS クラスターの OIDC プロバイダーを作成します。
使用例
# Create OIDC provider for cluster named "mycluster"
rosa create oidc-provider --cluster=mycluster
7.2.1.18. rosa による operator-roles の作成 リンクのコピーリンクがクリップボードにコピーされました!
クラスターの Operator IAM ロールを作成します。
使用例
# Create default operator roles for cluster named "mycluster"
rosa create operator-roles --cluster=mycluster
# Create operator roles with a specific permissions boundary
rosa create operator-roles -c mycluster --permissions-boundary arn:aws:iam::123456789012:policy/perm-boundary
7.2.1.19. rosa create tuning-configs リンクのコピーリンクがクリップボードにコピーされました!
チューニング設定の追加
使用例
# Add a tuning config with name "tuned1" and spec from a file "file1" to a cluster named "mycluster"
rosa create tuning-config --name=tuned1 --spec-path=file1 --cluster=mycluster"
7.2.1.20. rosa の user-role の作成 リンクのコピーリンクがクリップボードにコピーされました!
ユーザーロールを作成して、アカウントの関連付けを確認します。
使用例
# Create user roles
rosa create user-role
# Create user role with a specific permissions boundary
rosa create user-role --permissions-boundary arn:aws:iam::123456789012:policy/perm-boundary
7.2.1.21. rosa delete account-roles リンクのコピーリンクがクリップボードにコピーされました!
アカウントロールの削除
使用例
# Delete Account roles"
rosa delete account-roles -p prefix
7.2.1.22. ROSA 削除管理者 リンクのコピーリンクがクリップボードにコピーされました!
admin ユーザーを削除します。
使用例
# Delete the admin user
rosa delete admin --cluster=mycluster
7.2.1.23. ROSA 削除オートスケーラー リンクのコピーリンクがクリップボードにコピーされました!
クラスターの Autoscaler の削除
使用例
# Delete the autoscaler config for cluster named "mycluster"
rosa delete autoscaler --cluster=mycluster
7.2.1.24. ROSA 削除クラスター リンクのコピーリンクがクリップボードにコピーされました!
Delete cluster
使用例
# Delete a cluster named "mycluster"
rosa delete cluster --cluster=mycluster
7.2.1.25. rosa delete dns-domain リンクのコピーリンクがクリップボードにコピーされました!
DNS ドメインの削除
使用例
# Delete a DNS domain with ID github-1
rosa delete dns-domain github-1
7.2.1.26. rosa delete external-auth-provider リンクのコピーリンクがクリップボードにコピーされました!
外部認証プロバイダーの削除
使用例
# Delete an external authentication provider named exauth-1
rosa delete external-auth-provider exauth-1 --cluster=mycluster
7.2.1.27. rosa delete iamserviceaccount リンクのコピーリンクがクリップボードにコピーされました!
Kubernetes サービスアカウントの IAM ロールを削除します。
使用例
# Delete IAM role for service account
rosa delete iamserviceaccount --cluster my-cluster \
--name my-app \
--namespace default
7.2.1.28. ROSA 削除 idp リンクのコピーリンクがクリップボードにコピーされました!
クラスター IDP の削除
使用例
# Delete an identity provider named github-1
rosa delete idp github-1 --cluster=mycluster
7.2.1.29. rosa delete image-mirror リンクのコピーリンクがクリップボードにコピーされました!
クラスターからイメージミラーを削除します。
使用例
# Delete image mirror with ID "abc123" from cluster "mycluster"
rosa delete image-mirror --cluster=mycluster abc123
# Delete without confirmation prompt
rosa delete image-mirror --cluster=mycluster abc123 --yes
# Alternative: using the --id flag
rosa delete image-mirror --cluster=mycluster --id=abc123
7.2.1.30. ROSA 削除イングレス リンクのコピーリンクがクリップボードにコピーされました!
クラスター Ingress の削除
使用例
# Delete ingress with ID a1b2 from a cluster named 'mycluster'
rosa delete ingress --cluster=mycluster a1b2
# Delete secondary ingress using the sub-domain name
rosa delete ingress --cluster=mycluster apps2
7.2.1.31. rosa delete kubeletconfig リンクのコピーリンクがクリップボードにコピーされました!
クラスターから kubeletconfig を削除する
使用例
# Delete the KubeletConfig for ROSA Classic cluster 'foo'
rosa delete kubeletconfig --cluster foo
# Delete the KubeletConfig named 'bar' from cluster 'foo'
rosa delete kubeletconfig --cluster foo --name bar
7.2.1.32. rosa delete machinepool リンクのコピーリンクがクリップボードにコピーされました!
マシンプールの削除
使用例
# Delete machine pool with ID mp-1 from a cluster named 'mycluster'
rosa delete machinepool --cluster=mycluster mp-1
7.2.1.33. rosa delete ocm-role リンクのコピーリンクがクリップボードにコピーされました!
OCM ロールの削除
使用例
# Delete OCM role
rosa delete ocm-role --role-arn arn:aws:iam::123456789012:role/xxx-OCM-Role-1223456778
7.2.1.34. rosa delete oidc-config リンクのコピーリンクがクリップボードにコピーされました!
OIDC 設定の削除
使用例
# Delete OIDC config based on registered OIDC Config ID that has been supplied
rosa delete oidc-config --oidc-config-id <oidc_config_id>
7.2.1.35. rosa delete oidc-provider リンクのコピーリンクがクリップボードにコピーされました!
OIDC プロバイダーの削除
使用例
# Delete OIDC provider for cluster named "mycluster"
rosa delete oidc-provider --cluster=mycluster
7.2.1.36. rosa delete operator-roles リンクのコピーリンクがクリップボードにコピーされました!
Operator ロールの削除
使用例
# Delete Operator roles for cluster named "mycluster"
rosa delete operator-roles --cluster=mycluster
7.2.1.37. rosa delete tuning-configs リンクのコピーリンクがクリップボードにコピーされました!
削除チューニング設定
使用例
# Delete tuning config with name tuned1 from a cluster named 'mycluster'
rosa delete tuning-config --cluster=mycluster tuned1
7.2.1.38. rosa delete user-role リンクのコピーリンクがクリップボードにコピーされました!
ユーザーロールの削除
使用例
# Delete user role
rosa delete user-role --role-arn {prefix}-User-{username}-Role
7.2.1.39. rosa describe access-request リンクのコピーリンクがクリップボードにコピーされました!
アクセス要求の詳細を表示します。
使用例
# Describe an Access Request wit id <access_request_id>
rosa describe access-request --id <access_request_id>
7.2.1.40. rosa describe addon リンクのコピーリンクがクリップボードにコピーされました!
アドオンの詳細を表示します。
使用例
# Describe an add-on named "codeready-workspaces"
rosa describe addon codeready-workspaces
7.2.1.41. rosa describe addon-installation リンクのコピーリンクがクリップボードにコピーされました!
アドオンインストールの詳細の表示
使用例
# Describe the 'bar' add-on installation on cluster 'foo'
rosa describe addon-installation --cluster foo --addon bar
7.2.1.42. rosa describe admin リンクのコピーリンクがクリップボードにコピーされました!
cluster-admin ユーザーの詳細を表示します。
使用例
# Describe cluster-admin user of a cluster named mycluster
rosa describe admin -c mycluster
7.2.1.43. ROSA describe autoscaler リンクのコピーリンクがクリップボードにコピーされました!
クラスターの Autoscaler の詳細を表示します。
使用例
# Describe the autoscaler for cluster 'foo'
rosa describe autoscaler --cluster foo
7.2.1.44. rosa describe break-glass-credential リンクのコピーリンクがクリップボードにコピーされました!
クラスターでの破損したグラス認証情報の詳細を表示する
使用例
# Show details of a break glass credential with ID "12345" on a cluster named "mycluster"
rosa describe break-glass-credential 12345 --cluster=mycluster
7.2.1.45. rosa describe cluster リンクのコピーリンクがクリップボードにコピーされました!
クラスターの詳細を表示します。
使用例
# Describe a cluster named "mycluster"
rosa describe cluster --cluster=mycluster
7.2.1.46. rosa describe external-auth-provider リンクのコピーリンクがクリップボードにコピーされました!
クラスターの外部認証プロバイダーの詳細を表示します。
使用例
# Show details of an external authentication provider named "exauth" on a cluster named "mycluster"
rosa describe external-auth-provider exauth --cluster=mycluster
7.2.1.47. rosa describe iamserviceaccount リンクのコピーリンクがクリップボードにコピーされました!
Kubernetes サービスアカウントの IAM ロールを記述します。
使用例
# Describe IAM role for service account
rosa describe iamserviceaccount --cluster my-cluster \
--name my-app \
--namespace default
7.2.1.48. rosa describe ingress リンクのコピーリンクがクリップボードにコピーされました!
クラスター内の指定された Ingress の詳細を表示します。
使用例
rosa describe ingress <ingress_id> -c mycluster
7.2.1.49. rosa describe kubeletconfig リンクのコピーリンクがクリップボードにコピーされました!
クラスターの kubeletconfig の詳細を表示します。
使用例
# Describe the custom kubeletconfig for ROSA Classic cluster 'foo'
rosa describe kubeletconfig --cluster foo
# Describe the custom kubeletconfig named 'bar' for cluster 'foo'
rosa describe kubeletconfig --cluster foo --name bar
7.2.1.50. rosa describe machinepool リンクのコピーリンクがクリップボードにコピーされました!
クラスター上のマシンプールの詳細を表示します。
使用例
# Show details of a machine pool named "mymachinepool" on a cluster named "mycluster"
rosa describe machinepool --cluster=mycluster --machinepool=mymachinepool
7.2.1.51. rosa describe tuning-configs リンクのコピーリンクがクリップボードにコピーされました!
チューニング設定の詳細を表示します。
使用例
# Describe the 'tuned1' tuned config on cluster 'foo'
rosa describe tuning-config --cluster foo tuned1
7.2.1.52. ROSA describe upgrade リンクのコピーリンクがクリップボードにコピーされました!
アップグレードの詳細を表示します。
使用例
# Describe an upgrade-policy"
rosa describe upgrade
7.2.1.53. ROSA で openshift-client のダウンロード リンクのコピーリンクがクリップボードにコピーされました!
OpenShift クライアントツールをダウンロードする
使用例
# Download oc client tools
rosa download oc
7.2.1.54. rosa のダウンロード rosa-client リンクのコピーリンクがクリップボードにコピーされました!
ROSA クライアントツールをダウンロードする
使用例
# Download rosa client tools
rosa download rosa
7.2.1.55. rosa 編集アドオン リンクのコピーリンクがクリップボードにコピーされました!
クラスターのアドオンインストールパラメーターの編集
使用例
# Edit the parameters of the Red Hat OpenShift logging operator add-on installation
rosa edit addon --cluster=mycluster cluster-logging-operator
7.2.1.56. ROSA 編集オートスケーラー リンクのコピーリンクがクリップボードにコピーされました!
クラスターの Autoscaler の編集
使用例
# Interactively edit an autoscaler to a cluster named "mycluster"
rosa edit autoscaler --cluster=mycluster --interactive
# Edit a cluster-autoscaler to skip nodes with local storage
rosa edit autoscaler --cluster=mycluster --skip-nodes-with-local-storage
# Edit a cluster-autoscaler with log verbosity of '3'
rosa edit autoscaler --cluster=mycluster --log-verbosity 3
# Edit a cluster-autoscaler with total CPU constraints
rosa edit autoscaler --cluster=mycluster --min-cores 10 --max-cores 100
7.2.1.57. ROSA 編集クラスター リンクのコピーリンクがクリップボードにコピーされました!
edit cluster
使用例
# Edit a cluster named "mycluster" to make it private
rosa edit cluster -c mycluster --private
# Edit a cluster named "mycluster" to enable User Workload Monitoring
rosa edit cluster -c mycluster --disable-workload-monitoring=false
# Edit all options interactively
rosa edit cluster -c mycluster --interactive
7.2.1.58. rosa edit image-mirror リンクのコピーリンクがクリップボードにコピーされました!
クラスターのイメージミラーの編集
使用例
# Update mirrors for image mirror with ID "abc123" on cluster "mycluster"
rosa edit image-mirror --cluster=mycluster abc123 \
--mirrors=mirror.corp.com/team,backup.corp.com/team,new-mirror.corp.com/team
# Alternative: using the --id flag
rosa edit image-mirror --cluster=mycluster --id=abc123 \
--mirrors=mirror.corp.com/team,backup.corp.com/team,new-mirror.corp.com/team
7.2.1.59. ROSA 編集イングレス リンクのコピーリンクがクリップボードにコピーされました!
クラスター入力(ロードバランサー)の編集
使用例
# Make additional ingress with ID 'a1b2' private on a cluster named 'mycluster'
rosa edit ingress --private --cluster=mycluster a1b2
# Update the router selectors for the additional ingress with ID 'a1b2'
rosa edit ingress --label-match=foo=bar --cluster=mycluster a1b2
# Update the default ingress using the sub-domain identifier
rosa edit ingress --private=false --cluster=mycluster apps
# Update the load balancer type of the apps2 ingress
rosa edit ingress --lb-type=nlb --cluster=mycluster apps2
7.2.1.60. rosa edit kubeletconfig リンクのコピーリンクがクリップボードにコピーされました!
クラスターの kubeletconfig の編集
使用例
# Edit a KubeletConfig to have a pod-pids-limit of 10000
rosa edit kubeletconfig --cluster=mycluster --pod-pids-limit=10000
# Edit a KubeletConfig named 'bar' to have a pod-pids-limit of 10000
rosa edit kubeletconfig --cluster=mycluster --name=bar --pod-pids-limit=10000
7.2.1.61. rosa edit machinepool リンクのコピーリンクがクリップボードにコピーされました!
Edit machine pool
使用例
# Set 4 replicas on machine pool 'mp1' on cluster 'mycluster'
rosa edit machinepool --replicas=4 --cluster=mycluster mp1
# Enable autoscaling and Set 3-5 replicas on machine pool 'mp1' on cluster 'mycluster'
rosa edit machinepool --enable-autoscaling --min-replicas=3 --max-replicas=5 --cluster=mycluster mp1
# Set the node drain grace period to 1 hour on machine pool 'mp1' on cluster 'mycluster'
rosa edit machinepool --node-drain-grace-period="1 hour" --cluster=mycluster mp1
7.2.1.62. rosa edit tuning-configs リンクのコピーリンクがクリップボードにコピーされました!
編集チューニング設定
使用例
# Update the tuning config with name 'tuning-1' with the spec defined in file1
rosa edit tuning-config --cluster=mycluster tuning-1 --spec-path file1
7.2.1.63. ROSA 付与ユーザー リンクのコピーリンクがクリップボードにコピーされました!
クラスターへのユーザーアクセスの付与
使用例
# Add cluster-admin role to a user
rosa grant user cluster-admin --user=myusername --cluster=mycluster
# Grant dedicated-admins role to a user
rosa grant user dedicated-admin --user=myusername --cluster=mycluster
7.2.1.64. ROSA init リンクのコピーリンクがクリップボードにコピーされました!
Red Hat OpenShift Service on AWS をサポートするテンプレートの適用
使用例
# Configure your AWS account to allow IAM (non-STS) ROSA clusters
rosa init
# Configure a new AWS account using pre-existing OCM credentials
rosa init --token=$OFFLINE_ACCESS_TOKEN
7.2.1.65. ROSA インストールアドオン リンクのコピーリンクがクリップボードにコピーされました!
クラスターへのアドオンのインストール
使用例
# Add the CodeReady Workspaces add-on installation to the cluster
rosa install addon --cluster=mycluster codeready-workspaces
7.2.1.66. ROSA リンク ocm-role リンクのコピーリンクがクリップボードにコピーされました!
OCM ロールを特定の OCM 組織にリンクします。
使用例
# Link OCM role
rosa link ocm-role --role-arn arn:aws:iam::123456789012:role/ManagedOpenshift-OCM-Role
7.2.1.67. ROSA リンクユーザーロール リンクのコピーリンクがクリップボードにコピーされました!
ユーザーロールを特定の OCM アカウントにリンクします。
使用例
# Link user roles
rosa link user-role --role-arn arn:aws:iam::{accountid}:role/{prefix}-User-{username}-Role
7.2.1.68. rosa list access-request リンクのコピーリンクがクリップボードにコピーされました!
アクセスリクエストの一覧表示
使用例
# List all Access Requests for cluster 'foo'
rosa list access-request --cluster foo
7.2.1.69. rosa list account-roles リンクのコピーリンクがクリップボードにコピーされました!
アカウントロールおよびポリシーを一覧表示します。
使用例
# List all account roles
rosa list account-roles
7.2.1.70. ROSA リストアドオン リンクのコピーリンクがクリップボードにコピーされました!
アドオンインストールの一覧表示
使用例
# List all add-on installations on a cluster named "mycluster"
rosa list addons --cluster=mycluster
7.2.1.71. ROSA list break-glass-credentials リンクのコピーリンクがクリップボードにコピーされました!
list break glass credential
使用例
# List all break glass credentials for a cluster named 'mycluster'"
rosa list break-glass-credentials -c mycluster
7.2.1.72. ROSA リストクラスター リンクのコピーリンクがクリップボードにコピーされました!
クラスターをリスト表示します。
使用例
# List all clusters
rosa list clusters
7.2.1.73. rosa list dns-domain リンクのコピーリンクがクリップボードにコピーされました!
DNS ドメインの一覧表示
使用例
# List all DNS Domains tied to your organization ID"
rosa list dns-domain
7.2.1.74. rosa list external-auth-providers リンクのコピーリンクがクリップボードにコピーされました!
外部認証プロバイダーの一覧を表示します。
使用例
# List all external authentication providers for a cluster named 'mycluster'"
rosa list external-auth-provider -c mycluster
7.2.1.75. ROSA リストゲート リンクのコピーリンクがクリップボードにコピーされました!
利用可能な OCP Gates の一覧
使用例
# List all OCP gates for OCP version
rosa list gates --version 4.9
# List all STS gates for OCP version
rosa list gates --gate sts --version 4.9
# List all OCP gates for OCP version
rosa list gates --gate ocp --version 4.9
# List available gates for cluster upgrade version
rosa list gates -c <cluster_id> --version 4.9.15
7.2.1.76. ROSA リスト iamserviceaccounts リンクのコピーリンクがクリップボードにコピーされました!
Kubernetes サービスアカウントの IAM ロールを一覧表示します。
使用例
# List IAM roles for service accounts
rosa list iamserviceaccounts --cluster my-cluster
7.2.1.77. rosa list idps リンクのコピーリンクがクリップボードにコピーされました!
クラスター IDP の一覧表示
使用例
# List all identity providers on a cluster named "mycluster"
rosa list idps --cluster=mycluster
7.2.1.78. rosa list image-mirrors リンクのコピーリンクがクリップボードにコピーされました!
クラスターイメージミラーの一覧表示
使用例
# List all image mirrors on a cluster named "mycluster"
rosa list image-mirrors --cluster=mycluster
7.2.1.79. ROSA リストイングレス リンクのコピーリンクがクリップボードにコピーされました!
クラスター Ingress の一覧表示
使用例
# List all routes on a cluster named "mycluster"
rosa list ingresses --cluster=mycluster
7.2.1.80. ROSA list instance-types リンクのコピーリンクがクリップボードにコピーされました!
インスタンスタイプの一覧表示
使用例
# List all instance types
rosa list instance-types
7.2.1.81. ROSA list kubeletconfigs リンクのコピーリンクがクリップボードにコピーされました!
kubeletconfigs を一覧表示します。
使用例
# List the kubeletconfigs for cluster 'foo'
rosa list kubeletconfig --cluster foo
7.2.1.82. ROSA 一覧マシンプール リンクのコピーリンクがクリップボードにコピーされました!
クラスターマシンプールの一覧表示
使用例
# List all machine pools on a cluster named "mycluster"
rosa list machinepools --cluster=mycluster
# List machine pools showing all information
rosa list machinepools --cluster=mycluster --all
7.2.1.83. rosa list ocm-roles リンクのコピーリンクがクリップボードにコピーされました!
ocm ロールを一覧表示します。
使用例
# List all ocm roles
rosa list ocm-roles
7.2.1.84. ROSA リスト oidc-config リンクのコピーリンクがクリップボードにコピーされました!
OIDC 設定リソースの一覧表示
使用例
# List all OIDC Configurations tied to your organization ID"
rosa list oidc-config
7.2.1.85. ROSA リスト oidc-providers リンクのコピーリンクがクリップボードにコピーされました!
OIDC プロバイダーの一覧を表示します。
使用例
# List all oidc providers
rosa list oidc-providers
7.2.1.86. ROSA リスト operator-roles リンクのコピーリンクがクリップボードにコピーされました!
オペレーターのロールとポリシーの一覧表示
使用例
# List all operator roles
rosa list operator-roles
7.2.1.87. ROSA リストリージョン リンクのコピーリンクがクリップボードにコピーされました!
利用可能なリージョンの一覧を表示します。
使用例
# List all available regions
rosa list regions
7.2.1.88. rosa list tuning-configs リンクのコピーリンクがクリップボードにコピーされました!
チューニング設定の一覧表示
使用例
# List all tuning configuration for a cluster named 'mycluster'"
rosa list tuning-configs -c mycluster
7.2.1.89. ROSA list user-roles リンクのコピーリンクがクリップボードにコピーされました!
ユーザーロールの一覧を表示します。
使用例
# List all user roles
rosa list user-roles
7.2.1.90. ROSA リストユーザー リンクのコピーリンクがクリップボードにコピーされました!
クラスターユーザーの一覧を表示します。
使用例
# List all users on a cluster named "mycluster"
rosa list users --cluster=mycluster
7.2.1.91. ROSA リストのバージョン リンクのコピーリンクがクリップボードにコピーされました!
利用可能なバージョンを一覧表示します。
使用例
# List all OpenShift versions
rosa list versions
7.2.1.92. ROSA ログイン リンクのコピーリンクがクリップボードにコピーされました!
Red Hat アカウントにログインします。
使用例
# Login to the OpenShift API with an existing token generated from https://console.redhat.com/openshift/token/rosa
rosa login --token=$OFFLINE_ACCESS_TOKEN
7.2.1.93. ROSA ログ リンクのコピーリンクがクリップボードにコピーされました!
クラスターのインストールまたはアンインストールログの表示
使用例
# Show install logs for a cluster named 'mycluster'
rosa logs install --cluster=mycluster
# Show uninstall logs for a cluster named 'mycluster'
rosa logs uninstall --cluster=mycluster
7.2.1.94. ROSA ログのインストール リンクのコピーリンクがクリップボードにコピーされました!
クラスターのインストールログの表示
使用例
# Show last 100 install log lines for a cluster named "mycluster"
rosa logs install mycluster --tail=100
# Show install logs for a cluster using the --cluster flag
rosa logs install --cluster=mycluster
7.2.1.95. ROSA ログのアンインストール リンクのコピーリンクがクリップボードにコピーされました!
クラスターのアンインストールログを表示します。
使用例
# Show last 100 uninstall log lines for a cluster named "mycluster"
rosa logs uninstall mycluster --tail=100
# Show uninstall logs for a cluster using the --cluster flag
rosa logs uninstall --cluster=mycluster
7.2.1.96. ROSA register oidc-config リンクのコピーリンクがクリップボードにコピーされました!
管理対象外の OIDC 設定を Openshift Clusters Manager に登録します。
使用例
# Register OIDC config
rosa register oidc-config
7.2.1.97. ROSA revoke break-glass-credentials リンクのコピーリンクがクリップボードにコピーされました!
glass 認証情報の取り消し
使用例
# Revoke all break glass credentials
rosa revoke break-glass-credentials --cluster=mycluster
7.2.1.98. ROSA 取り消しユーザー リンクのコピーリンクがクリップボードにコピーされました!
ユーザーからのロールを取り消します。
使用例
# Revoke cluster-admin role from a user
rosa revoke user cluster-admins --user=myusername --cluster=mycluster
# Revoke dedicated-admin role from a user
rosa revoke user dedicated-admins --user=myusername --cluster=mycluster
7.2.1.99. ROSA uninstall addon リンクのコピーリンクがクリップボードにコピーされました!
クラスターからアドオンをアンインストール
使用例
# Remove the CodeReady Workspaces add-on installation from the cluster
rosa uninstall addon --cluster=mycluster codeready-workspaces
7.2.1.100. ROSA unlink ocm-role リンクのコピーリンクがクリップボードにコピーされました!
特定の OCM 組織からのリンク解除 ocm ロール
使用例
#Unlink ocm role
rosa unlink ocm-role --role-arn arn:aws:iam::123456789012:role/ManagedOpenshift-OCM-Role
7.2.1.101. ROSA のリンク解除ユーザーロール リンクのコピーリンクがクリップボードにコピーされました!
特定の OCM アカウントからユーザーロールのリンクを解除します
使用例
# Unlink user role
rosa unlink user-role --role-arn arn:aws:iam::{accountid}:role/{prefix}-User-{username}-Role
7.2.1.102. ROSA アップグレード account-roles リンクのコピーリンクがクリップボードにコピーされました!
アカウント全体の IAM ロールを最新バージョンにアップグレードします。
使用例
# Upgrade account roles for ROSA STS clusters
rosa upgrade account-roles
7.2.1.103. ROSA アップグレードクラスター リンクのコピーリンクがクリップボードにコピーされました!
upgrade cluster
使用例
# Interactively schedule an upgrade on the cluster named "mycluster"
rosa upgrade cluster --cluster=mycluster --interactive
# Schedule a cluster upgrade within the hour
rosa upgrade cluster -c mycluster --version 4.12.20
# Check if any gates need to be acknowledged prior to attempting an upgrading
rosa upgrade cluster -c mycluster --version 4.12.20 --dry-run
7.2.1.104. ROSA アップグレードマシンプール リンクのコピーリンクがクリップボードにコピーされました!
アップグレードマシンプール
使用例
# Interactively schedule an upgrade on the cluster named "mycluster"" for a machinepool named "np1"
rosa upgrade machinepool np1 --cluster=mycluster --interactive
# Schedule a machinepool upgrade within the hour
rosa upgrade machinepool np1 -c mycluster --version 4.12.20
7.2.1.105. ROSA アップグレード operator-roles リンクのコピーリンクがクリップボードにコピーされました!
クラスターのアップグレード Operator IAM ロール。
使用例
# Upgrade cluster-specific operator IAM roles
rosa upgrade operators-roles
7.2.1.106. ROSA アップグレードロール リンクのコピーリンクがクリップボードにコピーされました!
クラスター固有の IAM ロールを最新バージョンにアップグレードします。
使用例
# Upgrade cluster roles for ROSA STS clusters
rosa upgrade roles -c <cluster_key>
7.2.1.107. ROSA 検証ネットワーク リンクのコピーリンクがクリップボードにコピーされました!
VPC サブネットが正しく設定されていることを確認します。
使用例
# Verify two subnets
rosa verify network --subnet-ids subnet-03046a9b92b5014fb,subnet-03046a9c92b5014fb
7.2.1.108. ROSA で openshift-client を確認する リンクのコピーリンクがクリップボードにコピーされました!
OpenShift クライアントツールを確認する
使用例
# Verify oc client tools
rosa verify oc
7.2.1.109. ROSA 検証パーミッション リンクのコピーリンクがクリップボードにコピーされました!
AWS アクセス許可が STS クラスターインストールに対して ok になっていることを確認する
使用例
# Verify AWS permissions are configured correctly
rosa verify permissions
# Verify AWS permissions in a different region
rosa verify permissions --region=us-west-2
7.2.1.110. ROSA 検証クォータ リンクのコピーリンクがクリップボードにコピーされました!
AWS クォータがクラスターのインストールに問題がないことを確認します。
使用例
# Verify AWS quotas are configured correctly
rosa verify quota
# Verify AWS quotas in a different region
rosa verify quota --region=us-west-2
7.2.1.111. ROSA による rosa-client の確認 リンクのコピーリンクがクリップボードにコピーされました!
ROSA クライアントツールを確認する
使用例
# Verify rosa client tools
rosa verify rosa
7.2.1.112. ROSA whoami リンクのコピーリンクがクリップボードにコピーされました!
ユーザーアカウント情報を表示します
使用例
# Displays user information
rosa whoami
7.3. ROSA CLI コマンドの最小権限 リンクのコピーリンクがクリップボードにコピーされました!
最小権限のプリンシパルに準拠した権限を割り当てたロールを作成できます。このプリンシパルでは、ロールを割り当てられたユーザーには、実行する必要のある特定のアクションの範囲を超える権限は割り当てられません。これらのポリシーには、ROSA コマンドラインインターフェイス (CLI) (rosa) を使用して特定のアクションを実行するために必要な最小限の権限のみが含まれています。
このトピックで紹介されているポリシーとコマンドは相互に連携して機能しますが、AWS 環境内に他の制限があり、これらのコマンドのポリシーが特定のニーズに不十分な場合があります。Red Hat は、他の AWS アイデンティティーおよびアクセス管理 (IAM) 制限が存在しないことを前提として、これらの例をベースラインとして提供しています。
AWS コンソールでアクセス許可、ポリシー、ロールを設定する方法の詳細は、AWS ドキュメントの AWS アイデンティティーおよびアクセス管理 を参照してください。
7.3.1. 一般的な Red Hat OpenShift Service on AWS CLI コマンドに対する最小特権 リンクのコピーリンクがクリップボードにコピーされました!
次の例は、Red Hat OpenShift Service on AWS クラスターを構築するときに最も一般的な ROSA CLI コマンドに必要な最小限の特権を示しています。
7.3.1.1. マネージド OpenID Connect (OIDC) プロバイダーの作成 リンクのコピーリンクがクリップボードにコピーされました!
指定された権限で次のコマンドを実行し、auto モードを使用してマネージド OIDC プロバイダーを作成します。
入力
$ rosa create oidc-config --mode auto
ポリシー
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "CreateOidcConfig",
"Effect": "Allow",
"Action": [
"iam:TagOpenIDConnectProvider",
"iam:CreateOpenIDConnectProvider"
],
"Resource": "*"
}
]
}
7.3.1.2. 管理されていない OpenID Connect プロバイダーの作成 リンクのコピーリンクがクリップボードにコピーされました!
指定された権限で次のコマンドを実行し、auto モードを使用して管理されていない OIDC プロバイダーを作成します。
入力
$ rosa create oidc-config --mode auto --managed=false
ポリシー
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"iam:GetRole",
"iam:TagOpenIDConnectProvider",
"iam:ListRoleTags",
"iam:ListRoles",
"iam:CreateOpenIDConnectProvider",
"s3:CreateBucket",
"s3:PutObject",
"s3:PutBucketTagging",
"s3:PutBucketPolicy",
"s3:PutObjectTagging",
"s3:PutBucketPublicAccessBlock",
"secretsmanager:CreateSecret",
"secretsmanager:TagResource"
],
"Resource": "*"
}
]
}
7.3.1.3. アカウントロールの一覧表示 リンクのコピーリンクがクリップボードにコピーされました!
指定したパーミッションで次のコマンドを実行して、アカウントのロールを一覧表示します。
入力
$ rosa list account-roles
ポリシー
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ListAccountRoles",
"Effect": "Allow",
"Action": [
"iam:ListRoleTags",
"iam:ListRoles"
],
"Resource": "*"
}
]
}
7.3.1.4. Operator ロールの一覧表示 リンクのコピーリンクがクリップボードにコピーされました!
指定された権限で次のコマンドを実行して、Operator のロールをリスト表示します。
入力
$ rosa list operator-roles
ポリシー
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ListOperatorRoles",
"Effect": "Allow",
"Action": [
"iam:ListRoleTags",
"iam:ListAttachedRolePolicies",
"iam:ListRoles",
"iam:ListPolicyTags"
],
"Resource": "*"
}
]
}
7.3.1.5. OIDC プロバイダーの一覧表示 リンクのコピーリンクがクリップボードにコピーされました!
OIDC プロバイダーをリスト表示するには、指定された権限で次のコマンドを実行します。
入力
$ rosa list oidc-providers
ポリシー
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ListOidcProviders",
"Effect": "Allow",
"Action": [
"iam:ListOpenIDConnectProviders",
"iam:ListOpenIDConnectProviderTags"
],
"Resource": "*"
}
]
}
7.3.1.6. クォータの確認 リンクのコピーリンクがクリップボードにコピーされました!
指定された権限で次のコマンドを実行して、クォータを確認します。
入力
$ rosa verify quota
ポリシー
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VerifyQuota",
"Effect": "Allow",
"Action": [
"elasticloadbalancing:DescribeAccountLimits",
"servicequotas:ListServiceQuotas"
],
"Resource": "*"
}
]
}
7.3.1.7. マネージド OIDC 設定の削除 リンクのコピーリンクがクリップボードにコピーされました!
auto モードを使用して管理対象 OIDC 設定を削除するには、指定された権限で次のコマンドを実行します。
入力
$ rosa delete oidc-config -–mode auto
ポリシー
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "DeleteOidcConfig",
"Effect": "Allow",
"Action": [
"iam:ListOpenIDConnectProviders",
"iam:DeleteOpenIDConnectProvider"
],
"Resource": "*"
}
]
}
7.3.1.8. マネージドではない OIDC 設定の削除 リンクのコピーリンクがクリップボードにコピーされました!
auto モードを使用して管理されていない OIDC 設定を削除するには、指定された権限で次のコマンドを実行します。
入力
$ rosa delete oidc-config -–mode auto
ポリシー
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"iam:ListOpenIDConnectProviders",
"iam:DeleteOpenIDConnectProvider",
"secretsmanager:DeleteSecret",
"s3:ListBucket",
"s3:DeleteObject",
"s3:DeleteBucket"
],
"Resource": "*"
}
]
}
7.3.1.9. クラスターの作成 リンクのコピーリンクがクリップボードにコピーされました!
指定された権限で次のコマンドを実行して、Red Hat OpenShift Service on AWS クラスターを作成します。
入力
$ rosa create cluster --hosted-cp
ポリシー
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "CreateCluster",
"Effect": "Allow",
"Action": [
"iam:GetRole",
"iam:ListRoleTags",
"iam:ListAttachedRolePolicies",
"iam:ListRoles",
"ec2:DescribeSubnets",
"ec2:DescribeRouteTables",
"ec2:DescribeAvailabilityZones"
],
"Resource": "*"
}
]
}
7.3.1.10. アカウントロールおよび Operator ロールの作成 リンクのコピーリンクがクリップボードにコピーされました!
指定された権限で以下のコマンドを実行し、auto モードを使用してアカウントおよび Operator ロールを作成します。
入力
$ rosa create account-roles --mode auto --hosted-cp
ポリシー
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "CreateAccountRoles",
"Effect": "Allow",
"Action": [
"iam:GetRole",
"iam:UpdateAssumeRolePolicy",
"iam:ListRoleTags",
"iam:GetPolicy",
"iam:TagRole",
"iam:ListRoles",
"iam:CreateRole",
"iam:AttachRolePolicy",
"iam:ListPolicyTags"
],
"Resource": "*"
}
]
}
7.3.1.11. アカウントロールの削除 リンクのコピーリンクがクリップボードにコピーされました!
指定された権限で次のコマンドを実行して、auto モードでアカウントロールを削除します。
入力
$ rosa delete account-roles -–mode auto
ポリシー
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "DeleteAccountRoles",
"Effect": "Allow",
"Action": [
"iam:GetRole",
"iam:ListInstanceProfilesForRole",
"iam:DetachRolePolicy",
"iam:ListAttachedRolePolicies",
"iam:ListRoles",
"iam:DeleteRole",
"iam:ListRolePolicies"
],
"Resource": "*"
}
]
}
7.3.1.12. Operator ロールの削除 リンクのコピーリンクがクリップボードにコピーされました!
指定された権限で以下のコマンドを実行し、auto モードで Operator ロールを削除します。
入力
$ rosa delete operator-roles -–mode auto
ポリシー
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "DeleteOperatorRoles",
"Effect": "Allow",
"Action": [
"iam:GetRole",
"iam:DetachRolePolicy",
"iam:ListAttachedRolePolicies",
"iam:ListRoles",
"iam:DeleteRole"
],
"Resource": "*"
}
]
}
7.3.2. 権限を必要としない ROSA CLI コマンド リンクのコピーリンクがクリップボードにコピーされました!
次の ROSA CLI コマンドを実行するには、権限やポリシーは必要ありません。代わりに、アクセスキーと設定されたシークレットキー、またはアタッチされたロールが必要です。
| コマンド | 入力 |
|---|---|
| list cluster |
|
| list versions |
|
| describe cluster |
|
| create admin |
|
| list users |
|
| list upgrades |
|
| list OIDC configuration |
|
| list identity providers |
|
| list ingresses |
|
7.4. Red Hat OpenShift Service on AWS クラスターの請求先アカウントの管理 リンクのコピーリンクがクリップボードにコピーされました!
クラスターをデプロイした後、ROSA CLI (rosa) を使用して、クラスターを目的の AWS 請求先アカウントにリンクできます。
これは、クラスターのデプロイ中に誤って間違った AWS 請求先アカウントにリンクした場合や、請求先アカウントを更新する必要がある場合に役立ちます。
OpenShift Cluster Manager を通じて請求先アカウントを更新することもできます。詳細は、Red Hat OpenShift Service on AWS クラスターの請求先アカウントの更新 を参照してください。
7.4.1. Red Hat OpenShift Service on AWS クラスターの請求先アカウントの更新 リンクのコピーリンクがクリップボードにコピーされました!
前提条件
- 複数の AWS 請求先アカウントがある。
- クラスターをリンクする必要がある AWS 請求先アカウントが、クラスターのデプロイ先の Red Hat 組織にすでにリンクされている。
手順
ターミナルウィンドウで次のコマンドを実行します。
構文
$ rosa edit cluster -c <cluster_ID>1 - 1
<cluster_ID>は、AWS 請求先アカウントを更新するクラスターの ID に置き換えます。
注記アクティブなクラスターの ID を特定するには、ターミナルウィンドウで
$ rosa list clustersコマンドを実行します。-
対話モード内で
Billing Accountパラメーターに移動します。 利用可能なオプションのリストから目的の AWS 請求先アカウントを選択し、"Enter" を押します。
これでクラスターの AWS 請求先アカウントが更新されます。
Legal Notice
リンクのコピーリンクがクリップボードにコピーされました!
Copyright © Red Hat
OpenShift documentation is licensed under the Apache License 2.0 (https://www.apache.org/licenses/LICENSE-2.0).
Modified versions must remove all Red Hat trademarks.
Portions adapted from https://github.com/kubernetes-incubator/service-catalog/ with modifications by Red Hat.
Red Hat, Red Hat Enterprise Linux, the Red Hat logo, the Shadowman logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
Node.js® is an official trademark of the OpenJS Foundation.
The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation’s permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.