Kubernetes Operator がCloud Managerまたは Ops Manager プロジェクト内のオブジェクトを作成または更新するには、プログラマティックAPIキーをシークレットストレージツールに保存する必要があります。
複数のシークレットが同じ名前空間に存在できます。 各ユーザーには独自のシークレットが必要です。
以下の手順に従って、プログラマティックAPIキーをKubernetes secret として手動で保存できます。または、次のこともできます。
Store the Programmatic API Key as a Vault secret using the procedure to Create a Vault Secret. To use Vault, you must also configure the secret storage.
前提条件
Kubernetes Operator の認証情報を作成するには、次の手順を実行する必要があります。
Have or create an Ops Manager Organization.
Have or generate a Programmatic API Key.
この新しいプログラマティック API キーを付与します。
The Organization Owner or
Global Ownerrole, if you want the Kubernetes Operator to create projects and manage them.Kubernetes Operator でプロジェクトのみを管理する場合のプロジェクト オーナーのロール。
注意
You must grant the Programmatic API Key the Organization Owner or
Global Ownerrole. If you want to grant the Programmatic API Key only the Project Owner role, you must first create the project and then the Programmatic API Key for the project with the Project Owner role. The Kubernetes Operator can't create projects if the Programmatic API Key has only the Project Owner role.Add the IP or CIDR block of any hosts that serve the Kubernetes Operator to the API Access List.
手順
Kubernetes シークレットを作成するには
新しい Kubernetes シークレットを作成する
目的のMongoDB Ops ManagerプログラマティックAPIキーの公開キーと秘密キーがあることを確認してください。
次の Kubernetes コマンドを呼び出してシークレットを作成します。
kubectl -n <metadata.namespace> \ create secret generic <mycredentials> \ --from-literal="publicKey=<publicKey>" \ --from-literal="privateKey=<privateKey>" -nフラグは、このシークレットが適用される名前空間を制限します。すべてのMongoDB Kubernetesリソースは、シークレット および ConfigMaps と同じ名前空間に存在する必要があります。Kubernetes Operator は、シークレットも ConfigMap も使用しません。注意
このコマンドの非推奨バージョンでは、
publicKeyとprivateKeyではなく、userとpublicApiKeyが指定されます。 Kubernetes Operator は認証にどちらのバージョンも受け入れます。
新しい Kubernetes シークレットを確認する
次の Kubernetes コマンドを呼び出して、シークレットを検証します。
kubectl describe secrets/<mycredentials> -n <metadata.namespace>
このコマンドは、shell 内のシークレットの説明を返します。
Name: <mycredentials> Namespace: <metadata.namespace> Labels: <none> Annotations: <none> Type: Opaque Data ==== privateKey: 31 bytes publicKey: 22 bytes