5.2. OpenShift Container Platform CLI を使用した namespace の Operator へのサブスクライブ
この手順を使用して、namespace を Operator にサブスクライブします。
手順
Operator にプロジェクトを作成します。
oc new-project ansible-automation-platform
-
sub.yamlという名前のファイルを作成します。 以下の YAML コードを
sub.yamlファイルに追加します。--- apiVersion: v1 kind: Namespace metadata: labels: openshift.io/cluster-monitoring: "true" name: ansible-automation-platform --- apiVersion: operators.coreos.com/v1 kind: OperatorGroup metadata: name: ansible-automation-platform-operator namespace: ansible-automation-platform spec: targetNamespaces: - ansible-automation-platform --- apiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: name: ansible-automation-platform namespace: ansible-automation-platform spec: channel: 'stable-2.4' installPlanApproval: Automatic name: ansible-automation-platform-operator source: redhat-operators sourceNamespace: openshift-marketplace --- apiVersion: automationcontroller.ansible.com/v1beta1 kind: AutomationController metadata: name: example namespace: ansible-automation-platform spec: replicas: 1このファイルは、
ansible-automation-platformnamespace をansible-automation-platform-operatorOperator にサブスクライブするansible-automation-platformというSubscriptionオブジェクトを作成します。次に、
ansible-automation-platform名前空間 にexampleという名前のAutomationControllerオブジェクトを作成します。exampleから Automation Controller 名を変更するには、sub.yamlのkind: AutomationControllerセクションの name フィールドを編集し、<automation_controller_name>を使用する名前に置き換えてください。apiVersion: automationcontroller.ansible.com/v1beta1 kind: AutomationController metadata: name: <automation_controller_name> namespace: ansible-automation-platformoc applyコマンドを実行して、sub.yamlファイルで指定されたオブジェクトを作成します。oc apply -f sub.yaml
namespace が ansible-automation-platform-operator Operator に正常にサブスクライブされたことを確認するには、oc get subs コマンドを実行します。
$ oc get subs -n ansible-automation-platform
namespace を Operator にサブスクライブする方法は、Red Hat OpenShift Container Platform Operators ガイドの CLI を使用した OperatorHub からのインストール を参照してください。
OpenShift Container Platform CLI を使用して、作成した Automation Controller の Web アドレスとパスワードを取得できます。