AI 에이전트의 경우: 문서 인덱스는 https://www.mongodb.com/ko-kr/docs/llms.txt에서 사용할 수 있으며, 모든 페이지의 마크다운 버전은 어떤 URL 경로에 .md를 추가하여 사용할 수 있습니다.
Docs Menu

managed X.509 인증을 사용하여 데이터베이스 사용자

Kubernetes Operator는 TLS 및 X.509 내부 클러스터 인증 활성화된 상태에서 실행 배포에 대한 데이터베이스 사용자 관리를 지원합니다.

Kubernetes Operator는 생성하는 배포에서 SCRAM, LDAP, OpenID Connect 및 X.509 인증 메커니즘을 지원합니다. Kubernetes 연산자가 생성한 배포서버 에서는 MongoDB Ops Manager 사용하여 다음을 수행할 수 없습니다.

  • 배포를 위한 다른 인증 메커니즘을 구성합니다.

  • SCRAM, LDAP 또는 X.509 인증을 사용 하지 않는 사용자를 managed합니다.

X.509 인증 활성화한 후 MongoDB Ops Manager 인터페이스 또는 CustomResourceDefinition을 사용하여 X.509 사용자를 추가할 수 있습니다.

데이터베이스 사용자를 관리하기 전에 TLSX.509가 활성화된 복제본 세트 또는 샤딩된 클러스터 배포 해야 합니다.

MongoDB 사용자를 위한 X.509 인증서를 생성해야 하는 경우 X.509 클라이언트 인증서 생성을 참조하세요.

1

아직 실행하지 않았다면 다음 명령을 실행하여 생성한 네임스페이스에서 kubectl 명령을 모두 실행합니다.

참고

다중 Kubernetes 클러스터 MongoDB deployment에서 MongoDB Ops Manager 리소스를 배포하는 경우:

  • context 를 연산자 클러스터 의 이름으로 설정합니다(예: kubectl config set context "$MDB_CENTRAL_CLUSTER_FULL_NAME").

  • --namespace 를 다중 Kubernetes 클러스터 MongoDB 배포에 사용한 것과 동일한 범위 (예: kubectl config --namespace "mongodb" 로 설정합니다.

kubectl config set-context $(kubectl config current-context) --namespace=<metadata.namespace>
2
---
apiVersion: mongodb.com/v1
kind: MongoDBUser
metadata:
name: <resource-name>
spec:
username: <rfc2253-subject>
db: "$external"
mongodbResourceRef:
name: '<MongoDB-Resource-name>'
roles:
- db: <database-name>
name: <role-name>
...
3
4

다음 표를 사용하여 MongoDB 사용자 리소스 사양의 관련 줄을 변경하는 방법을 안내합니다.

유형
설명
예시

metadata.name

문자열

데이터베이스 사용자 리소스의 이름입니다.

리소스 이름은 44자 이내여야 합니다.

mms-user-1

spec.username

문자열

Kubernetes CA(Kuber CA)가 서명한 x509 클라이언트 인증서의 제목 줄입니다.

중요: 사용자 이름 RFC 2253 LDAPv 고유3 이름 표준을 준수해야 합니다.

X.509 인증서의 제목 줄을 가져오려면 다음 명령을 실행합니다.

openssl x509 -noout \
-subject -in <my-cert.pem> \
-nameopt RFC2253

CN=mms-user,U=My Organizational Unit,O=My Org,L=New York,ST=New York,C=US

spec.opsManager.configMapRef.name

문자열

사용자를 추가할 MongoDB database가 포함된 프로젝트의 이름입니다. spec.cloudManager.configMapRef.name 설정은 이 설정의 별칭이며 대신 사용할 수 있습니다.

my-project

spec.roles.db

문자열

역할 이 작동할 수 있는 데이터베이스입니다.

admin

spec.mongodbResourceRef.name

문자열

이 사용자가 연결된 MongoDB 리소스 의 이름입니다.

my-resource

spec.roles.name

문자열

The name of the role to grant the database user. The role name can be any built-in MongoDB role or custom role that exists in Cloud Manager or Ops Manager.

readWriteAnyDatabase

5

다음 예제에 정의된 형식을 사용하여 이 사용자에게 추가 역할을 부여할 수 있습니다.

---
apiVersion: mongodb.com/v1
kind: MongoDBUser
metadata:
name: mms-user-1
spec:
username: CN=mms-user,U=My Organizational Unit,O=My Org,L=New York,ST=New York,C=US
project: my-project
db: "$external"
roles:
- db: admin
name: backup
- db: admin
name: restore
...
6

다음 Kubernetes 명령을 호출하여 데이터베이스 사용자를 생성합니다.

kubectl apply -f <database-user-conf>.yaml

When you create a new MongoDB database user, Kubernetes Operator automatically creates a new Kubernetes secret. The Kubernetes secret contains the following information about the new database user:

  • username: 데이터베이스 사용자의 사용자 이름

  • password: 데이터베이스 사용자의 비밀번호

  • connectionString.standard: 이 데이터베이스 사용자로 데이터베이스에 연결할 수 있는 표준 연결 string 입니다.

  • connectionString.standardSrv: 이 데이터베이스 사용자로 데이터베이스에 연결할 수 있는 DNS 시드 목록 연결 string 입니다.

참고

또는 MongoDB 사용자 리소스 사양 에 선택 사항인 spec.connectionStringSecretName 필드를 지정하여 Kubernetes 연산자가 생성하는 연결 문자열 시크릿의 이름을 지정할 수 있습니다.

By default, both connection strings omit the database from the URI path, so the database that clients use depends on the client. To set the database in the URI path, specify the optional spec.connectionStringDatabase field.

You can use these credentials to Connect to a MongoDB Resource from Inside Kubernetes.

7

Cloud Manager 또는 Ops Manager에서 새로 생성된 사용자를 볼 수 있습니다.

  1. 프로젝트의 Deployment 보기에서 Security 탭을 클릭합니다.

  2. 중첩된 MongoDB Users 탭을 클릭합니다.

데이터베이스 사용자를 삭제하려면 metadata.name 사용자 ConfigMap 에서 를 전달합니다. 다음 명령에 추가합니다.

kubectl delete mdbu <metadata.name>