1.5.2. CLI からの Red Hat Advanced Cluster Management for Kubernetes のインストール
Operator 要件を満たしたハブクラスター namespace を作成します。
oc create namespace <namespace>
namespace はお使いのハブクラスター namespace 名に置き換えます。注記:: namespace の値は、OpenShift Container Platform 環境では プロジェクト と呼ばれる場合があります。
重要: Red Hat Advanced Cluster Management Operator は、独自の namespace にインストールする必要があります。
ServiceAccount
にClusterRoleBinding
が指定されている場合には自動的に、この namespace にアクセス権限のある ID すべてと、Red Hat Advanced Cluster Management に、クラスター管理者権限を割り当てます。この namespace へのアクセス権限が付与されたユーザーには、セキュリティーを確保するため、クラスター管理者権限があることを確認してください。プロジェクトの namespace を、作成した namespace に切り替えます。
oc project <namespace>
namespace は、手順 1 で作成したハブクラスター namespace 名に置き換えます。
OpenShift Container Platform または Red Hat Advanced Cluster Management で作成されていない Kubernetes クラスターをインポートする予定の場合には、OpenShift Container Platform プルシークレットの情報を含むシークレットを生成して、ディストリビューションレジストリーから資格のあるコンテンツにアクセスしますOpenShift Container Platform クラスターのシークレット要件は、OpenShift Container Platform および Red Hat Advanced Cluster Management により自動で解決されるので、他のタイプの Kubernetes クラスターをインポートして管理しない場合には、このシークレットを作成する必要はありません。重要: これらのシークレットは、namespace ごとに異なるので、手順 1 で作成した namespace で操作を行うようにしてください。
- cloud.redhat.com/openshift/install/pull-secret から Download pull secret を選択して、OpenShift Container Platform のプルシークレットファイルをダウンロードします。OpenShift Container Platform プルシークレットは Red Hat カスタマーポータル ID に関連しており、すべての Kubernetes プロバイダーで同じです。
以下のコマンドを実行してシークレットを作成します。
oc create secret generic <secret> -n <namespace> --from-file=.dockerconfigjson=<path-to-pull-secret> --type=kubernetes.io/dockerconfigjson
secret は作成するシークレット名に置き換えます。namespace はプロジェクトの namespace に置き換えます。path-to-pull-secret はダウンロードする OpenShift Container Platform のプルシークレットへのパスに置き換えます。
Operator グループを作成します。namespace ごとに割り当てることのできる Operator グループ は 1 つだけです。
Operator グループを定義する
.yaml
ファイルを作成します。ファイルは以下の例のようになります。apiVersion: operators.coreos.com/v1 kind: OperatorGroup metadata: name: <default> spec: targetNamespaces: - <namespace>
default はお使いの operator グループ名に置き換えます。namespace はお使いのプロジェクトの namespace に置き換えます。
作成したファイルを適用して Operator グループを定義します。
oc apply -f local/<operator-group>.yaml
operator-group は、作成した operator グループの
.yaml
ファイル名に置き換えます。
サブスクリプションを適用します。
サブスクリプションを定義する
.yaml
ファイルを作成します。ファイルは以下の例のようになります。apiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: name: acm-operator-subscription spec: sourceNamespace: openshift-marketplace source: redhat-operators channel: release-2.0 installPlanApproval: Automatic name: advanced-cluster-management
サブスクリプションを適用します。
oc apply -f local/<subscription>.yaml
subscription は、作成したサブスクリプションファイルの名前に置き換えます。
カスタムリソースを定義する
.yaml
ファイルを作成して MultiClusterHub カスタムリソースを作成します。ファイルは以下の例のようになります。apiVersion: operator.open-cluster-management.io/v1 kind: MultiClusterHub metadata: name: multiclusterhub namespace: <namespace> spec: imagePullSecret: <secret>
namespace はプロジェクトの namespace に置き換えます。secret は作成したシークレット名に置き換えます。
以下のエラーで、この手順に失敗した場合でも、リソースは作成され、適用されます。
error: unable to recognize "./mch.yaml": no matches for kind "MultiClusterHub" in version "operator.open-cluster-management.io/v1"
リソースが作成されてから数分後にもう一度コマンドを実行します。
10 分程度経ってからルートの一覧を表示して、ルートを探し出します。
oc get routes
Red Hat Advanced Cluster Management を再インストールして、Pod が起動しない場合には、この問題の回避手順について 再インストールに失敗する場合のトラブルシューティング を参照してください。