MongoDBMultiClusterリソースは、マルチ Kubernetes クラスターMongoDBデプロイを定義し、 Kubernetes Operator 用のMongoDB Controls に、クラスター、 MongoDB Ops Manager の配置、status、 、サービス、およびその他のKubernetesリソースを作成または更新するために必要な情報を提供します。
例
次の例は、マルチ Kubernetes クラスター MongoDB 配置のリソース仕様を示しています。
1 # This example provides statefulSet overrides per cluster. 2 3 apiVersion: mongodb.com/v1 4 kind: MongoDBMultiCluster 5 metadata: 6 name: multi-replica-set 7 spec: 8 version: 8.0.0 9 type: ReplicaSet 10 duplicateServiceObjects: false 11 credentials: my-credentials 12 opsManager: 13 configMapRef: 14 name: my-project 15 clusterSpecList: 16 - clusterName: cluster1.example.com 17 members: 2 18 statefulSet: 19 spec: 20 template: 21 spec: 22 containers: 23 # Example of custom sidecar containers. Remove it before using the file in production. 24 - name: sidecar1 25 image: busybox 26 command: [ "sleep" ] 27 args: [ "infinity" ] 28 # Use the following settings to override the default storage size of the "data" Persistent Volume. 29 volumeClaimTemplates: 30 - metadata: 31 name: data 32 spec: 33 resources: 34 requests: 35 storage: 1Gi 36 - clusterName: cluster2.example.com 37 members: 1 38 statefulSet: 39 spec: 40 template: 41 spec: 42 containers: 43 # Example of custom sidecar containers. Remove it before using the file in production. 44 - name: sidecar2 45 image: busybox 46 command: [ "sleep" ] 47 args: [ "infinity" ] 48 volumeClaimTemplates: 49 - metadata: 50 name: data 51 spec: 52 resources: 53 requests: 54 storage: 1Gi 55 - clusterName: cluster3.example.com 56 members: 1 57 statefulSet: 58 spec: 59 template: 60 spec: 61 containers: 62 # Example of custom sidecar containers. Remove it before using the file in production. 63 - name: sidecar3 64 image: busybox 65 command: [ "sleep" ] 66 args: [ "infinity" ] 67 volumeClaimTemplates: 68 - metadata: 69 name: data 70 spec: 71 resources: 72 requests: 73 storage: 1Gi 74 75 ...
必要なMongoDBMultiCluster リソース設定
このセクションでは、 MongoDBMultiClusterリソースに使用する必要がある設定について説明します。
apiVersion型: string
MongoDB Kubernetes リソース スキーマのバージョン。
kind型: string
作成する MongoDB Kubernetes リソースの種類。 これを
MongoDBMultiClusterに設定します。
metadata.name型: string
作成している MongoDB Kubernetes リソースの名前。
リソース名は 44 文字以下にする必要があります。
spec.credentials型: string
Name of the secret you created as Ops Manager API authentication credentials for the Kubernetes Operator to communicate with Ops Manager.
認証情報を保持するMongoDB Ops Manager Kubernetes Secretオブジェクトは、作成するリソースと同じ名前空間に存在する必要があります。
重要
演算子がシークレットへの変更を管理
Kubernetes Operator は、シークレットへの変更を追跡し、
MongoDBリソースの状態を調整します。
spec.type型: string
作成する MongoDB Kubernetes リソースのタイプ。 MongoDB のマルチ Kubernetes クラスター配置で使用される値はReplicaSetのみです。
spec.version型: string
この
MongoDBMultiClusterリソースにインストールされた MongoDB のバージョン。重要
互換性のある MongoDB Server バージョンを選択していることを確認してください。
互換性のあるバージョンは、MongoDB database リソースが使用する基本イメージによって異なります。
任意のMongoDBMultiCluster リソース設定
MongoDBMultiCluster リソースは、次の設定を使用できます。
spec.additionalMongodConfigタイプ: コレクション
MongoDB プロセスを開始するための追加構成オプション。
Kubernetes Operator は、MongoDB Agent を通じて配置する MongoDB バージョンがサポートするすべての構成オプションをサポートしています。ただし、Kubernetes Operator は、次のいずれかのオプションに指定した値を上書きします。
net.portnet.tls.certificateKeyFilenet.tls.clusterFilereplication.replSetNamesecurity.clusterAuthModesharding.clusterRolestorage.dbPathsystemLog.destinationsystemLog.path
Kubernetes Operator が所有する構成オプションの詳細については、「 MongoDB Kubernetes Operator 専用設定 」を参照してください。
使用できる構成オプションについては、 MongoDBドキュメントの「 配置の詳細オプションMongoDB Ops Manager 」を 参照してください。
spec.agentタイプ: コレクション
MongoDB データベース リソースの MongoDB Agent 構成設定。
spec.agent.startupOptionsタイプ: コレクション
MongoDB データベース リソースを起動する MongoDB Agent 設定。
MongoDB Agent 設定はキーと値のペアとして提供する必要があります。 値は文字列である必要があります。 サポートされている MongoDB Agent 設定のリストについては、以下を参照してください。
Cloud Manager プロジェクトのMongoDB Agent 設定。
OperatorMongoDB Agent を使用して配置したMongoDB Ops Manager バージョンの 設定 。Kubernetes
spec.backupタイプ: コレクション
spec.backup.modeのコレクション コンテナ、 これにより、Kubernetes Operator 内の MongoDB リソースの継続的なバックアップが可能になります。
spec.backup.assignmentLabelsタイプ: 配列
バックアップデーモン サービスプロセスの割り当てラベルのリスト。 割り当てラベル を使用して、特定のバックアップデーモン プロセスが特定のプロジェクトに関連付けられていることを識別します。 Kubernetes Operator を使用して割り当てラベルを設定すると、割り当てラベルのKubernetes構成ファイルで設定した値が、 MongoDB Ops Manager UI で定義された値を上書きします。 Kubernetes Operator を使用して設定しない割り当てラベルは、 MongoDB Ops Manager UI で設定された値を引き続き使用します。
spec.backup.autoTerminateOnDeletionタイプ: ブール値
Flag that indicates whether the Kubernetes Operator stops and terminates the backup when you delete a
MongoDBMultiClusterresource. The default value isfalse. Setting this flag totrueis useful when you want to delete theMongoDBMultiClusterresource while the spec.backup.mode setting is set toenabled.
spec.backup.encryption型: オブジェクト
バックアップ暗号化の構成設定を含むオブジェクト。
spec.backup.encryption.kmip型: オブジェクト
KMIPバックアップ暗号化の構成設定を含むオブジェクトです。 詳細については、「 MongoDB Ops Managerの KMIP バックアップ暗号化の構成 」を参照してください。
spec.backup.encryption.kmip.client型: オブジェクト
KMIPバックアップ暗号化クライアントの構成設定を含むオブジェクト。
spec.backup.mode型: string
MongoDBMultiClusterリソースの継続的なバックアップを有効にします。 指定できる値は、enabled、disabled、terminatedです。注意
The spec.backup.mode setting relies on Backup that is enabled in Ops Manager and requires that the
spec.backup.enabledvalue in the Ops Manager resource specification is set totrue.spec.backup.modeを使用して MongoDB リソースの継続的なバックアップを有効にすると、 バックアップ状況を確認できます。
spec.backup.snapshotScheduleタイプ: コレクション
Kubernetes Operator の MongoDB リソースの継続的なバックアップのスナップショット スケジュール設定のコレクション コンテナ。
spec.backup.snapshotSchedule.dailySnapshotRetentionDaysタイプ: 数値
日次スナップショットを保持する日数。
1から365までの値を設定できます。 値を0に設定すると、このルールが無効になります。
spec.backup.snapshotSchedule.fullIncrementalDayOfWeek型: string
MongoDB Ops Managerが完全なスナップショットを取得する曜日。 この設定により、最新の完全なバックアップが保証されます。 MongoDB Ops Manager はデフォルト値を
SUNDAYに設定します。
spec.backup.snapshotSchedule.monthlySnapshotRetentionMonthsタイプ: 数値
月次スナップショットを保持する月数。
1から36までの値を設定できます。 値を0に設定すると、このルールが無効になります。
spec.backup.snapshotSchedule.pointInTimeWindowHoursタイプ: 数値
ポイントインタイム スナップショットを作成できる過去の時間数。
spec.backup.snapshotSchedule.referenceHourOfDayタイプ: 数値
時刻の UTC 時間で、24 時間制でスナップショットをスケジュールする。
0から23までの値を設定できます。
spec.backup.snapshotSchedule.referenceMinuteOfHourタイプ: 数値
UTC minute of the hour to schedule snapshots. You can set a value between
0and59, inclusive.
spec.backup.snapshotSchedule.snapshotIntervalHoursタイプ: 数値
スナップショット間の時間数。
6、8、12、または24の値を設定できます。
spec.backup.snapshotSchedule.snapshotRetentionDaysタイプ: 数値
最近のスナップショットを保持する日数。
2から5までの値を設定できます。
spec.backup.snapshotSchedule.weeklySnapshotRetentionWeeksタイプ: 数値
Number of weeks to keep weekly snapshots.
1から52までの値を設定できます。 値を0に設定すると、このルールが無効になります。
spec.cloudManager.configMapRef.name型: string
spec.clusterSpecListタイプ: コレクション
MongoDBMultiClusterリソース内の各 Kubernetes クラスターの仕様のリスト。
spec.clusterSpecList.clusterName型: string
Name of the cluster where the MongoDB Controllers for Kubernetes Operator schedules the StatefulSet. When the Kubernetes Operator deploys this
MongoDBMultiClusterresource, it creates a service account. This name is what the service account in the operator cluster uses to communicate with the workload clusters.
spec.clusterSpecList.externalAccess.externalDomain型: string
レプリカセットの配置を外部で公開するために使用される外部ドメイン。
By default, each replica set member uses the Kubernetes Pod's FQDN (
*.svc.cluster.local) as the default hostname. However, if you add an external domain to this setting, the replica set uses a hostname that is a subdomain of the specified domain instead. This hostname uses the following format:<replica-set-name>-<cluster-idx>-<pod-idx>.<externalDomain>以下に例を挙げます。
multi-replica-set-0-1.cluster-0.example.comAfter you deploy the replica set with this setting, the Kubernetes Operator uses the hostname with the external domain to override the
processes[n].hostnamefield in the Ops Manager automation configuration. Then, the MongoDB Agent uses this hostname to connect tomongod.レプリカセットに接続するための他のホスト名を指定するには、
spec.connectivity.replicaSetHorizons設定を使用できます。 ただし、次の接続では、外部ドメインを含むホスト名は引き続き使用されます。The MongoDB Agent to connect to
mongod.
WARNING: Specifying this field changes how Ops Manager registers
mongodprocesses. You can't change the value of this field or anyprocesses[n].hostnamefields in the Ops Manager automation configuration for a running replica set deployment.重要
この設定は、マルチ Kubernetes クラスターの MongoDB 配置レプリカセットを サービス キャッシュ なしで配置する場合にのみ使用します。 「サービス メッシュを使用せずにマルチ Kubernetes クラスターにレプリカセットを配置する 」を参照してください。
spec.clusterSpecList.externalAccess.externalServiceタイプ: コレクション
マルチ Kubernetes クラスター MongoDB 配置で特定のクラスターを外部で公開するための構成。 これらの設定は、グローバルspec.externalAccess.externalService 設定。
When you set the spec.externalAccess setting, the Kubernetes Operator automatically creates an external load balancer service with default values. You can override certain values or add new values depending on your needs. For example, if you intend to create NodePort services and don't need a load balancer, you must configure overrides in your Kubernetes specification:
externalAccess: externalService: annotations: # cloud-specific annotations for the service spec: type: NodePort # default is LoadBalancer # you can specify other spec overrides if necessary Kubernetes仕様の詳細については、Kubernetesドキュメントの ServiceSpec を参照してください。
spec.clusterSpecList.externalAccess.externalService.annotationsタイプ: コレクション
キーと値のペア。このペアでは、マルチ Kubernetes クラスターMongoDBデプロイ内の特定のクラスターにクラウドプロバイダー固有の構成設定を追加できます。この設定はグローバル設定(spec.externalAccess.externalService.annotations)を上書きします。詳しくは、 「 Kubernetesクラウドプロバイダー 」の注釈とドキュメントを参照してください。
注釈 を使用して、 Kubernetes Operator 配置で使用される外部サービスのプレースホルダー値を指定できます。Kubernetes Operator は、これらの値を次の表に記載されている正しい値に自動的に置き換えます。プレースホルダーを使用すると、特定のポッドの各サービスに特定の注釈を提供できます。
値説明{resourceName}{namespace}{podIndex}StateftSet によって割り当てられ、現在の外部サービスが対象とする ポッドのインデックス。
{podName}{resourceName}-{clusterIndex}-{podIndex}に等しい。{clusterName}The current cluster name set in spec.clusterSpecList.clusterName.
{clusterIndex}The index initially assigned by the Kubernetes Operator for the current cluster name set in spec.clusterSpecList.clusterName.
This value might not reflect the order of the member clusters defined in spec.clusterSpecList. Although you can change the order of member clusters in spec.clusterSpecList, the Kubernetes Operator still uses the index that it initially assigned for the current cluster name.
{statefulSetName}The StatefulSet. Equal to
{resourceName}-{clusterIndex}.{externalServiceName}指定したプレースホルダー値に基づいて、外部サービスの生成された名前。
{resourceName}-{clusterIndex}-{podIndex}-svc-externalに等しい。{mongodProcessDomain}The domain name of the server that is hosting the mongod process. Equal to spec.externalAccess.externalDomain if specified. Otherwise, equal to the domain used for the
mongodprocess FQDN.たとえば、プロセス ホスト名
mdb-rs-1.example.comの場合、example.comはドメイン名になります。{mongodProcessFQDN}The
mongodprocess hostname set in the automation configuration.The process hostname depends on your deployment configuration. If you've configured your multi-Kubernetes cluster MongoDB deployment to use external domains, such as for a deployment without service mesh, the process hostname uses the following format:
{resourceName}-{clusterIndex}-{podIndex}.{mongodProcessDomain}以下に例を挙げます。
mdb-rs-0-1.example.com配置で外部ドメインを使用しない場合、プロセス ホスト名は次の形式を使用します。
{resourceName}-{clusterIndex}-{podIndex}-svc.{namespace}.svc.cluster.local以下に例を挙げます。
mdb-rs-1-svc.ns.svc.cluster.local注意
表に指定されている既知のプレースホルダー値のみを使用し、プレースホルダーが空または null 値を使用しないようにする必要があります。 それ以外の場合、Kubernetes Operator はエラーを返します。 たとえば、次のエラーメッセージが表示される場合があります。
error replacing placeholders in map with key=external-dns.alpha.kubernetes.io/hostname, value={resourceName}-{podIndex}-{unknownPlaceholder}.{clusterName}-{clusterIndex}.example.com: missing values for the following placeholders: {clusterName}, {clusterIndex}, {unknownPlaceholder}`` 例
次の例えでは、
{resourceName}、{podIndex}、{namespace}プレースホルダーを指定します。apiVersion: mongodb.com/v1 kind: MongoDB metadata: name: mdb-rs namespace: ns spec: replicas: 3 externalAccess: externalService: annotations: external-dns.alpha.kubernetes.io/hostname: {resourceName}-{podIndex}-{namespace}.example.com Kubernetes Operator は、各プレースホルダーの適切な値に基づいて、外部サービスの注釈を自動的に入力します。 例:
mdb-rs-0-svc-external: annotations: external-dns.alpha.kubernetes.io/hostname: mdb-rs-0-ns.example.com mdb-rs-1-svc-external: annotations: external-dns.alpha.kubernetes.io/hostname: mdb-rs-1-ns.example.com mdb-rs-2-svc-external: annotations: external-dns.alpha.kubernetes.io/hostname: mdb-rs-2-ns.example.com
spec.clusterSpecList.externalAccess.externalService.specタイプ: コレクション
ServiceSpec の構成。詳しくは、spec.clusterSpecList.externalAccess.externalService を参照してください。
spec.clusterSpecList.memberConfigタイプ: コレクション
マルチ Kubernetes クラスター MongoDB 配置内の各 MongoDB レプリカセットとそのノードの仕様。
各レプリカセットの オブジェクト内の要素の順序は、レプリカセット内のノードの順序を反映する必要があります。 たとえば、最初の要素はインデックス
0の ポッドに影響し、2 番目の要素はインデックス1に影響するなどします。例
3 つのレプリカ セットを含むマルチ Kubernetes クラスター MongoDB 配置の次の例の仕様を検討してみましょう。
apiVersion: mongodb.com/v1 kind: MongoDBMultiCluster metadata: name: multi-replica-set spec: version: 8.0.0 type: ReplicaSet duplicateServiceObjects: false credentials: my-credentials opsManager: configMapRef: name: my-project clusterSpecList: - clusterName: cluster1.example.com members: 2 memberConfig: - votes: 1 priority: "0.5" tags: tag1: "value1" environment: "prod" - votes: 1 priority: "1.5" tags: tag2: "value2" environment: "prod" - clusterName: cluster2.example.com members: 1 memberConfig: - votes: 1 priority: "0.5" tags: tag1: "value1" environment: "prod" - clusterName: cluster3.example.com members: 1 memberConfig: - votes: 1 priority: "0.5" tags: tag1: "value1" environment: "prod"
spec.clusterSpecList.memberConfig.priority型: string
MongoDBレプリカセットのメンバーがプライマリになる相対的な可能性を示す数値。
レプリカセット メンバーがプライマリになる相対的な可能性を高めるには、
priorityの値を高く指定します。レプリカセット メンバーがプライマリになる相対的な可能性を減らすには、
priorityの値を低く指定します。
たとえば、
memberConfig.priorityが1.5のメンバーは、memberConfig.priorityが0.5のメンバーよりも多く、プライマリになる可能性が高くなります。かつ
memberConfig.priorityが0のノードはプライマリになる資格がありません。 詳しくは、「メンバーの優先順位 」を参照してください。
spec.clusterSpecList.memberConfig.tagsタイプ: map
MongoDB レプリカセットの特定のノードに読み取りおよび書込み (write) 操作を指示するためのレプリカセット タグのマップ。
spec.clusterSpecList.memberConfig.votesタイプ: 数値
Determines whether a MongoDB replica set member can vote in an election. Set to
1to allow the member to vote. Set to0to exclude the member from an election.
spec.clusterSpecList.membersタイプ: 数値
MongoDB レプリカセット内のノードの数。
spec.clusterSpecList.service型: string
デフォルト: <resource_name>+"-service"
ステートフルセット 用に作成または使用するKubernetesサービスの名前。この名前のサービスがすでに存在する場合、 MongoDB Controls for Kubernetes Operator はサービスを削除または再作成しません。この設定により、独自のカスタム サービスを作成し、 Kubernetes Operator でそれらを再利用できます。
spec.clusterSpecList.statefulSet.specタイプ: コレクション
Provides the configuration for the StatefulSet override for each of the cluster's StatefulSets in a multi-Kubernetes cluster MongoDB deployment. To set the global configuration that applies to all clusters in your multi-Kubernetes cluster MongoDB deployment, see spec.statefulSet.spec.
この設定は、マルチ Kubernetes クラスター MongoDB 配置のレプリカセット リソース タイプにのみ適用されます。
spec.connectivity.replicaSetHorizonsタイプ: コレクション
クライアント アプリケーションと MongoDB エージェントに対して異なるDNS設定を提供できます。 Kubernetes Operator は、レプリカセット ノードに スプリット ホライゾンDNSを使用します。 この機能により、Kubernetes クラスター内と Kubernetes 外部からの両方で通信が可能になります。
ホストごとに複数の外部マッピングを追加できます。
注意
この配列内の各値が一意であることを確認してください。
この配列内のエントリの数がspec.clusterSpecList.members. に指定された値と一致していることを確認します。
spec.security.certsSecretPrefixの値の指定 TLSを有効にするには、 に設定します。 このメソッドでスプリットホライズンを使用するには、 TLSプロトコルの サーバー名表示 拡張機能が必要です。
この例では、クライアントは
example-websiteホライゾンを使用してレプリカセットと通信します。15 security: 16 tls: 17 enabled: true 18 connectivity: 19 replicaSetHorizons: 20 - "example-website": "web1.example.com:30907" 21 - "example-website": "web2.example.com:32350" 22 - "example-website": "web3.example.com:31185" 23 ...
spec.duplicateServiceObjectsタイプ: ブール値
デフォルト: true
Specifies whether the Kubernetes Operator duplicates a Pod's service mesh object in each cluster to allow DNS resolution. Set to
falseif you configure a DNS proxy for your service mesh. For example, see DNS Proxying in the Istio documentation.
spec.externalAccessタイプ: コレクション
マルチ Kubernetes クラスター MongoDB 配置を外部接続用に公開するための仕様。 Kubernetes クラスターの外部からマルチ Kubernetes クラスター MongoDB 配置に接続する方法については、「 Kubernetes 外部からマルチクラスター リソースに接続する 」を参照してください。
これらの設定は、すべてのクラスターのサービスに適用されます。特定のクラスターでこれらのグローバル設定をオーバーライドするには、spec.clusterSpecList.externalAccess.externalService を使用します。
spec.externalAccessを追加すると、Kubernetes Operator はレプリカセット内の各ポッドの外部サービスを作成します。 外部サービスは、クラスター内の各 MongoDB database ポッドの外部エントリ ポイントを提供します。 各外部サービスには セレクター があります は、外部サービスを特定のポッドに一致させます。値なしでこの設定を追加すると、Kubernetes Operator は次のデフォルト値を持つ外部サービスを作成します。
フィールド値説明Name<pod-name>-svc-external外部サービスの名前。 この値は変更できません。
TypeLoadBalancer外部 LoadBalancer を作成します service
Port<Port Number>A port for
mongod.publishNotReadyAddresstrueSpecifies that DNS records are created even if the Pod isn't ready. Do not set to
falsefor any database Pod.注意
If you set spec.clusterSpecList.externalAccess.externalDomain, the external service adds another port (
Port Number + 1) for backups.
spec.externalAccess.externalServiceタイプ: コレクション
spec.externalAccessのデフォルト値を上書きするための指定。When you set the spec.externalAccess setting, the Kubernetes Operator automatically creates an external load balancer service with default values. You can override certain values or add new values depending on your needs. For example, if you intend to create NodePort services and don't need a load balancer, you must configure overrides in your Kubernetes specification:
externalAccess: externalService: annotations: # cloud-specific annotations for the service spec: type: NodePort # default is LoadBalancer # you can specify other spec overrides if necessary Kubernetes仕様の詳細については、Kubernetesドキュメントの ServiceSpec を参照してください。
spec.externalAccess.externalService.annotationsタイプ: コレクション
クラウドプロバイダーに固有の構成設定を、 マルチ Kubernetes クラスターMongoDBデプロイ内のすべてのクラスターに追加できるキーと値のペア。クラスター固有のオーバーライドについては、spec.clusterSpecList.externalAccess.externalService.annotations を参照してください。詳細については、 「 Kubernetes配置に使用するクラウドプロバイダーの注釈 」と「 ドキュメント 」を参照してください。
注釈 を使用して、 Kubernetes Operator 配置で使用される外部サービスのプレースホルダー値を指定できます。Kubernetes Operator は、これらの値を次の表に記載されている正しい値に自動的に置き換えます。プレースホルダーを使用すると、特定のポッドの各サービスに特定の注釈を提供できます。
値説明{resourceName}{namespace}{podIndex}StateftSet によって割り当てられ、現在の外部サービスが対象とする ポッドのインデックス。
{podName}{resourceName}-{clusterIndex}-{podIndex}に等しい。{clusterName}The current cluster name set in spec.clusterSpecList.clusterName.
{clusterIndex}The index initially assigned by the Kubernetes Operator for the current cluster name set in spec.clusterSpecList.clusterName.
This value might not reflect the order of the member clusters defined in spec.clusterSpecList. Although you can change the order of member clusters in spec.clusterSpecList, the Kubernetes Operator still uses the index that it initially assigned for the current cluster name.
{statefulSetName}The StatefulSet. Equal to
{resourceName}-{clusterIndex}.{externalServiceName}指定したプレースホルダー値に基づいて、外部サービスの生成された名前。
{resourceName}-{clusterIndex}-{podIndex}-svc-externalに等しい。{mongodProcessDomain}The domain name of the server that is hosting the mongod process. Equal to spec.externalAccess.externalDomain if specified. Otherwise, equal to the domain used for the
mongodprocess FQDN.たとえば、プロセス ホスト名
mdb-rs-1.example.comの場合、example.comはドメイン名になります。{mongodProcessFQDN}The
mongodprocess hostname set in the automation configuration.The process hostname depends on your deployment configuration. If you've configured your multi-Kubernetes cluster MongoDB deployment to use external domains, such as for a deployment without service mesh, the process hostname uses the following format:
{resourceName}-{clusterIndex}-{podIndex}.{mongodProcessDomain}以下に例を挙げます。
mdb-rs-0-1.example.com配置で外部ドメインを使用しない場合、プロセス ホスト名は次の形式を使用します。
{resourceName}-{clusterIndex}-{podIndex}-svc.{namespace}.svc.cluster.local以下に例を挙げます。
mdb-rs-1-svc.ns.svc.cluster.local注意
表に指定されている既知のプレースホルダー値のみを使用し、プレースホルダーが空または null 値を使用しないようにする必要があります。 それ以外の場合、Kubernetes Operator はエラーを返します。 たとえば、次のエラーメッセージが表示される場合があります。
error replacing placeholders in map with key=external-dns.alpha.kubernetes.io/hostname, value={resourceName}-{podIndex}-{unknownPlaceholder}.{clusterName}-{clusterIndex}.example.com: missing values for the following placeholders: {clusterName}, {clusterIndex}, {unknownPlaceholder}`` 例
次の例えでは、
{resourceName}、{podIndex}、{namespace}プレースホルダーを指定します。apiVersion: mongodb.com/v1 kind: MongoDB metadata: name: mdb-rs namespace: ns spec: replicas: 3 externalAccess: externalService: annotations: external-dns.alpha.kubernetes.io/hostname: {resourceName}-{podIndex}-{namespace}.example.com Kubernetes Operator は、各プレースホルダーの適切な値に基づいて、外部サービスの注釈を自動的に入力します。 例:
mdb-rs-0-svc-external: annotations: external-dns.alpha.kubernetes.io/hostname: mdb-rs-0-ns.example.com mdb-rs-1-svc-external: annotations: external-dns.alpha.kubernetes.io/hostname: mdb-rs-1-ns.example.com mdb-rs-2-svc-external: annotations: external-dns.alpha.kubernetes.io/hostname: mdb-rs-2-ns.example.com
spec.externalAccess.externalService.specタイプ: コレクション
ServiceSpec の構成。詳しくは、spec.externalAccess.externalService を参照してください。
spec.featureCompatibilityVersionタイプ: 数値
Limits changes to data that occur with an upgrade to a new major version. This allows you to downgrade to the previous major version. To learn more about feature compatibility, see
setFeatureCompatibilityVersionin the MongoDB Manual.
spec.logLevel型: string
ポッド内でのオートメーションエージェントのログ記録のレベルを構成します。受け入れ可能な値は以下の通りです。
DEBUGINFOWARNERRORFATAL
spec.opsManager.configMapRef.name型: string
Cloud ManagerまたはMongoDB Ops Manager接続構成を含む ConfigMap の名前。spec.cloudManager.configMapRef.name 設定はこの設定のエイリアスであり、その代わりに使用できます。
この値は、作成するリソースと同じ名前空間に存在する必要があります。
重要
演算子が ConfigMap への変更を管理
Kubernetes 演算子は、ConfigMap への変更を追跡し、
MongoDBリソースの状態を調整します。
spec.persistentタイプ: ブール値
デフォルト: true
WARNING: Grant your containers permission to write to your Persistent Volume. The Kubernetes Operator sets
fsGroup = 2000,runAsUser = 2000, andrunAsNonRoot = trueinsecurityContext. Kubernetes Operator setsfsgroupequal torunAsUserto make the volume writable for a user that runs the main process in the container. To learn more, see Configure a Security Context for a Pod or Container and the related discussion in the Kubernetes documentation. If redeploying the resource doesn't fix issues with your Persistent Volume, contact MongoDB Support.If you do not use Persistent Volumes, the Disk Usage and Disk IOPS charts cannot be displayed in either the Processes tab on the Deployment page or in the Metrics page when reviewing the data for this deployment.
spec.security.authenticationタイプ: コレクション
マルチ Kubernetes クラスター MongoDB 配置の認証仕様。
spec.security.authentication.agentsタイプ: コレクション
MongoDB AgentCloud ManagerまたはMongoDB Ops Manager プロジェクトの 認証構成。
spec.security.authentication.agents.automationLdapGroupDN型: string
MongoDB Agent ユーザーが属する LDAP グループの DN(Distinguished Name、識別名)。
この設定は、次の場合に必要です。
spec.security.authentication.agents.mode is
LDAPorX509.
spec.security.authentication.agents.automationPasswordSecretRefタイプ: コレクション
spec.security のパスワードを含むシークレットの詳細。 認証. Agents.AutomationUserNameユーザー。
This setting is required if spec.security.authentication.agents.mode is
LDAP.
spec.security.authentication.agents.automationPasswordSecretRef.key型: string
spec.security.authentication.agents.automationPasswordSecretRef.name シークレット 仕様.security.authentication.agents.automationUserName にユーザーのパスワードが含まれるドキュメント
This setting is required if spec.security.authentication.agents.mode is
LDAP.
spec.security.authentication.agents.automationPasswordSecretRef.name型: string
シークレット の名前 仕様.security.authentication.agents.automationUserName のパスワードを含むユーザー。 このシークレットは、Kubernetes Operator を配置するのと同じ名前空間に作成する必要があります。
kubectl create secret generic ldap-agent-user \ --from-literal="password=<password>" -n <metadata.namespace> このシークレットには 1 つのキーが含まれている必要があり、その値はspec.security.authentication.agents.automationUserNameのパスワードと一致します。 LDAP 配置のユーザー。
This setting is required if spec.security.authentication.agents.mode is
LDAP.
spec.security.authentication.agents.automationPasswordSecretRef.optionalタイプ: ブール値
これらのオプションが必須か任意かを指定します。
spec.security.authentication.agents.automationUserName型: string
MongoDB エージェントがマルチ Kubernetes クラスター MongoDB 配置を操作するために使用するユーザーの名前。 ユーザー名は、 spec.security.authentication.ldap.userToDNMappingに従って、LDAP Distinguished Name(DN)にマップされます。 結果の DN は LDAP 配置にすでに存在している必要があります。
This setting is required if spec.security.authentication.agents.mode is
LDAP.
spec.security.authentication.agents.clientCertificateSecretRef.name型: string
デフォルト: Agent-certs
シークレット を指定します MongoDB Agent の TLS 証明書が含まれる。
このシークレットには
mms-automation-agent-pemキーが含まれている必要があります。このキーの値は、サーバーによって検証できる TLS 証明書である必要があります。このシークレットは、Kubernetes Operator を配置するのと同じ名前空間に作成する必要があります。
kubectl create secret generic agent-certs \ --from-file=mms-automation-agent-pem=<automation-cert.pem> \ --namespace=<metadata.namespace>
spec.security.authentication.enabledタイプ: ブール値
デフォルト: false
Cloud ManagerまたはMongoDB Ops Managerプロジェクトで認証が有効になっているかどうかを指定します。
trueに設定されている場合は、 spec.security.authentication.mode で認証メカニズムを設定する必要があります。重要
この設定を含めると、
falseに設定されている場合でも、Kubernetes Operator はこの MongoDB リソースの認証を管理します。 この設定がリソース仕様に存在している間は、 Cloud ManagerまたはMongoDB Ops Managerユーザーインターフェースまたは API を使用してこのリソースの認証を構成することはできません。Cloud ManagerまたはMongoDB Ops Managerユーザーインターフェースまたは API を使用して認証を管理する場合は、この設定を省略します。
spec.security.authentication.agents.mode型: string
The authentication mechanism that the MongoDB Agents for your multi-Kubernetes cluster MongoDB deployment use. Valid values are
SCRAM,SCRAM-SHA-1,MONGODB-CR,X509, andLDAP. The value you specify must also be present in spec.security.authentication.modes. We recommendSCRAM-SHA-256 (SCRAM)overSCRAM-SHA-1. If you specifySCRAM-SHA-1, you must also specifyMONGODB-CR.この設定は、spec.security に複数の値を指定した場合に必要です。認証. モード
spec.security.authentication.ignoreUnknownUsersタイプ: ブール値
デフォルト: false
Kubernetes Operator、またはCloud ManagerまたはMongoDB Ops Managerユーザー インターフェイスを通じて構成されていないデータベースユーザーを変更できるかどうかを決定します。
To manage database users directly through the
mongodormongos, set totrue.
spec.security.authentication.internalCluster型: string
X.509 内部クラスター認証を有効にするかどうかを指定します。
X.509 内部クラスター認証を有効にするには、 を
"X509"に設定します。 次の設定を指定する必要があります。spec.security.authentication.mode
: ["X509"]
Kubernetes 演算子は次の値を受け入れます。
["X509"]: X.509 内部クラスター認証が有効になっています。""または省略: 内部クラスター認証が有効になっていません。
重要
内部クラスター認証を有効にした後で、無効にすることはできません。
spec.security.authentication.ldapタイプ: コレクション
LDAP 認証に必要です。
Configures LDAP authentication for the Cloud Manager or Ops Manager project. To enable LDAP authentication, set spec.security.authentication.modes to
["LDAP"].
spec.security.authentication.ldap.authzQueryTemplate型: string
LDAP 認可に必要です。
ユーザーが属する LDAP グループを取得するためにMongoDBによって実行される RFC4515 および
spec.security.authentication.ldap.serversRFC4516 LDAP 形式のクエリURLテンプレート。クエリは、 で指定されたホストに対して相対的です。テンプレートでは、次のトークンを使用できます。{USER}- Substitutes the authenticated username, or the
transformedusername, into the LDAP query.
{PROVIDED_USER}- 認証または LDAP 変換の前に、指定されたユーザー名を LDAP クエリに置き換えます。 ( MongoDB バージョン 4.2 以降で利用可能)。
詳細については、MongoDB マニュアルの「 LDAP クエリ テンプレート」を参照してください。
spec.security.authentication.ldap.bindQueryPasswordSecretRefタイプ: コレクション
LDAP 認証に必要です。
Specifies the secret that contains the password with which MongoDB binds when connecting to the LDAP server.
spec.security.authentication.ldap.bindQueryPasswordSecretRef.name型: string
LDAP 認証に必要です。
シークレット の名前 は、 LDAP サーバーに接続するときに MongoDB がバインドするパスワードを含みます。
The secret must contain only one
passwordfield which stores the password.
spec.security.authentication.ldap.bindQueryUser型: string
LDAP 認証に必要です。
LDAP Distinguished Name to which MongoDB binds when connecting to the LDAP server.
spec.security.authentication.ldap.caConfigMapRefタイプ: コレクション
TLS による LDAP 認証に必要です。
ConfigMap は、 LDAP サーバーの TLS 証明書を検証する CA を含みます。
spec.security.authentication.ldap.caConfigMapRef.key型: string
TLS による LDAP 認証に必要です。
LDAP サーバーの TLS 証明書を検証する CA を保存するフィールド名。
spec.security.authentication.ldap.caConfigMapRef.name型: string
TLS による LDAP 認証に必要です。
ConfigMap の名前 は、 LDAP サーバーの TLS 証明書を検証する CA を含みます。
spec.security.authentication.ldap.caConfigMapRef.optionalタイプ: ブール値
これらのオプションが必須か任意かを指定します。
spec.security.authentication.ldap.serversタイプ: 文字列の配列
LDAP 認証に必要です。
LDAPサーバーのホスト名とポートのリスト。 次の形式で、それぞれのポートを持つホスト名を指定します。
spec: security: authentication: ldap: servers: - "<hostname1>:<port1>" - "<hostname2>:<port2>"
spec.security.authentication.ldap.timeoutMSタイプ: 整数
認証リクエストがタイムアウトするまでの待機時間をミリ秒単位で指定します。
spec.security.authentication.ldap.transportSecurity型: string
LDAP 認証に必要です。
LDAPサーバーがTLSを受け入れるかどうかを指定します。
If the LDAP server accepts TLS, set the value to
tls. If the LDAP server doesn't accept TLS, leave this value blank or set the value tonone.注意
noneまたはtls以外の string を指定した場合でも、Kubernetes Operator は 設定をtlsに設定します。
spec.security.authentication.ldap.userCacheInvalidationIntervalタイプ: 整数
Specifies how many seconds MongoDB waits to flush the LDAP user cache. Defaults to 30 seconds.
spec.security.authentication.ldap.userToDNMapping型: string
Maps the username provided to
mongodormongosfor authentication to an LDAP Distinguished Name (DN).詳細については、MongoDB マニュアルのsecurity.ldap.userToDNMappingを参照してください。
spec.security.authentication.modesタイプ: 配列
MongoDB 配置で使用する認証メカニズムを指定します。 有効な値は、
SCRAM、SCRAM-SHA-1、MONGODB-CR、X509、LDAPです。 We recommendSCRAM-SHA-256 (SCRAM)overSCRAM-SHA-1.SCRAM-SHA-1を指定する場合は、MONGODB-CRも指定する必要があります。注意
Cloud Managerまたは Ops Managerプロジェクトで X. 内部クラスター認証を有効にするには、この値を509
["X509"]に設定し、次の設定を指定します。spec.security.certsSecretPrefixの値を指定する 設定。
spec.security.authentication.modesに複数の値を指定する場合は、 spec.security.authentication.agents.mode の値も指定する必要があります。
spec.security.authentication.requireClientTLSAuthenticationタイプ: ブール値
デフォルト: false
Specifies whether the MongoDB host requires clients to connect using a TLS certificate. Defaults to
trueif you enable TLS authentication.TLS認証を有効にするには、 spec.security.certsSecretPrefixの値を指定します 設定。
spec.security.certsSecretPrefix型: string
Kubernetes シークレット のプレフィックスへのテキスト 作成した、レプリカセットの TLS キーと証明書を含む。
シークレットの前に
<prefix>-<metadata.name>を付ける必要があります。For example, if you call your deployment
my-deploymentand you set the prefix tomdb, you must name the TLS secret for the client TLS communicationsmdb-my-deployment-cert. Also, you must name the TLS secret for internal cluster authentication (if enabled)mdb-my-deployment-clusterfile.TLS証明書を含むシークレットの名前付けの詳細については、配置に適用されるマルチ Kubernetes-クラスター クイック スタートのトピックを参照してください。
spec.security.rolesタイプ: 配列
マルチ Kubernetes クラスター MongoDB 配置に対するきめ細かなアクセス制御を提供するユーザー定義のロールを定義する配列。
To enable user-defined roles, the spec.security.authentication.enabled must be
true.例
上記の例では、
customRoleという名前のユーザー定義ロールにより、このロールを割り当てられたユーザーには次の操作を許可します。petsデータベースのcatsコレクションにドキュメントを挿入し、petsデータベース内のdogsコレクションにドキュメントを検索して挿入します。
1 security: 2 authentication: 3 enabled: true 4 modes: 5 - "SCRAM" 6 roles: 7 - role: "customRole" 8 db: admin 9 privileges: 10 - actions: 11 - insert 12 resource: 13 collection: cats 14 db: pets 15 - actions: 16 - insert 17 - find 18 resource: 19 collection: dogs 20 db: pets 21 ...
spec.security.roles.authenticationRestrictionsタイプ: 配列
このspec.security.roles.roleを割り当てられたユーザーが接続できる IP アドレスと IP アドレスを定義する配列。
spec.security.roles.authenticationRestrictions.clientSourceタイプ: 配列
このspec.security.roles.roleを割り当てられたユーザーが接続できる IP アドレスまたは CIDR ブロックの配列。
MongoDB サーバーは、リクエストがこの配列に存在しないクライアントからの接続リクエストである場合、このロールを持つユーザーからの接続リクエストを拒否します。
spec.security.roles.authenticationRestrictions.serverAddressタイプ: 配列
このspec.security.roles.roleを割り当てられたユーザーが接続できる IP アドレスまたは CIDR ブロックの配列。
MongoDB サーバーは、クライアントがこの配列に存在しないサーバーへの接続をリクエストした場合、このロールを持つユーザーからの接続リクエストを拒否します。
spec.security.roles.db型: string
ユーザー定義ロールを保存するデータベース。
例
admin
spec.security.roles.privilegesタイプ: 配列
このロールに付与されたユーザーが持つ特権を記述する配列。
spec.security.roles.privileges.actionsタイプ: 配列
このロールを付与されたユーザーが実行できるアクションのリスト。 許容値のリストについては、Kubernetes Operator で配置する MongoDB バージョンの MongoDB マニュアルの「特権アクション」を参照してください。
spec.security.roles.privileges.resourceタイプ: コレクション
特権が適用されるリソースは、 .security.roles.privateges.actionsです。
このコレクションには、次のいずれかを含める必要があります。
The spec.security.roles.privileges.resource.cluster setting with a value of
true.
spec.security.roles.privileges.resource.clusterタイプ: ブール値
デフォルト: false
特権がMongoDB配置内のすべてのデータベースとコレクションに適用されることを示すフラグ。
true に設定されている場合、 spec.security.roles.rivileges.resource.dbおよびspec.security.roles.rivileges.resource.collection の値を指定しません。
spec.security.roles.privileges.resource.collection型: string
特権 spec.security.roles.privateles.actions が適用される spec.security.roles.privateges.resource.db 内のコレクション。
この設定に値を指定する場合は、spec.security.roles.privates の値も指定する必要があります。リソース.db
spec.security.roles.privileges.resource.db型: string
特権spec.security.roles.privates.actionsが適用されるデータベース。
この設定に値を指定する場合は、 spec.security.roles.privateges.resource.collection にも値を指定する必要があります。
spec.security.roles.role型: string
ユーザー定義ロールの名前。
spec.security.tls.additionalCertificateDomainsタイプ: コレクション
List of every domain that should be added to TLS certificates to each Pod in this deployment. When you set this parameter, every CSR that the Kubernetes Operator transforms into a TLS certificate includes a SAN in the form
<pod name>.<additional cert domain>.レプリカセット リソースには、このパラメーターは必要ありません。 spec.connector.replicaSetHorizons の使用 ください。
注意
If you add this parameter to a TLS-enabled resource, Kubernetes displays an error when the resource reaches the
Pendingstate. This error displays:Please manually remove the |csr| in order to proceed.To remedy this issue:Kubernetes が新しい CSR を生成できるように、既存の CSR を削除します。リソースを削除する方法については、 リソースの 削除 を参照してください。 (Kubernetes ドキュメント)。
Kubernetes が CSR を生成した後に、 CSRを承認します。
spec.security.tls.ca型: string
ConfigMap の名前を指定する は CA を保存します。
重要
If you use a custom CA to sign your TLS certificates for the
MongoDBMultiClusterresource, you must specify this parameter.Kubernetes Operator では、ConfigMap で
MongoDBMultiClusterリソースca-pemの証明書に名前を付ける必要があります。
spec.security.tls.enabledタイプ: ブール値
重要
spec.security.tls.enabledは非推奨であり、今後のKubernetes Operator リリースで削除される予定です。TLS を有効にするには、spec.security.certsSecretPrefix の値を指定します設定。TLS 証明書を使用して以下の間の通信を暗号化します。
レプリカセットまたはシャーディングされたクラスター構成内の MongoDB ホスト
Clients (
mongoshell, drivers, MongoDB Compass, and others) and the MongoDB deployment
spec.statefulSet.specタイプ: コレクション
MongoDB Controls for Kubernetes Operator が マルチ Kubernetes クラスターMongoDBデプロイ用に作成する Atlas Triggers のグローバル仕様。
spec.statefulSet.specに追加できるフィールドを確認するには、 Kubernetesドキュメントの「 StateftSetSpec v1 アプリ 」を参照してください。