AI エージェント向け: ドキュメントインデックスは https://www.mongodb.com/ja-jp/docs/llms.txt で利用できます。すべてのページの markdown バージョンは、いずれかの URL パスに .md を追加することで利用できます。
Docs Menu

マルチKubernetes-クラスター リソース仕様

MongoDBMultiClusterリソースは、マルチ Kubernetes クラスターMongoDBデプロイを定義し、 Kubernetes Operator 用のMongoDB Controls に、クラスター、 MongoDB Ops Manager の配置、status、 、サービス、およびその他のKubernetesリソースを作成または更新するために必要な情報を提供します。

次の例は、マルチ Kubernetes クラスター MongoDB 配置のリソース仕様を示しています。

1# This example provides statefulSet overrides per cluster.
2
3apiVersion: mongodb.com/v1
4kind: MongoDBMultiCluster
5metadata:
6 name: multi-replica-set
7spec:
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リソースに使用する必要がある設定について説明します。

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 リソースは、次の設定を使用できます。

spec.additionalMongodConfig

タイプ: コレクション

MongoDB プロセスを開始するための追加構成オプション

Kubernetes Operator は、MongoDB Agent を通じて配置する MongoDB バージョンがサポートするすべての構成オプションをサポートしています。ただし、Kubernetes Operator は、次のいずれかのオプションに指定した値を上書きします。

  • net.port

  • net.tls.certificateKeyFile

  • net.tls.clusterFile

  • replication.replSetName

  • security.clusterAuthMode

  • sharding.clusterRole

  • storage.dbPath

  • systemLog.destination

  • systemLog.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 設定のリストについては、以下を参照してください。

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 MongoDBMultiCluster resource. The default value is false. Setting this flag to true is useful when you want to delete the MongoDBMultiCluster resource while the spec.backup.mode setting is set to enabled.

spec.backup.encryption

: オブジェクト

バックアップ暗号化の構成設定を含むオブジェクト。

spec.backup.encryption.kmip

: オブジェクト

KMIPバックアップ暗号化の構成設定を含むオブジェクトです。 詳細については、「 MongoDB Ops Managerの KMIP バックアップ暗号化の構成 」を参照してください。

spec.backup.encryption.kmip.client

: オブジェクト

KMIPバックアップ暗号化クライアントの構成設定を含むオブジェクト。

spec.backup.mode

: string

MongoDBMultiClusterリソースの継続的なバックアップを有効にします。 指定できる値は、 enableddisabledterminatedです。

注意

The spec.backup.mode setting relies on Backup that is enabled in Ops Manager and requires that the spec.backup.enabled value in the Ops Manager resource specification is set to true.

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 0 and 59, inclusive.

spec.backup.snapshotSchedule.snapshotIntervalHours

タイプ: 数値

スナップショット間の時間数。 6812 、または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.opsManager.configMapRef.name のエイリアス。

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 MongoDBMultiCluster resource, 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.com

After you deploy the replica set with this setting, the Kubernetes Operator uses the hostname with the external domain to override the processes[n].hostname field in the Ops Manager automation configuration. Then, the MongoDB Agent uses this hostname to connect to mongod.

レプリカセットに接続するための他のホスト名を指定するには、 spec.connectivity.replicaSetHorizons設定を使用できます。 ただし、次の接続では、外部ドメインを含むホスト名は引き続き使用されます。

WARNING: Specifying this field changes how Ops Manager registers mongod processes. You can't change the value of this field or any processes[n].hostname fields 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 mongod process FQDN.

たとえば、プロセス ホスト名mdb-rs-1.example.comの場合、 example.comはドメイン名になります。

{mongodProcessFQDN}

The mongod process 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.priority1.5のメンバーは、 memberConfig.priority0.5のメンバーよりも多く、プライマリになる可能性が高くなります。

かつmemberConfig.priority0のノードはプライマリになる資格がありません。 詳しくは、「メンバーの優先順位 」を参照してください。

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 1 to allow the member to vote. Set to 0 to 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 外部からの両方で通信が可能になります。

ホストごとに複数の外部マッピングを追加できます。

注意

この例では、クライアントは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 false if 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

外部サービスの名前。 この値は変更できません。

Type

LoadBalancer

Port

<Port Number>

A port for mongod.

publishNotReadyAddress

true

Specifies that DNS records are created even if the Pod isn't ready. Do not set to false for 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 mongod process FQDN.

たとえば、プロセス ホスト名mdb-rs-1.example.comの場合、 example.comはドメイン名になります。

{mongodProcessFQDN}

The mongod process 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 setFeatureCompatibilityVersion in the MongoDB Manual.

spec.logLevel

: string

ポッドでのオートメーションエージェントのログ記録のレベルを構成します。受け入れ可能な値は以下の通りです。

  • DEBUG

  • INFO

  • WARN

  • ERROR

  • FATAL

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, and runAsNonRoot = true in securityContext. Kubernetes Operator sets fsgroup equal to runAsUser to 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.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, and LDAP. The value you specify must also be present in spec.security.authentication.modes. We recommend SCRAM-SHA-256 (SCRAM) over SCRAM-SHA-1. If you specify SCRAM-SHA-1, you must also specify MONGODB-CR.

この設定は、spec.security に複数の値を指定した場合に必要です。認証. モード

spec.security.authentication.ignoreUnknownUsers

タイプ: ブール値

デフォルト: false

Kubernetes Operator、またはCloud ManagerまたはMongoDB Ops Managerユーザー インターフェイスを通じて構成されていないデータベースユーザーを変更できるかどうかを決定します。

To manage database users directly through the mongod or mongos, set to true.

spec.security.authentication.internalCluster

: string

X.509 内部クラスター認証を有効にするかどうかを指定します。

X.509 内部クラスター認証を有効にするには、 を"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.servers RFC4516 LDAP 形式のクエリURLテンプレート。クエリは、 で指定されたホストに対して相対的です。テンプレートでは、次のトークンを使用できます。

  • {USER}
    Substitutes the authenticated username, or the transformed username, 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 password field 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 to none.

注意

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 mongod or mongos for authentication to an LDAP Distinguished Name (DN).

詳細については、MongoDB マニュアルのsecurity.ldap.userToDNMappingを参照してください。

spec.security.authentication.modes

タイプ: 配列

MongoDB 配置で使用する認証メカニズムを指定します。 有効な値は、 SCRAMSCRAM-SHA-1MONGODB-CRX509LDAPです。 We recommend SCRAM-SHA-256 (SCRAM) over SCRAM-SHA-1. SCRAM-SHA-1を指定する場合は、 MONGODB-CRも指定する必要があります。

注意

Cloud Managerまたは Ops Managerプロジェクトで X. 内部クラスター認証を有効にするには、この値を509["X509"] に設定し、次の設定を指定します。

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 true if 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-deployment and you set the prefix to mdb, you must name the TLS secret for the client TLS communications mdb-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です。

このコレクションには、次のいずれかを含める必要があります。

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 Pending state. This error displays: Please manually remove the |csr| in order to proceed. To remedy this issue:

  1. Kubernetes が新しい CSR を生成できるように、既存の CSR を削除します。リソースを削除する方法については、 リソースの 削除 を参照してください。 (Kubernetes ドキュメント)。

  2. Kubernetes が CSR を生成した後に、 CSRを承認します。

spec.security.tls.ca

: string

ConfigMap の名前を指定する は CA を保存します。

重要

If you use a custom CA to sign your TLS certificates for the MongoDBMultiCluster resource, 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 (mongo shell, 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 アプリ 」を参照してください。