8.2.3. インポートの準備
ハブクラスター にログインします。以下のコマンドを実行します。
oc login
ハブクラスターで以下のコマンドを実行して namespace を作成します。注記:
<cluster_name>
で定義したクラスター名は、.yaml
ファイルおよびコマンドでクラスターの namespace としても使用します。oc new-project ${CLUSTER_NAME} oc label namespace ${CLUSTER_NAME} cluster.open-cluster-management.io/managedCluster=${CLUSTER_NAME}
以下の YAML 例のように、ManagedCluster の例を編集します。
apiVersion: cluster.open-cluster-management.io/v1 kind: ManagedCluster metadata: name: <cluster_name> spec: hubAcceptsClient: true
-
ファイルは
managed-cluster.yaml
として保存します。 以下のコマンドを使用して、YAML ファイルを適用します。
oc apply -f managed-cluster.yaml
klusterlet のアドオン設定ファイルを作成します。以下の YAML の例を入力します。
apiVersion: agent.open-cluster-management.io/v1 kind: KlusterletAddonConfig metadata: name: <cluster_name> namespace: <cluster_name> spec: clusterName: <cluster_name> clusterNamespace: <cluster_name> applicationManager: enabled: true certPolicyController: enabled: true clusterLabels: cloud: auto-detect vendor: auto-detect iamPolicyController: enabled: true policyController: enabled: true searchCollector: enabled: true version: 2.0.0
-
ファイルは
klusterlet-addon-config.yaml
として保存します。 YAML を適用します。以下のコマンドを実行します。
oc apply -f klusterlet-addon-config.yaml
ManagedCluster-Import-Controller は ${CLUSTER_NAME}-import
という名前のシークレットを生成します。${CLUSTER_NAME}-import
シークレットには、import.yaml
が含まれており、このファイルをユーザーがマネージドクラスターに適用して klusterlet をインストールします。