1 Platform CLIのイントロダクション
重要:
このドキュメントで説明されているソフトウェアは、Extended SupportまたはSustaining Supportにあります。 詳細は、「Oracleオープン・ソース・サポート・ポリシー」を参照してください。
このドキュメントに記載されているソフトウェアをできるだけ早くアップグレードすることをお勧めします。
Oracle Cloud Native Environment Platform CLI, olcnectl
は、Oracle Cloud Native Environmentのコンポーネントを構成、デプロイおよび管理するために使用されます。 olcnectl
コマンドは、オペレータ・ノードのolcnectl
ソフトウェア・パッケージを使用してインストールされます。 オペレータ・ノードの設定の詳細は、「スタート・ガイド」を参照してください。
olcnectl
と対話するには、一連のオプションを指定してコマンドを入力します。 Platform CLIの構文は次のとおりです。
olcnectl command [command_options|{-h|--help}]
各コマンドの完全な構文およびオプションは、「Platform CLIコマンド」にあります。
olcnectl
コマンドを使用すると、欠落しているオプションの入力を求められます。
構文ヘルプの表示
--help
オプションを使用して、olcnectl
コマンドの構文に関するヘルプを取得できます。 たとえば、olcnectl
コマンドで使用可能なコマンド・オプションを表示するには、次のように入力します:
olcnectl --help
出力は次のようになります:
A CLI that talks to an Oracle Cloud Native Environment Platform API Server endpoint,
facilitating deployment and management of Kubernetes clusters and their resources
Usage:
olcnectl [command]
Available Commands:
certificates X509 certificate management utilities
completion Generate the autocompletion script for the specified shell
environment Environment operations
help Help about any command
module Modules that can be modified in an environment
node Perform Platform configuration on individual compute resources
provision Provisions a complete deployment including Platform components and modules
template Generate a configuration file template
Flags:
-h, --help help for olcnectl
Use "olcnectl [command] --help" for more information about a command.
Available Commands
セクションには、olcnectl
コマンドで使用可能なコマンドがリストされます。 この場合、コマンドolcnectl certificates
, olcnectl completion
, olcnectl environment
などを使用できます。
Flags
セクションには、使用できるコマンド・オプションがリストされます。
olcnectl help
コマンドは、olcnectl --help
を使用する場合と同じです。 olcnectl
コマンドのヘルプを出力します。
ヘルプ・システムにさらにドリルダウンするには、Available Commands
セクションにリストされているコマンドに--help
オプションを指定します。 たとえば、olcnectl module
コマンドで使用可能なコマンドおよびオプションを表示するには、次のように入力します:
olcnectl module --help
出力は次のようになります:
Modules that are used to customize your environment
Usage:
olcnectl module [command]
Available Commands:
backup Backup a module
create Create a module
install Install a module
instances List all module instances that are defined in an environment
list Show all modules that can be installed
property Commands that interact with module properties
report Display the report of the selected module instance
restore Restore a module
uninstall Uninstall a module
update Update a module
validate Validate that an module can be installed
version Show version(s) of module(s) that can be installable
Flags:
-a, --api-server string Platform API Server to talk to. If this is not specified, a local instance of the API server will be created for the duration of the command
--config-file string Location of configuration file that contains the optional flags of a command
-h, --help help for module
--olcne-ca-path string Optional path to a predefined CA or the a destination if using a secret manager that will download the CA. Default: /home/opc/.olcne/certificates/<APISERVER_URL>/ca.cert or gathered from the local config (See: '--update-config')
--olcne-node-cert-path string Optional path to a predefined Key or the a destination if using a secret manager that will download the Key. Default: /home/opc/.olcne/certificates/<APISERVER_URL>/node.key or gathered from the local config (See: '--update-config')
--olcne-node-key-path string Optional path to a predefined Cert or the a destination if using a secret manager that will download the Cert. Default: /home/opc/.olcne/certificates/<APISERVER_URL>/node.cert or gathered from the local config (See: '--update-config')
...
Use "olcnectl module [command] --help" for more information about a command.
ここでも、Available Commands
セクションには、そのコマンドで使用可能なサブコマンドがリストされます。 この場合、olcnectl module backup
, olcnectl module create
, olcnectl module install
などのコマンドを使用できます。
Flags
項には、すべてのサブコマンドで使用できるオプションが表示されます。
ヘルプ・システムをさらにドリルダウンすると、olcnectl module property
コマンドには、get
とlist
という2つのオプションがあります。
olcnectl module property --help
出力は次のようになります:
Commands that interact with module properties
Usage:
olcnectl module property [command]
Available Commands:
get Gets the value of one or more properties
list Show all properties for a module
Flags:
-h, --help help for property
Global Flags:
-a, --api-server string Platform API Server to talk to. If this is not ...
--config-file string Location of configuration file that contains ...
--olcne-ca-path string Optional path to a predefined CA or the a ...
...
Use "olcnectl module property [command] --help" for more information about a command.
新しいコマンド・オプションのセットがGlobal Flags
項にリストされます。 このセクションに示すオプションは、すべてのolcnectl
サブコマンドで使用されるグローバル・フラグです。 グローバル・フラグの詳細は、「グローバル・フラグの使用」を参照してください。
コマンド・オプションのリストを取得するには、--help
オプションを指定して完全なコマンドを含める必要があります。 この場合、olcnectl module property get
コマンドには、Flags
セクションに示すように4つのオプションがあります。
olcnectl module property get --help
出力は次のようになります:
Given a list of properties, fetch the value of each for a specific module
Usage:
olcnectl module property get [flags]
Flags:
-E, --environment-name string Name of the environment
-h, --help help for get
-N, --name string Name of the module
-P, --property strings Names of properties to fetch
...
olcnectl module create
およびolcnectl module update
コマンドのヘルプ・システムは、--help
オプションのほかの用途とは動作が異なります。 1つの環境内に存在できるモジュールの数は、Platform CLIで適切なヘルプを表示するために、モジュールに関する情報を提供する必要があります。 olcnectl module create
コマンドのヘルプを表示するには、次のように入力します:
olcnectl module create --help
出力は次のようになります:
Create a module in a environment
Usage:
olcnectl module create [flags]
Flags:
-E, --environment-name string Name of the environment
-h, --help help for create
-M, --module strings Module to create
-N, --name strings Name to assign the module
...
各モジュールを作成するためのオプションを表示するには、--module
オプションを使用し、モジュール・タイプを指定する必要があります。 モジュール・タイプは、Module Createにリストされています。 たとえば、Kubernetesモジュールの作成に関するヘルプを表示するには、モジュール・タイプをkubernetes
として指定します。
olcnectl module create --module kubernetes --help
出力は次のようになります:
Create a module in a environment
Usage:
olcnectl module create [flags]
Flags:
-b, --apiserver-bind-port string Kubernetes API Server bind port (default "6443")
-B, --apiserver-bind-port-alt string Port for the Kubernetes API Server to bind to if a virtual-ip is used (default "6444")
-e, --apiserver-cert-extra-sans string Kubernetes API Server extra sans
--compact string Allow workloads to be deployed on control-plane nodes (default "false")
-r, --container-registry string Container Registry that holds the kubernetes images
-c, --control-plane-nodes string A comma separated list of control-plane nodes
-E, --environment-name string Name of the environment
-h, --help help for create
-x, --kube-proxy-mode string Routing mode for the Kubernetes proxy (default "iptables")
--kube-tls-cipher-suites string TLS Cipher for kubernetes
--kube-tls-min-version string TLS Minimum Version for kubernetes (default "VersionTLS12")
-v, --kube-version string Kubernetes version (default "1.26.15")
-t, --kubeadm-token string kubeadm token used to join nodes
-l, --load-balancer string API Server load balancer IP address
-M, --module strings Module to create
-N, --name strings Name to assign the module
...
同様に、olcnectl module update
コマンドのヘルプを取得するには、次を使用します:
olcnectl module update --help
出力は次のようになります:
Update a module
Usage:
olcnectl module update [flags]
Flags:
-E, --environment-name string Name of the environment
-F, --force Update without prompting
-g, --generate-scripts Generate a script for each node that takes all suggested actions
-h, --help help for update
-N, --name strings Modules to update
...
出力には、--name
オプションが表示されます。 これは、モジュールの指定に使用するオプションです。 この例では、mycluster
という名前のKubernetesモジュールに対するolcnectl module update --help
コマンドの出力を示します:
olcnectl module update --environment-name myenvironment --name mycluster --help
出力は次のようになります:
Update a module
Usage:
olcnectl module update [flags]
Flags:
--compact string Allow workloads to be deployed on control-plane nodes (default "false")
-r, --container-registry string Container Registry that holds the kubernetes images
-c, --control-plane-nodes string A comma separated list of control-plane nodes
-E, --environment-name string Name of the environment
-F, --force Update without prompting
-g, --generate-scripts Generate a script for each node that takes all suggested actions
-h, --help help for update
-v, --kube-version string Kubernetes version (default "1.26.15")
-N, --name strings Modules to update
...
出力には、Kubernetesモジュールのスケーリングまたは更新/アップグレードに使用できるオプションが表示されます。
Platform API Serverの設定
Platform CLIはOracle Cloud Native EnvironmentPlatform API Serverに接続します。 Platform CLIがインストールされているオペレータ・ノードを使用して、多数のPlatform API Serverインスタンスに接続できます。 Platform API Serverは、olcnectl --api-server api_server_address:8091
オプションを使用して指定します。 これにより、単一のオペレータ・ノードを使用して多くの環境を管理できます。 たとえば、apiserver.example.com
のPlatform API Serverに接続するには、次を使用します:
olcnectl module property list \
--api-server apiserver.example.com:8091 \
--environment-name myenvironment \
--name mycluster
olcnectl environment create
コマンドを使用して環境を作成する場合は、オプションで--update-config
オプションを含めることができます。 このオプションでは、環境に関する情報が$HOME/.olcne/olcne.conf
のローカル構成ファイルに書き込まれます。この構成は、Platform API Serverへの今後のコールに使用されます。 このオプションを使用する場合、将来のolcnectl
コマンドでPlatform API Serverを指定する必要はありません。
たとえば、--update-config
オプションを使用して環境を作成する場合は、次のようになります。
olcnectl environment create \
--api-server 127.0.0.1:8091 \
--environment-name myenvironment \
--secret-manager-type vault \
--vault-token s.3QKNuRoTqLbjXaGBOmO6Psjh \
--vault-address https://192.0.2.20:8200 \
--update-config
今後のolcnectl
コマンドをすべて記述する場合は、--api-server
オプションを省略できます。 たとえば:
olcnectl module property list \
--environment-name myenvironment \
--name mycluster
また、環境変数を設定してPlatform API Serverを設定することもできます。 これを行うには、オペレータ・ノードで$OLCNE_API_SERVER_BIN
環境変数を使用します。 たとえば、Platform API Serverをlocalhostに設定するには、次を使用します。
export OLCNE_API_SERVER_BIN=127.0.0.1:8091
グローバル・フラグの使用
グローバル・フラグは、すべてのolcnectl
コマンドで使用できます。 これらのオプションは、olcnectl environment create
コマンドを使用して環境を作成するときによく使用されますが、他のすべてのolcnectl
コマンドでも使用できます。 グローバル・オプションは次のとおりです。
[{-a|--api-server} api_server_address:8091]
[--config-file path]
[--secret-manager-type {file|vault}]
[--update-config]
[--olcne-ca-path ca_path]
[--olcne-node-cert-path node_cert_path]
[--olcne-node-node-key-path node_key_path]
[--olcne-tls-cipher-suites ciphers]
[--olcne-tls-max-version version]
[--olcne-tls-min-version version]
[--vault-address vault_address]
[--vault-cert-sans vault_cert_sans]
[--vault-token vault_token]
説明:
-
{-a|--api-server} api_server_address:8091
-
環境のPlatform API Server。 これは、環境内で
olcne-api-server
サービスを実行しているホストです。 api_server_addressの値は、Platform API ServerのIPアドレスまたはホスト名です。 ポート番号は、olcne-api-server
サービスが使用可能なポートです。 デフォルト・ポートは8091
です。Platform API Serverが指定されていない場合、ローカル・インスタンスが使用されます。 ローカル・インスタンスが設定されていない場合は、
$HOME/.olcne/olcne.conf
ファイルで構成されます。Platform API Serverの設定の詳細は、「Platform API Serverの設定」を参照してください。
このオプションは、
$OLCNE_API_SERVER_BIN
環境変数にマップされます。 この環境変数が設定されている場合は、Platform CLIの設定よりも優先され、それをオーバーライドします。 -
--config-file path
-
環境およびモジュールの構成情報を含むYAMLファイルのロケーション。 ファイル名拡張子は、
yaml
またはyml
のいずれかにする必要があります。 このオプションを使用すると、--force
オプションを除くほかのすべてのコマンド行オプションは無視されます。 構成ファイルに含まれている情報のみが使用されます。 -
--secret-manager-type {file|vault}
-
シークレット・マネージャのタイプ。 オプションは、
file
またはvault
です。 ノードに保存されている証明書にはfile
を使用し、Vaultによって管理されている証明書にはvault
を使用します。 -
--update-config
-
環境のグローバル引数がローカル構成ファイルに書き込まれ、それがPlatform API Serverへの今後のコールに使用されます。 このオプションが以前に使用されていなかった場合は、Platform API Serverのコールごとにグローバル引数を指定する必要があります。
グローバル引数の構成情報は、ローカル・ホストの
$HOME/.olcne/olcne.conf
に保存されます。Vaultを使用してノードの証明書を生成すると、証明書はローカル・ホストの
$HOME/.olcne/certificates/environment_name/
に保存されます。 -
--olcne-ca-path ca_path
-
事前定義済の認証局証明書へのパス。または、証明書のダウンロードにシークレット・マネージャを使用する場合は証明書のダウンロード先。 デフォルトは
/etc/olcne/certificates/ca.cert
で、--update-config
オプションが使用されている場合はローカル構成から収集されます。このオプションは、
$OLCNE_SM_CA_PATH
環境変数にマップされます。 この環境変数が設定されている場合は、Platform CLIの設定よりも優先され、それをオーバーライドします。 -
--olcne-node-cert-path node_cert_path
-
事前定義済の証明書へのパス。または、証明書のダウンロードにシークレット・マネージャを使用している場合は証明書のダウンロード先。 デフォルトは
/etc/olcne/certificates/node.cert
で、--update-config
オプションが使用されている場合はローカル構成から収集されます。このオプションは、
$OLCNE_SM_CERT_PATH
環境変数にマップされます。 この環境変数が設定されている場合は、Platform CLIの設定よりも優先され、それをオーバーライドします。 -
--olcne-node-key-path node_key_path
-
事前定義済のキーへのパス。または、キーのダウンロードにシークレット・マネージャを使用する場合はキーのダウンロード先。 デフォルトは
/etc/olcne/certificates/node.key
で、--update-config
オプションが使用されている場合はローカル構成から収集されます。このオプションは、
$OLCNE_SM_KEY_PATH
環境変数にマップされます。 この環境変数が設定されている場合は、Platform CLIの設定よりも優先され、それをオーバーライドします。 -
--olcne-tls-cipher-suites ciphers
-
Oracle Cloud Native Environmentサービス(Platform AgentおよびPlatform API Server)に使用するTLS暗号スイート。 カンマ区切りリストで1つ以上入力します。 オプションは次のとおりです。
-
TLS_AES_128_GCM_SHA256
-
TLS_AES_256_GCM_SHA384
-
TLS_CHACHA20_POLY1305_SHA256
-
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA
-
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256
-
TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
-
TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA
-
TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
-
TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305
-
TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256
-
TLS_ECDHE_ECDSA_WITH_RC4_128_SHA
-
TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA
-
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
-
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
-
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
-
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA
-
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
-
TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305
-
TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256
-
TLS_ECDHE_RSA_WITH_RC4_128_SHA
-
TLS_RSA_WITH_3DES_EDE_CBC_SHA
-
TLS_RSA_WITH_AES_128_CBC_SHA
-
TLS_RSA_WITH_AES_128_CBC_SHA256
-
TLS_RSA_WITH_AES_128_GCM_SHA256
-
TLS_RSA_WITH_AES_256_CBC_SHA
-
TLS_RSA_WITH_AES_256_GCM_SHA384
-
TLS_RSA_WITH_RC4_128_SHA
たとえば:
--olcne-tls-cipher-suites TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
このオプションは、
$OLCNE_TLS_CIPHER_SUITES
環境変数にマップされます。 この環境変数が設定されている場合は、Platform CLIの設定よりも優先され、それをオーバーライドします。 -
-
--olcne-tls-max-version version
-
Oracle Cloud Native EnvironmentコンポーネントのTLS最大バージョン。 デフォルトは
VersionTLS12
です。 オプションは次のとおりです。-
VersionTLS10
-
VersionTLS11
-
VersionTLS12
-
VersionTLS13
このオプションは、
$OLCNE_TLS_MAX_VERSION
環境変数にマップされます。 この環境変数が設定されている場合は、Platform CLIの設定よりも優先され、それをオーバーライドします。 -
-
--olcne-tls-min-version version
-
Oracle Cloud Native EnvironmentコンポーネントのTLS最小バージョン。 デフォルトは
VersionTLS12
です。 オプションは次のとおりです。-
VersionTLS10
-
VersionTLS11
-
VersionTLS12
-
VersionTLS13
このオプションは、
$OLCNE_TLS_MIN_VERSION
環境変数にマップされます。 この環境変数が設定されている場合は、Platform CLIの設定よりも優先され、それをオーバーライドします。 -
-
--vault-address vault_address
-
VaultインスタンスのIPアドレス。 デフォルトは
https://127.0.0.1:8200
ですが、--update-config
オプションを使用するとローカル構成から収集されます。 -
--vault-cert-sans vault_cert_sans
-
Oracle Cloud Native Environment証明書を生成するためにVaultに渡すサブジェクト代替名(SAN)。 デフォルトは
127.0.0.1
ですが、--update-config
オプションを使用するとローカル構成から収集されます。 -
--vault-token vault_token
-
Vault認証トークン。
コマンドライン完了の設定
olcnectl
コマンドのコマンドライン完了を設定できます。 olcnectl completion
コマンドを使用して、シェルのコマンドライン完了スクリプトを生成します。 たとえば、Oracle LinuxでBashシェルのコマンドライン完了スクリプトを生成するには、次を実行します:
olcnectl completion bash
生成されたコマンドライン完了スクリプトは、/etc/bash_completion.d/olcnectl
に保存する必要があります。
次のコマンドを使用して、スクリプトを生成し、正しいロケーションに保存できます:
olcnectl completion bash | sudo tee /etc/bash_completion.d/olcnectl
この設定を有効にするには、新しいシェル・セッションを開始する必要があります。 この設定では、bash-completion
パッケージをシステムにインストールする必要もあります。