8.2.4. クラスターのインポート
以下のいずれかの手順を実行してクラスターをインポートします。
自動インポートを使用するには、インポートするクラスターの kubeconfig またはサーバーおよびトークンのペアのいずれかを含むシークレットを作成する必要があります。
以下のテンプレートのような内容を含む YAML ファイルを作成します。
apiVersion: v1 kind: Secret metadata: name: auto-import-secret namespace: <cluster_name> stringData: autoImportRetry: 5 # If you are using the kubeconfig file, add the following value for the kubeconfig file # that has the current context set to the cluster to import: kubeconfig: |- <kubeconfig_file> # If you are using the token/server pair, add the following two values: token: <Token to access the cluster> server: <cluster_api_url> type: Opaque
apiVersion: v1 kind: Secret metadata: name: auto-import-secret namespace: <cluster_name> stringData: autoImportRetry: 5 # If you are using the kubeconfig file, add the following value for the kubeconfig file # that has the current context set to the cluster to import: kubeconfig: |- <kubeconfig_file> # If you are using the token/server pair, add the following two values: token: <Token to access the cluster> server: <cluster_api_url> type: Opaque
Copy to Clipboard Copied! -
ファイルを
auto-import-secret.yaml
として保存します。 以下のコマンドを使用して、YAML ファイルを適用します。
oc apply -f auto-import-secret.yaml
oc apply -f auto-import-secret.yaml
Copy to Clipboard Copied!
手動によるインポートプロセスを使用するには、以下の手順を行います。
以下の YAML 例のように、ManagedCluster の例を編集します。
apiVersion: cluster.open-cluster-management.io/v1 kind: ManagedCluster metadata: name: <cluster_name> labels: cloud: auto-detect vendor: auto-detect spec: hubAcceptsClient: true
apiVersion: cluster.open-cluster-management.io/v1 kind: ManagedCluster metadata: name: <cluster_name> labels: cloud: auto-detect vendor: auto-detect spec: hubAcceptsClient: true
Copy to Clipboard Copied! cloud
およびvendor
の値をauto-detect
する場合、Red Hat Advanced Cluster Management はインポートしているクラスターからクラウドおよびベンダータイプを自動的に検出します。オプションで、auto-detect
の値をクラスターのクラウドおよびベンダーの値に置き換えることができます。以下の例を参照してください。cloud: Amazon vendor: OpenShift
cloud: Amazon vendor: OpenShift
Copy to Clipboard Copied! -
ファイルは
managed-cluster.yaml
として保存します。 以下のコマンドを使用して、YAML ファイルを適用します。
oc apply -f managed-cluster.yaml
oc apply -f managed-cluster.yaml
Copy to Clipboard Copied!
klusterlet のインポート を進めます。