Docs Menu
Docs Home
/
MongoDB Enterprise Kubernetes 연산자
/

OpenShift 빠른 시작

이 페이지의 내용

중요

이 섹션은 단일 Kubernetes 클러스터 배포에만 적용됩니다. 다중 Kubernetes 클러스터 MongoDB 배포의 경우 다중 Kubernetes 클러스터 빠른 시작 을 참조하세요.

MongoDB Enterprise Kubernetes Operator는 Kubernetes API와 도구를 사용하여 MongoDB 클러스터를 관리합니다. Kubernetes Operator는 MongoDB Cloud Manager 또는 Ops Manager와 함께 작동합니다. 이 튜토리얼에서는 OpenShift의 Cloud Manager 또는 Ops Manager에서 첫 번째 복제본 세트를 배포하고 연결하는 방법과 Kubernetes Operator를 사용하는 방법을 설명합니다.

이 튜토리얼에는 다음이 필요합니다.

  • 실행 중인 Cloud Manager 또는 Ops Manager 클러스터.

1
git clone https://github.com/mongodb/mongodb-enterprise-kubernetes.git
2

기본적으로 Kubernetes Operator는 mongodb 네임스페이스를 사용합니다. 설치를 간소화하려면 다음 mongodb kubectl 을 사용하여 로 레이블된 네임스페이스를 생성하는 것이 좋습니다. 명령:

kubectl create namespace mongodb
3

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

kubectl config set-context $(kubectl config current-context) --namespace=mongodb
4
  1. 다음 oc 명령을 실행하여 MongoDB 배포를 위한 CustomResourceDefinitions 을 설치합니다:

    oc apply -f crds.yaml
  2. MongoDB Enterprise Kubernetes Operator YAML 파일의 ServiceAccount 정의에 <openshift-pull-secret> 를 추가하세요.

    ---
    # Source: mongodb-enterprise-operator/templates/serviceaccount.yaml
    ---
    apiVersion: v1
    kind: ServiceAccount
    metadata:
    name: enterprise-operator
    namespace: mongodb
    imagePullSecrets:
    - name: <openshift-pull-secret>
    ---
    apiVersion: v1
    kind: ServiceAccount
    metadata:
    name: mongodb-enterprise-appdb
    namespace: mongodb
    imagePullSecrets:
    - name: <openshift-pull-secret>
    ---
    apiVersion: v1
    kind: ServiceAccount
    metadata:
    name: mongodb-enterprise-database-pods
    namespace: mongodb
    imagePullSecrets:
    - name: <openshift-pull-secret>
  3. 다음 oc 명령을 호출하여 Kubernetes Operator를 설치합니다.

    oc apply -f mongodb-enterprise-openshift.yaml
5

다음 명령을 실행합니다:

참고

다음 매개변수에 대한 공개 키 및 개인 키 값을 입력합니다. 자세한 내용은 Kubernetes Operator에 대한 자격 증명 생성을 참조하세요.

kubectl -n mongodb \
create secret generic ops-manager-admin-key \
--from-literal="publicKey=<publicKey>" \
--from-literal="privateKey=<privateKey>"
6
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: ConfigMap
metadata:
name: my-project
namespace: mongodb
data:
projectName: myProjectName # this is an optional parameter; when omitted, the Operator creates a project with the resource name
orgId: 5b890e0feacf0b76ff3e7183 # this is a required parameter
baseUrl: https://ops.example.com:8443
EOF
유형
설명
예시
metadata.name
문자열

Kubernetes 객체 의 이름 .

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

학습 내용은 이름 에 대한 Kubernetes 문서를 참조하세요. . 이 이름은 RFC1123 를 따라야 합니다. 명명 규칙에 따라- .소문자 영숫자 또는 만 사용하며 시작과 끝이 영숫자로 끝나야 합니다.

my-project
metadata.namespace
문자열
Kubernetes 네임스페이스 여기서 Kubernetes Operator는 MongoDB 리소스 및 기타 객체 를 생성합니다. .
mongodb
data.projectName
문자열

Ops Manager 프로젝트의레이블입니다.

Kubernetes Operator는 MongoDB Ops Manager 프로젝트가 없는 경우 이를 생성합니다. projectName 을 생략하면 Kubernetes Operator가 Kubernetes 리소스와 동일한 이름으로 프로젝트를 생성합니다.

Cloud Manager 또는 Ops Manager 조직의 기존 프로젝트를 사용하려면 Cloud Manager 또는 Ops Manager 페이지의 왼쪽 상단에 있는 All Clusters 링크를 클릭하고 에서 이름으로 검색하여 projectName 를 찾습니다. Search 상자를 클릭하거나 스크롤하여 목록에서 이름을 찾습니다. 이 목록의 각 카드는 하나의 Cloud Manager 또는 Ops Manager 조직프로젝트 의 조합을 나타냅니다.

myProjectName
data.orgId
문자열

필수. 또는 MongoDB Ops Manager 조직을 고유하게 식별하는24 문자 16진수 입니다.string Cloud Manager

Kubernetes Operator를 사용하여 Cloud Manager 및 Ops Manager 버전 6.0.x 이상과 함께 MongoDB 리소스를 배포할 수 있습니다.

Atlas Operator 를 사용하여 Atlas에 MongoDB 리소스를 배포할 수 있습니다.

기존 조직을 지정합니다:

  1. 조직의 ID를 찾습니다.

    왼쪽 탐색 창에서 Settings 을 클릭합니다.

  2. orgId를 복사하여 URL에 붙여넣습니다.

    조직을 선택하고 브라우저에서 현재 URL을 확인한 후 다음과 같이 <orgId> 자리 표시자에 표시된 값을 복사합니다.

    https://ops.example.com:8443/ v2#/org/<orgId>/projects

기존 Cloud Manager 또는 Ops Manager 조직 내에서 새 프로젝트를 생성하려면 Organization Project Creator 역할이 있어야 합니다.

orgId 형식으로 빈 문자열을 제공하면 Kubernetes Operator가 프로젝트와 동일한 이름으로 조직을 생성합니다.

5b890e0feacf0b76ff3e7183
data.baseUrl
문자열

FQDN 및 포트 번호를 포함한 Ops Manager 애플리케이션의 URL을 입력합니다.

중요: MongoDB Ops Manager Kubernetes Operator를 사용하여 를 배포 하고 가 배포된 MongoDB Ops Manager MongoDB 클러스터 외부 에 배포된 데이터베이스 리소스를 관리 하는 경우, Kubernetes data.baseUrl 을(를) 설정과 동일한 값으로 spec.configuration.mms.centralUrl MongoDB Ops Manager 설정하다 해야 합니다. 리소스 사양. 학습 내용은 외부 MongoDB 배포 관리를 참조하세요.

클라우드 관리자를 사용하는 경우 data.baseUrl 값을 https://cloud.mongodb.com로 설정합니다.

https://ops.example.com:8443
7
  1. 다음 YAML 파일을 복사하고 저장합니다.

    apiVersion: mongodb.com/v1
    kind: MongoDB
    metadata:
    name: demo-mongodb-cluster-1
    namespace: mongodb
    spec:
    members: 3
    version: 4.4.5-ent
    type: ReplicaSet
    security:
    authentication:
    enabled: true
    modes: ["SCRAM"]
    cloudManager:
    configMapRef:
    name: my-project
    credentials: organization-secret
    persistent: true
    podSpec:
    podTemplate:
    spec:
    containers:
    - name: mongodb-enterprise-database
    resources:
    limits:
    cpu: 2
    memory: 1.5G
    requests:
    cpu: 1
    memory: 1G
    persistence:
    single:
    storage: 10Gi
  2. 다음 명령을 실행합니다:

    kubectl apply -f <replica-set-conf>.yaml
8

일반 텍스트 비밀번호 또는 Base64로 인코딩된 비밀번호를 사용할 수 있습니다. 일반 텍스트 암호는 stringData.password 을 사용하고 Base64로 인코딩된 암호는 data.password을 사용합니다.

참고

다음 매개변수에 대한 값을 입력합니다. 자세한 내용은 파라미터 설명을 참조하십시오.

일반 텍스트 비밀번호의 경우 다음 YAML 파일을 만들어 저장합니다:

apiVersion: v1
kind: Secret
metadata:
name: mms-user-1-password
# corresponds to user.spec.passwordSecretKeyRef.name
type: Opaque
stringData:
password: <my-plain-text-password>
# corresponds to user.spec.passwordSecretKeyRef.key

Base64로 인코딩된 비밀번호의 경우 다음 YAML 파일을 만들어 저장합니다:

apiVersion: v1
kind: Secret
metadata:
name: mms-user-1-password
# corresponds to user.spec.passwordSecretKeyRef.name
type: Opaque
data:
password: <base-64-encoded-password>
# corresponds to user.spec.passwordSecretKeyRef.key
9
  1. 다음 MongoDB 사용자 리소스 사양 파일을 복사하여 저장합니다.

    apiVersion: mongodb.com/v1
    kind: MongoDBUser
    metadata:
    name: mms-scram-user-1
    spec:
    passwordSecretKeyRef:
    name: mms-user-1-password
    # Match to metadata.name of the User Secret
    key: password
    username: "mms-scram-user-1"
    db: "admin" #
    mongodbResourceRef:
    name: "demo-mongodb-cluster-1"
    # Match to MongoDB resource using authenticaiton
    roles:
    - db: "admin"
    name: "clusterAdmin"
    - db: "admin"
    name: "userAdminAnyDatabase"
    - db: "admin"
    name: "readWrite"
    - db: "admin"
    name: "userAdminAnyDatabase"
  2. 다음 명령을 실행합니다:

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

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

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

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

11

Cloud Manager 애플리케이션에서 다음 단계를 수행합니다.

  1. 왼쪽 탐색에서 Deployment을 클릭합니다.

  2. 연결하려는 배포서버의 을 클릭합니다.

  3. Connect to this instance를 클릭합니다.

  4. 터미널에서 연결 명령을 실행하여 배포에 연결합니다.

돌아가기

OpenShift 튜토리얼