注意
- この機能は、
M0クラスターとFlexクラスターでは使用できません。
Atlas は、AWS、Google Cloud、Azure でホストされている専用クラスターと、マルチクラウドのシャーディングされたクラスターにおけるネットワーク ピアリング接続をサポートしています。
ネットワークピアリングで、Atlas VPC とクラウドプロバイダーの VPC の間で確立されるプライベート接続では、パブリック ネットワークのトラフィックを分離することで、セキュリティが強化されます。
Atlas では、異なるクラウドプロバイダーの単一リージョンに配置するクラスター間のネットワークピアリングはサポートしていません。
Atlas Kubernetes Operator を使用してネットワークピアリング接続を管理するには、spec.networkPeers を指定して更新します。パラメータ(AtlasProject カスタム リソースの)。サポートされているカスタム リソースのいずれかで specフィールドを変更するたびに、Atlas Kubernetes Operator は対応する Atlas 構成を作成または更新します。
前提条件
Atlas Kubernetes Operator を使用してネットワークピアリングを構成するには、次のものが必要です。
Atlas Kubernetes Operatorが配置された実行中の Kubernetes クラスター。
Atlas
Organization OwnerのProject Ownerまたは ロール。まだ作成していない場合は、 Amazon Web Services で VPC を作成します。詳細については、 Amazon VPCを使い始める を参照してください。
アウトバウンド トラフィックのネットワーク トラフィック ルール。
Atlas に接続するリソースにアタッチされた AWS セキュリティ グループに、次のネットワーク トラフィック ルールを作成します。
権限方向ポートターゲット許可する
アウトバウンド
27015から27017
使用している Atlas CIDR
Atlas Kubernetes Operatorが配置された実行中の Kubernetes クラスター。
Atlas
Organization OwnerのProject Ownerまたは ロール。まだ作成していない場合は、Azureで VNet を作成します。詳しくは、「 Azure portal を使用して仮想ネットワークを作成する 」を参照してください。
ネットワークピアリング接続を構成するために必要な Azure ロール。
詳しくは、 Azure権限 を参照してください。
Atlas ピアリング アプリケーション ID のサービスプリンシパル。
注意
For details about how Atlas creates Network Peering connections with Azure VPCs, see the
Azuretab in Network Peering.各 Azure ネットワークピアリング接続を作成する前に、次の手順を完了する必要があります。
次の Azure CLI コマンドを実行し、指定された Atlas ピアリング アプリケーション ID を使用してサービスプリンシパルを作成します。
az ad sp create --id e90a1407-55c3-432d-9cb1-3638900a9d22 これは、サブスクライブごとに 1 回だけ必要です。 次のメッセージが表示された場合は、Atlas ピアリング アプリケーション ID を持つサービス プリンシパルはすでに存在します。 次の手順に進みます。
Another object with the same value for property servicePrincipalNames already exists. 次の例の
peering-role.jsonファイルをコピーし、現在の作業ディレクトリに保存します。1 { 2 "Name":"AtlasPeering/<azureSubscriptionId>/<resourceGroupName>/<vnetName>", 3 "IsCustom":true, 4 "Description":"Grants MongoDB access to manage peering connections on network /subscriptions/<azureSubscriptionId>/resourceGroups/<resourceGroupName>/providers/Microsoft.Network/virtualNetworks/<vnetName>", 5 "Actions":[ 6 "Microsoft.Network/virtualNetworks/virtualNetworkPeerings/read", 7 "Microsoft.Network/virtualNetworks/virtualNetworkPeerings/write", 8 "Microsoft.Network/virtualNetworks/virtualNetworkPeerings/delete", 9 "Microsoft.Network/virtualNetworks/peer/action" 10 ], 11 "AssignableScopes":[ 12 "/subscriptions/<azureSubscriptionId>/resourceGroups/<resourceGroupName>/providers/Microsoft.Network/virtualNetworks/<vnetName>" 13 ] 14 } peering-role.jsonの変数を、ピアリング接続を作成する Azure VNet に関する詳細に置き換えます。変数説明azureSubscriptionIdVNet が存在する Azure サブスクリプションの一意の識別子。
resourceGroupNameAzure リソース グループの名前。
vnetNameAzure VNet の名前。
次の Azure CLI コマンドを実行し、
peering-role.jsonファイルを使用してロール定義を作成します。az role definition create --role-definition peering-role.json 以下に示す Azure CLI コマンドを実行して、作成したロールを サービス プリンシパルに割り当てます。
変数を
peering-role.jsonファイルで使用したのと同じ値に置き換えます。az role assignment create \ --role "AtlasPeering/<azureSubscriptionId>/<resourceGroupName>/<vnetName>" \ --assignee "e90a1407-55c3-432d-9cb1-3638900a9d22" \ --scope "/subscriptions/<azureSubscriptionId>/resourceGroups/<resourceGroupName>/providers/Microsoft.Network/virtualNetworks/<vnetName>"
Atlas Kubernetes Operatorが配置された実行中の Kubernetes クラスター。
The
Project OwnerorOrganization Ownerrole in Atlas.IAM ユーザー ポリシーが定められ、かつ コンピュート ネットワーク管理者 ロール(ネットワーク リソースの作成、変更、削除が可能)を持つGoogle Cloud Platformユーザー アカウント。Google Cloud Platformでプライベートエンドポイントと接続を管理する方法について詳しくは、 「 VPC (VPC)ネットワークの作成と変更 」を参照してください。
まだ作成していない場合は、 Google Cloud PlatformでVPCを作成します。詳しくは、GCPドキュメントを参照してください。
手順
次の手順で、クライアントがネットワークピアリング接続を使用して Atlas クラスターに接続できるようにします。
spec.networkPeersパラメータを指定します。
既存のコンテナまたは新しいコンテナを使用するようにネットワーク ピアリングを構成できます。
既存のコンテナを使用
spec.networkPears の指定
AtlasProjectカスタム リソースの パラメータ。次のプレースホルダーを自分の値に置き換えます。プレースホルダー説明spec.networkPeers.providerNameクラウドプロバイダー名。
AWSを指定します。spec.networkPeers.containerId使用するネットワーク ピアリング コンテナの一意の識別子です。
containerIdを指定しない場合は、atlasCIDRblockを設定する必要があります。 詳しくは、この手順のCreate New Containerセクションを参照してください。spec.networkPeers.accepterRegionNamespec.networkPeers.awsAccountIdAmazon Web Servicesアカウントの一意の識別子です。 コンソールのホームページの右上隅にあるアカウント名をクリックすると、 Amazon Web ServicesにアカウントIDが表示されます。
spec.networkPeers.routeTableCidrBlock用のAmazon Web ServicesVPC CIDR ブロック。Amazon Web Servicesは、 の詳細ページに CIDR VPCブロックを表示します。
spec.networkPeers.vpcIdAmazon Web Services VPCの一意の識別子です。 Amazon Web ServicesはVPCID VPCの詳細ページに表示します。
次のコマンドを実行します:
cat <<EOF | kubectl apply -f - apiVersion: atlas.mongodb.com/v1 kind: AtlasProject metadata: name: my-project spec: name: Test Atlas Operator Project networkPeers: - providerName: "AWS" containerID: "6dc5f17280eef56a459fa3fb" accepterRegionName: "us-east-2" awsAccountId: "12345678" routeTableCidrBlock: "10.0.0.0/24" vpcId: "vpc-12345678" EOF
新しいコンテナの作成
spec.networkPears の指定
AtlasProjectカスタム リソースの パラメータ。次のプレースホルダーを自分の値に置き換えます。プレースホルダー説明spec.networkPeers.providerNameクラウドプロバイダー名。
AWSを指定します。spec.networkPeers.atlasCidrBlockAtlas CIDR block for which Atlas Kubernetes Operator creates a new container. If you don't specify
atlasCidrBlock, you must specify thecontainerIdof an existing container. To learn more, see the Use Existing Container section in this procedure.spec.networkPeers.containerRegion(Optional) AWS region in which Atlas Kubernetes Operator creates a new container. If you don't specify either a
containerRegionor acontainerId, Atlas Kubernetes Operator creates a new container in the same region as theaccepterRegionName.spec.networkPeers.accepterRegionNamespec.networkPeers.awsAccountIdAmazon Web Servicesアカウントの一意の識別子です。 コンソールのホームページの右上隅にあるアカウント名をクリックすると、 Amazon Web ServicesにアカウントIDが表示されます。
spec.networkPeers.routeTableCidrBlock用のAmazon Web ServicesVPC CIDR ブロック。Amazon Web Servicesは、 の詳細ページに CIDR VPCブロックを表示します。
spec.networkPeers.vpcIdAmazon Web Services VPCの一意の識別子です。 Amazon Web ServicesはVPCID VPCの詳細ページに表示します。
次のコマンドを実行します:
cat <<EOF | kubectl apply -f - apiVersion: atlas.mongodb.com/v1 kind: AtlasProject metadata: name: my-project spec: name: Test Atlas Operator Project networkPeers: - providerName: "AWS" atlasCidrBlock: "10.8.0.0/21" containerRegion: "us-west-1" accepterRegionName: "us-east-2" awsAccountId: "12345678" routeTableCidrBlock: "10.0.0.0/24" vpcId: "vpc-12345678" EOF
Accept the VPC peering connection in AWS.
詳細については、「VPCピアリング接続の受け入れ」を参照してください。
Atlas Kubernetes Operator を使用して、VPC 接続のステータスを確認します。
Run the following command again to check the status of the VPC connection. Atlas Kubernetes Operator returns READY when the network peering connection is complete.
kubectl get atlasprojects my-project -o=jsonpath='{.status.networkPeers.statusName}'
READY
spec.networkPeersパラメータを指定します。
既存のコンテナまたは新しいコンテナを使用するようにネットワーク ピアリングを構成できます。
既存のコンテナを使用
spec.networkPears の指定
AtlasProjectカスタム リソースの パラメータ。次のプレースホルダーを自分の値に置き換えます。プレースホルダー説明spec.networkPeers.providerNameクラウドプロバイダー名。
AZUREを指定します。spec.networkPeers.containerId使用するネットワーク ピアリング コンテナの一意の識別子です。
containerIdを指定しない場合は、atlasCIDRblockを設定する必要があります。 詳しくは、この手順のCreate New Containerセクションを参照してください。spec.networkPeers.accepterRegionNameAzure region for your VPC.
spec.networkPeers.azureSubscriptionIdAzure サブスクライブの一意な識別子です。 Azureでは、サブスクリプションの詳細ページにサブスクリプション ID が表示されます。
spec.networkPeers.resourceGroupNameVPC を含む Azure リソース グループを識別する、人間が判読可能なラベル。Azureでは、リソース グループの詳細ページにリソース グループ名が表示されます。
spec.networkPeers.azureDirectoryIdUnique identifier for your Azure Active Directory tenant. Azure displays this as the
Tenant IDon the tenant properties page.spec.networkPeers.vnetNameAzure VNET を識別する、人間が判読可能なラベル。 Azureでは VNET の詳細ページに VNET 名が表示されます。
次のコマンドを実行します:
cat <<EOF | kubectl apply -f - apiVersion: atlas.mongodb.com/v1 kind: AtlasProject metadata: name: my-project spec: name: Test Atlas Operator Project networkPeers: - providerName: "AZURE" containerID: "6dc5f17280eef56a459fa3fb" accepterRegionName: "US_EAST_2" azureSubscriptionId: "12345678" resourceGroupName: "my-group" azureDirectoryId: "x0xxx10-00x0-0x01-0xxx-x0x0x01xx100" vnetName: "my-vnet" EOF
新しいコンテナの作成
spec.networkPears の指定
AtlasProjectカスタム リソースの パラメータ。次のプレースホルダーを自分の値に置き換えます。プレースホルダー説明spec.networkPeers.providerNameクラウドプロバイダー名。
AZUREを指定します。spec.networkPeers.atlasCidrBlockAtlas CIDR block for which Atlas Kubernetes Operator creates a new container. If you don't specify
atlasCidrBlock, you must specify thecontainerIdof an existing container. To learn more, see the Use Existing Container section in this procedure.spec.networkPeers.containerRegionspec.networkPeers.accepterRegionNameAzure region for your VPC.
spec.networkPeers.azureSubscriptionIdAzure サブスクライブの一意な識別子です。 Azureでは、サブスクリプションの詳細ページにサブスクリプション ID が表示されます。
spec.networkPeers.resourceGroupNameVPC を含む Azure リソース グループを識別する、人間が判読可能なラベル。Azureでは、リソース グループの詳細ページにリソース グループ名が表示されます。
spec.networkPeers.azureDirectoryIdUnique identifier for your Azure active directory tenant. Azure displays this as the
Tenant IDon the tenant properties page.spec.networkPeers.vnetNameAzure VNET を識別する、人間が判読可能なラベル。 Azureでは VNET の詳細ページに VNET 名が表示されます。
次のコマンドを実行します:
cat <<EOF | kubectl apply -f - apiVersion: atlas.mongodb.com/v1 kind: AtlasProject metadata: name: my-project spec: name: Test Atlas Operator Project networkPeers: - providerName: "AZURE" atlasCidrBlock: "10.8.0.0/21" containerRegion: "US_WEST" azureSubscriptionId: "12345678" resourceGroupName: "my-group" azureDirectoryId: "x0xxx10-00x0-0x01-0xxx-x0x0x01xx100" vnetName: "my-vnet" EOF
spec.networkPeersパラメータを指定します。
既存のコンテナまたは新しいコンテナを使用するようにネットワーク ピアリングを構成できます。
既存のコンテナを使用
spec.networkPears の指定
AtlasProjectカスタム リソースの パラメータ。次のプレースホルダーを自分の値に置き換えます。プレースホルダー説明spec.networkPeers.providerNameクラウドプロバイダー名。
GCPを指定します。spec.networkPeers.containerId使用するネットワーク ピアリング コンテナの一意の識別子です。
containerIdを指定しない場合は、atlasCIDRblockとcontainerRegionを設定する必要があります。 詳しくは、この手順のCreate New Containerセクションを参照してください。spec.networkPeers.gcpProjectIdGoogle Cloud Platformプロジェクトの一意の識別子。 Google Cloud Platformでは、プロジェクトの詳細ページにプロジェクトIDが表示されます。
spec.networkPeers.routeTableCidrBlock用の CIDRGoogle Cloud PlatformVPC ブロック。Google Cloud Platformは、 の詳細ページに CIDR VPCブロックを表示します。
spec.networkPeers.networkNameGoogle Cloud Platform VPCの人間が判読可能なラベル。 Google Cloud Platformでは、 VPCの詳細ページにネットワーク名が表示されます。
次のコマンドを実行します:
cat <<EOF | kubectl apply -f - apiVersion: atlas.mongodb.com/v1 kind: AtlasProject metadata: name: my-project spec: name: Test Atlas Operator Project networkPeers: - providerName: "GCP" containerId: "6dc5f17280eef56a459fa3fb" gcpProjectId: "12345678" networkName: "my-vpc" EOF
新しいコンテナの作成
spec.networkPears の指定
AtlasProjectカスタム リソースの パラメータ。次のプレースホルダーを自分の値に置き換えます。プレースホルダー説明spec.networkPeers.providerNameクラウドプロバイダー名。
GCPを指定します。spec.networkPeers.atlasCidrBlockAtlas CIDR block for which Atlas Kubernetes Operator creates a new container. If you don't specify
atlasCidrBlock, you must specify thecontainerIdof an existing container. To learn more, see the Use Existing Container section in this procedure.spec.networkPeers.containerRegionspec.networkPeers.containerRegionAtlas Kubernetes Operator が新しいコンテナを作成する Google Cloud リージョン。
containerRegioncontainerIdを指定しない場合は、既存のコンテナの を指定する必要があります。詳しくは、この手順のUse Existing Container セクションを参照してください。spec.networkPeers.gcpProjectIdGoogle Cloud Platformプロジェクトの一意の識別子。 Google Cloud Platformでは、プロジェクトの詳細ページにプロジェクトIDが表示されます。
spec.networkPeers.routeTableCidrBlock用の CIDRGoogle Cloud PlatformVPC ブロック。Google Cloud Platformは、 の詳細ページに CIDR VPCブロックを表示します。
spec.networkPeers.networkNameGoogle Cloud Platform VPCの人間が判読可能なラベル。 Google Cloud Platformでは、 VPCの詳細ページにネットワーク名が表示されます。
次のコマンドを実行します:
cat <<EOF | kubectl apply -f - apiVersion: atlas.mongodb.com/v1 kind: AtlasProject metadata: name: my-project spec: name: Test Atlas Operator Project networkPeers: - providerName: "GCP" atlasCidrBlock: "10.8.0.0/21" gcpProjectId: "12345678" networkName: "my-vpc" EOF
Create the VPC peering connection in Google Cloud.
詳細については、 VPCネットワークピアリングの使用 を参照してください。