참고
다음 배포에서는 이 기능 사용할 수 없습니다.
M0클러스터Flex 클러스터
Atlas Kubernetes Operator는 다음 플랫폼에서 전용 클러스터에 대한 비공개 엔드포인트 관리를 지원합니다.
AWS PrivateLink 기능을 사용하는 AWS.
Azure Private Link 기능을 사용하는 Azure .
Private Service Connect 기능 사용하는 Google Cloud Platform .
시작하기 전에 비공개 엔드포인트 관리를 참조하세요.
절차
클라이언트가 비공개 엔드포인트를 사용하여 Atlas 전용 클러스터에 연결할 수 있도록 하려면 다음과 같이 하세요:
spec.privateEndpoints 매개변수를 지정합니다.
Specify the spec.privateEndpoints parameter for the AtlasProject Custom Resource. In the spec.privateEndpoints.provider field, specify AWS. Replace the placeholder {aws-region} with the AWS region information for your private endpoints and run the following command:
cat <<EOF | kubectl apply -f - apiVersion: atlas.mongodb.com/v1 kind: AtlasProject metadata: name: my-project spec: name: Test Atlas Operator Project privateEndpoints: - provider: "AWS" region: "{aws-region}" EOF
Atlas 는 선택한 리전 에 VPC 리소스를 생성합니다. 이 작업을 완료하는 데 몇 분 정도 걸릴 수 있습니다.
비공개 엔드포인트의 서비스 이름을 찾습니다.
다음 명령을 실행합니다:
kubectl get atlasproject my-project -o yaml AtlasProject사용자 지정 리소스의status.privateEndpoints.serviceName필드에 있는 각 비공개 엔드포인트에 대한 서비스 이름 문자열을 확인합니다.
Amazon Web Services Atlas CLI를 사용하여 각 비공개 엔드포인트를 구성합니다.
To create your application VPC interface endpoint:
다음 명령을 복사합니다.
aws ec2 create-vpc-endpoint --vpc-id {your-application-vpc-id} --region {aws-region} --service-name {service-name-string} --vpc-endpoint-type Interface --subnet-ids {your-application-subnet-ids} 다음 자리 표시자를 Amazon Web Services VPC 에 대한 세부 정보로 바꿉니다.
your-application-vpc-id피어링 AWS VPC를 식별하는 고유 문자열입니다. 이 값은 AWS 계정의 VPC 대시보드에서 찾을 수 있습니다.
aws-region비공개 엔드포인트의 Amazon Web Services 리전 을 식별하는 레이블입니다.
service-name-string비공개 엔드포인트의 서비스 이름을 식별하는 고유 문자열입니다.
AtlasProject사용자 지정 리소스의status.privateEndpoints.serviceName필드 내에서 이 값을 찾습니다.your-application-subnet-idsAWS VPC 가 사용하는 서브넷을 식별하는 고유 문자열입니다. 각 서브넷을 공백으로 구분하세요.AWS 계정의 Subnet 대시보드 에서 이 값을 찾을 수 있습니다.
IMPORTANT: You must specify at least one subnet. If you don't, AWS won't provision a interface endpoint in your VPC. An interface endpoint is required for clients in your VPC to send traffic to the private endpoint.
Amazon Web Services CLI사용하여 명령을 실행합니다.
출력에서
VpcEndpointId값을 확인합니다.예시
"VpcEndpoint": { "VpcEndpointId": "vpce-XXXXXX", "VpcEndpointType": "Interface", "VpcId": "vpc-XXXXX", "ServiceName": "com.amazonaws.vpce.{aws-region}.vpce-svc-XXXX", "State": "pendingAcceptance",
자세한 학습 은 Amazon Web Services 설명서의 인터페이스 엔드포인트 생성을 참조하세요.
spec.privateEndpoints 매개변수를 업데이트합니다.
Update the spec.privateEndpoints parameter for the AtlasProject Custom Resource. Specify the AWS region and replace vpce-id with the VpcEndpointId values for your private endpoints and run the following command:
참고
You can find the unique identifier of the peer AWS VPC on the VPC dashboard in your AWS account.
cat <<EOF | kubectl apply -f - apiVersion: atlas.mongodb.com/v1 kind: AtlasProject metadata: name: my-project spec: name: Test Atlas Operator Project privateEndpoints: - provider: "AWS" region: "{aws-region}" id: "{vpce-id}" EOF
Atlas Kubernetes Operator가 클러스터에 연결하기 위해 생성한 비밀을 조회하세요.
다음 명령을 복사합니다.
중요
다음 명령을 실행하려면
jq1.6 이상이 필요합니다.kubectl get secret {my-project}-{my-atlas-cluster}-{my-database-user} -o json | jq -r '.data | with_entries(.value |= @base64d)'; 다음 자리 표시자를 원하는 사용자 지정 리소스의 세부 정보로 바꾸세요.
my-projectAtlasProject사용자 지정 리소스의metadata필드 값을 지정합니다.my-atlas-clusterAtlasDeployment사용자 지정 리소스의metadata필드 값을 지정합니다.my-database-userAtlasDatabaseUser사용자 지정 리소스의metadata필드 값을 지정합니다.명령을 실행합니다.
참고
연결 문자열은 다음 예제와 다를 수 있습니다. 비공개 엔드포인트가 여러 개 있는 경우 비밀에는 적절한 숫자 접미사가 붙은
connectionStringPrivate및connectionStringPrivateSvr필드가 여러 개 포함됩니다(예:connectionStringPrivate1,connectionStringPrivate2등).{ "connectionStringPrivate": "mongodb://pl-0-eastus2.uzgh6.mongodb.net:1024,pl-0-eastus2.uzgh6.mongodb.net:1025,pl-0-eastus2.uzgh6.mongodb.net:1026/?ssl=truereplicaSet=atlas-18bndf-shard-0", "connectionStringPrivateSrv": "mongodb+srv://cluster0-pl-0.uzgh6.mongodb.net", "password": "P@@sword%", "username": "theuser" } 애플리케이션 에서 이 시크릿을 사용할 수 있습니다.
containers: - name: test-app env: - name: "CONNECTION_STRING" valueFrom: secretKeyRef: name: my-project-my-atlas-cluster-my-database-user key: connectionStringPrivate
spec.privateEndpoints 매개변수를 지정합니다.
Specify the spec.privateEndpoints parameter for the AtlasProject Custom Resource. In the spec.privateEndpoints.provider field, specify AZURE. Replace the placeholder {azure-region} with the Azure region information for your private endpoints and run the following command:
cat <<EOF | kubectl apply -f - apiVersion: atlas.mongodb.com/v1 kind: AtlasProject metadata: name: my-project spec: name: Test Atlas Operator Project privateEndpoints: - provider: "AZURE" region: "{azure-region}" EOF
Atlas 는 선택한 리전 에 VNET 리소스를 생성합니다. 이 작업을 완료하는 데 몇 분 정도 걸릴 수 있습니다.
비공개 엔드포인트 네트워크 정책을 비활성화합니다.
Atlas는 비공개 엔드포인트에 대한 네트워크 정책을 지원하지 않습니다.
다음 명령을 복사합니다.
az network vnet subnet update --resource-group {resource-group-name} --vnet-name {vnet-name} --name {subnet-name} --disable-private-endpoint-network-policies true 다음 자리 표시자를 Azure VNet에 대한 세부 정보로 바꿉니다.
resource-group-nameAtlas 연결에 사용할 VNet이 포함된 리소스 그룹 에 대한 사람이 읽을 수 있는 레이블입니다. 이 값은 Azure 대시보드 의 Resource Group Properties 페이지에서 찾을 수 있습니다.
vnet-nameAtlas 에 연결하는 데 사용할 VNet을 식별하는 사람이 읽을 수 있는 레이블입니다. 이 값은 Azure 대시보드 의 Virtual Network 페이지에서 찾을 수 있습니다.
subnet-nameAzure VNet의 서브넷을 식별하는 인간 가독형 레이블입니다. Azure 대시보드의 Virtual Network Subnets 페이지에서 이 값을 찾으세요.
Azure CLI사용하여 명령을 실행합니다.
자세한 학습 은 Azure 설명서에서 비공개 엔드포인트에 대한 네트워크 정책 관리 를 참조하세요.
비공개 엔드포인트 의 서비스 ID와 이름을 찾습니다.
다음 명령을 실행합니다:
kubectl get atlasproject my-project -o yaml AtlasProjectCustom Resource(사용자 지정 리소스 )의status.privateEndpoints.serviceResourceId및status.privateEndpoints.serviceName필드에 있는 각 비공개 엔드포인트에 대한 서비스 리소스 ID 및 서비스 이름을 확인합니다.
Azure CLI 를 사용하여 각 비공개 엔드포인트를 구성합니다.
비공개 엔드포인트를 생성하려면 다음을 수행합니다.
다음 명령을 복사합니다.
az network private-endpoint create --resource-group {resource-group-name} --name {endpoint-name} --vnet-name {vnet-name} --subnet {subnet-name} --private-connection-resource-id {serviceResourceId} --connection-name {serviceName} --manual-request true 다음 자리 표시자를 Azure VNet에 대한 세부 정보로 바꿉니다.
resource-group-nameAtlas 연결에 사용할 VNet이 포함된 리소스 그룹 에 대한 사람이 읽을 수 있는 레이블입니다. 이 값은 Azure 대시보드 의 Resource Group Properties 페이지에서 찾을 수 있습니다.
endpoint-name비공개 엔드포인트를 식별하는 사람이 읽을 수 있는 레이블입니다. 지금 지정합니다.
vnet-nameAtlas 에 연결하는 데 사용할 VNet을 식별하는 사람이 읽을 수 있는 레이블입니다. 이 값은 Azure 대시보드 의 Virtual Network 페이지에서 찾을 수 있습니다.
subnet-nameAzure VNet의 서브넷을 식별하는 인간 가독형 레이블입니다. Azure 대시보드의 Virtual Network Subnets 페이지에서 이 값을 찾으세요.
serviceResourceId비공개 엔드포인트의 서비스 리소스 를 식별하는 고유 string 입니다.
AtlasProjectCustom Resource(사용자 지정 리소스 )의status.privateEndpoints.serviceResourceId필드 내에서 이 값을 찾습니다.serviceName비공개 엔드포인트의 서비스 이름을 식별하는 고유 문자열입니다.
AtlasProject사용자 지정 리소스의status.privateEndpoints.serviceName필드 내에서 이 값을 찾습니다.Azure CLI사용하여 명령을 실행합니다.
spec.privateEndpoints 매개변수를 업데이트합니다.
Update the spec.privateEndpoints parameter for the AtlasProject Custom Resource. Specify the the Azure region, Resource ID, and IP address information for your private endpoints and run the following command:
참고
Azure 대시보드의 Properties 페이지에는 Resource ID 필드에서 만든 비공개 엔드포인트의 고유 식별자가 표시됩니다.
Azure 대시보드의 Overview 페이지에는 Private IP 필드에서 만든 비공개 엔드포인트 네트워크 인터페이스의 비공개 IP 주소가 표시됩니다.
cat <<EOF | kubectl apply -f - apiVersion: atlas.mongodb.com/v1 kind: AtlasProject metadata: name: my-project spec: name: Test Atlas Operator Project privateEndpoints: - provider: "Azure" region: "{azure-region}" id: "{resource-id}" ip: "{private-ip}" EOF
Atlas Kubernetes Operator가 클러스터에 연결하기 위해 생성한 비밀을 조회하세요.
다음 명령을 복사합니다.
중요
다음 명령을 실행하려면
jq1.6 이상이 필요합니다.kubectl get secret {my-project}-{my-atlas-cluster}-{my-database-user} -o json | jq -r '.data | with_entries(.value |= @base64d)'; 다음 자리 표시자를 원하는 사용자 지정 리소스의 세부 정보로 바꾸세요.
my-projectAtlasProject사용자 지정 리소스의metadata필드 값을 지정합니다.my-atlas-clusterAtlasDeployment사용자 지정 리소스의metadata필드 값을 지정합니다.my-database-userAtlasDatabaseUser사용자 지정 리소스의metadata필드 값을 지정합니다.명령을 실행합니다.
참고
연결 문자열은 다음 예제와 다를 수 있습니다. 비공개 엔드포인트가 여러 개 있는 경우 비밀에는 적절한 숫자 접미사가 붙은
connectionStringPrivate및connectionStringPrivateSvr필드가 여러 개 포함됩니다(예:connectionStringPrivate1,connectionStringPrivate2등).{ "connectionStringPrivate": "mongodb://pl-0-eastus2.uzgh6.mongodb.net:1024,pl-0-eastus2.uzgh6.mongodb.net:1025,pl-0-eastus2.uzgh6.mongodb.net:1026/?ssl=truereplicaSet=atlas-18bndf-shard-0", "connectionStringPrivateSrv": "mongodb+srv://cluster0-pl-0.uzgh6.mongodb.net", "password": "P@@sword%", "username": "theuser" } 애플리케이션 에서 이 시크릿을 사용할 수 있습니다.
containers: - name: test-app env: - name: "CONNECTION_STRING" valueFrom: secretKeyRef: name: my-project-my-atlas-cluster-my-database-user key: connectionStringPrivate
spec.privateEndpoints 매개변수를 지정합니다.
AtlasProject Custom Resource(사용자 지정 spec.privateEndpoints 리소스) 에 대한 매개 변수를 지정합니다. spec.privateEndpoints.provider 필드 에 GCP 를 지정합니다. 자리 표시자 {gcp-region} 를 비공개 엔드포인트 에 대한 Google Cloud Platform 리전 정보로 바꾸고 다음 명령을 실행 합니다.
cat <<EOF | kubectl apply -f - apiVersion: atlas.mongodb.com/v1 kind: AtlasProject metadata: name: my-project spec: name: Test Atlas Operator Project privateEndpoints: - provider: "GCP" region: "{gcp-region}" EOF
Atlas 는 선택한 리전 에 VPC 리소스를 생성합니다. 이 작업을 완료하는 데 몇 분 정도 걸릴 수 있습니다.
비공개 엔드포인트에 대한 {unique-ID} 를 찾습니다.
다음 명령을 실행합니다:
kubectl get atlasproject my-project -o yaml 각 서비스 첨부 파일 이름에서
projects/뒤에 오는{unique-id}에 유의하세요. 다음 예시 에서{unique-id}는p-ogyvk1plka2anycnzl6znr9p입니다.예시
"serviceAttachmentNames": [ "projects/p-ogyvk1plka2anycnzl6znr9p/regions/us-east1/serviceAttachments/sa-us-east1-6274f45bcce0e51662a29b05-0", "projects/p-ogyvk1plka2anycnzl6znr9p/regions/us-east1/serviceAttachments/sa-us-east1-6274f45bcce0e51662a29b05-1", "projects/p-ogyvk1plka2anycnzl6znr9p/regions/us-east1/serviceAttachments/sa-us-east1-6274f45bcce0e51662a29b05-2", "projects/p-ogyvk1plka2anycnzl6znr9p/regions/us-east1/serviceAttachments/sa-us-east1-6274f45bcce0e51662a29b05-3", "projects/p-ogyvk1plka2anycnzl6znr9p/regions/us-east1/serviceAttachments/sa-us-east1-6274f45bcce0e51662a29b05-4", "projects/p-ogyvk1plka2anycnzl6znr9p/regions/us-east1/serviceAttachments/sa-us-east1-6274f45bcce0e51662a29b05-5" ]
비공개 엔드포인트 를 구성합니다.
To edit the private endpoints and generate the necessary script with the Atlas UI, see Configure Private Endpoints.
비공개 엔드포인트를 수동으로 구성하려면 다음을 수행합니다.
다음 shell 스크립트 를 복사합니다.
!/bin/bash gcloud config set project {google-cloud-project-id} for i in {0..5} do gcloud compute addresses create {private-service-connect-endpoint-prefix}-ip-$i --region={gcp-region} --subnet={subnet-name} done for i in {0..5} do if [ $(gcloud compute addresses describe {private-service-connect-endpoint-prefix}-ip-$i --region={gcp-region} --format="value(status)") != "RESERVED" ]; then echo "{private-service-connect-endpoint-prefix}-ip-$i is not RESERVED"; exit 1; fi done for i in {0..5} do gcloud compute forwarding-rules create {private-service-connect-endpoint-prefix}-$i --region={gcp-region} --network={vpc-name} --address={private-service-connect-endpoint-prefix}-ip-$i --target-service-attachment=projects/{unique-ID}/regions/{gcp-region}/serviceAttachments/sa-{gcp-region}-{org-id}-$i done if [ $(gcloud compute forwarding-rules list --regions={gcp-region} --format="csv[no-heading](name)" --filter="name:{private-service-connect-endpoint-prefix}" | wc -l) -gt 50 ]; then echo "Project has too many forwarding rules that match prefix {endpoint-name}. Either delete the competing resources or choose another endpoint prefix." exit 2; fi gcloud compute forwarding-rules list --regions={gcp-region} --format="json(IPAddress,name)" --filter="name:{private-service-connect-endpoint-prefix}" > atlasEndpoints-{endpoint-name}.json 다음 자리 표시자를 Google Cloud Platform VPC 에 대한 세부 정보로 바꿉니다.
google-cloud-project-id프로젝트 를 식별하는 고유 입니다.ID Google Cloud Platform 이 값은 Google Cloud Platform 의 Dashboard 페이지에서 찾을 수 있습니다.
private-service-connect-endpoint-prefix생성된 모든 엔드포인트 앞에 붙이고 엔드포인트 그룹 을 식별하는 사람이 읽을 수 있는 레이블입니다.
gcp-regionLabel that identifies the Google Cloud Platform region of the private endpoint.
subnet-nameGoogle Cloud Platform VPC 의 서브넷을 식별하는 인간 가독형 레이블입니다. Google Cloud 대시보드의 VPC Networks 페이지에서 이 값을 찾으세요.
vpc-nameAtlas 연결에 사용할 VPC 를 식별하는 인간 판독 가능 레이블. Google Cloud 대시보드의 VPC Networks 페이지에서 이 값을 찾으세요.
unique-id프로젝트 상태를 반환할 때 기록한 고유 string 입니다.
org-idUnique 24-digit hexadecimal string that identifies the Atlas organization.
shell 파일 을
setup_psc.sh(으)로 저장하고 파일 을 저장한 디렉토리 에서 다음 명령을 사용하여 스크립트 를 실행 합니다.sh setup_psc.sh 이 스크립트 는 IP 주소 및 전달 규칙 이름 목록이 포함된
atlasEndpoints-{endpoint-name}.json출력 파일 을 생성합니다.다음 명령을 실행하여 Atlas Kubernetes Operator 의 출력 형식을 지정합니다.
yq e -P atlasEndpoints-{endpoint-name}.json > atlasEndpoints-user-private-endpoint.yaml awk 'sub("name","endpointName")sub("IPAddress","ipAddress")' atlasEndpoints-user-private-endpoint.yaml 출력은 다음 예시 와 유사해야 합니다.
- ipAddress: 10.0.0.00 endpointName: {endpoint-name}-0 - ipAddress: 10.0.0.01 endpointName: {endpoint-name}-1 - ipAddress: 10.0.0.02 endpointName: {endpoint-name}-2 - ipAddress: 10.0.0.03 endpointName: {endpoint-name}-3 - ipAddress: 10.0.0.04 endpointName: {endpoint-name}-4 - ipAddress: 10.0.0.05 endpointName: {endpoint-name}-5
spec.privateEndpoints 매개변수를 업데이트합니다.
Update the spec.privateEndpoints parameter for the AtlasProject Custom Resource. Specify the Google Cloud Platform region, Google Cloud Project ID, Private Service Endpoint Prefix, your output information, and run the following command:
cat <<EOF | kubectl apply -f - apiVersion: atlas.mongodb.com/v1 kind: AtlasProject metadata: name: my-project spec: name: Test Atlas Operator Project privateEndpoints: - provider: "GCP" region: "{gcp-region}" gcpProjectId: "{project-id}" endpointGroupName: "{endpoint-name}" endpoints: - ipAddress: {ip-address} endpointName: {endpoint-name}-0 - ipAddress: {ip-address} endpointName: {endpoint-name}-1 - ipAddress: {ip-address} endpointName: {endpoint-name}-2 - ipAddress: {ip-address} endpointName: {endpoint-name}-3 - ipAddress: {ip-address} endpointName: {endpoint-name}-4 - ipAddress: {ip-address} endpointName: {endpoint-name}-5 EOF
Atlas Kubernetes Operator가 클러스터에 연결하기 위해 생성한 비밀을 조회하세요.
다음 명령을 복사합니다.
중요
다음 명령을 실행하려면
jq1.6 이상이 필요합니다.kubectl get secret {my-project}-{my-atlas-cluster}-{my-database-user} -o json | jq -r '.data | with_entries(.value |= @base64d)'; 다음 자리 표시자를 원하는 사용자 지정 리소스의 세부 정보로 바꾸세요.
my-projectAtlasProject사용자 지정 리소스의metadata필드 값을 지정합니다.my-atlas-clusterAtlasDeployment사용자 지정 리소스의metadata필드 값을 지정합니다.my-database-userAtlasDatabaseUser사용자 지정 리소스의metadata필드 값을 지정합니다.명령을 실행합니다.
참고
연결 문자열은 다음 예제와 다를 수 있습니다. 비공개 엔드포인트가 여러 개 있는 경우 비밀에는 적절한 숫자 접미사가 붙은
connectionStringPrivate및connectionStringPrivateSvr필드가 여러 개 포함됩니다(예:connectionStringPrivate1,connectionStringPrivate2등).{ "connectionStringPrivate": "mongodb://pl-0-eastus2.uzgh6.mongodb.net:1024,pl-0-eastus2.uzgh6.mongodb.net:1025,pl-0-eastus2.uzgh6.mongodb.net:1026/?ssl=truereplicaSet=atlas-18bndf-shard-0", "connectionStringPrivateSrv": "mongodb+srv://cluster0-pl-0.uzgh6.mongodb.net", "password": "P@@sword%", "username": "theuser" } 애플리케이션 에서 이 시크릿을 사용할 수 있습니다.
containers: - name: test-app env: - name: "CONNECTION_STRING" valueFrom: secretKeyRef: name: my-project-my-atlas-cluster-my-database-user key: connectionStringPrivate