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

Atlas Kubernetes Operator 테스트 실행

Atlas Kubernetes Operator 테스트 실행 기능 사용하면 Atlas Kubernetes Operator8S 클러스터 에 해당 사용자 지정 리소스를 적용하여 Atlas 에서 어떤 변경 사항을 적용할지 확인할 수 있습니다. Atlas Kubernetes Operator Atlas 에서 생성/ 업데이트/ 삭제 하려는 모든 리소스 에 대한 이벤트를 전송합니다. 테스트 실행 모드 에서 실행 Atlas Kubernetes Operator 에서 발생하는 이벤트는 '테스트 실행' 이유를 기준으로 필터링할 수 있습니다. 이 기능 Atlas Operator 리소스를 업그레이드할 때유용합니다.

Atlas Kubernetes Operator 테스트 실행 기능 사용하려면 다음을 수행해야 합니다.

  • 새 Kubernetes 또는 OpenShift 클러스터에 액세스 할 수 있습니다.

  • Apply Atlas Kubernetes Operator custom resources to your new Kubernetes cluster. When you apply your resources, make sure you provide a secret with credentials. You need a new cluster, because upgrading CRDs on your existing Kubernetes cluster might leave Atlas Kubernetes Operator unable to reconcile existing custom resources. Moreover, the CRDs that are applied can be a newer version with potential breaking changes.

    참고

    AKO CRD의 한 버전만 특정 Kubernetes 클러스터 에 존재할 수 있습니다. 즉, 새 버전의 Atlas Kubernetes Operator 로 업그레이드를 테스트하려면 드라 실행 실행하기 위해 새 Kubernetes 클러스터 (임시 클러스터 )를 배포 해야 합니다.

  • 테스트 실행하려는 Atlas Kubernetes Operator 의 버전에 해당하는 CRD를 클러스터 에 설치하세요.

  • Kubernetes 클러스터 에서 mongodb-atlas-operator 서비스 계정을 만듭니다.

  • Atlas Kubernetes Operator 사용자 지정 리소스와 관련된 다음 권한을 사용하여 서비스 계정에 대한 역할 및 역할 바인딩을 만듭니다. 이러한 리소스는 수동으로 생성하거나 Atlas CLI사용하여 생성할 수 있습니다.

    • list

    • get

    • create

    • update

    • delete

테스트 실행 프로세스 다음과 같은 메시지 유형을 내보이며, 각 유형은 Normal 또는 Warning 중 하나일 수 있습니다.

  • Would [verb] ([HTTP-Method]) [Atlas resource URL]

    • 지정된 Atlas Kubernetes Operator 리소스 에 대한 설명과 변경 사항이 Atlas 환경에 적용되는 경우 Kubernetes 에 필요한 Kubernetes 프로세스 . 테스트 실행 모드 인 경우, Atlas Kubernetes Operator POST, PATCH, PUT, DELETE와 같이 Atlas 에서 리소스를 생성/ 업데이트/ 삭제 HTTP 동사에 대한 테스트 실행 이벤트만 내보냅니다.
  • Done

    • 추가 테스트 실행 이벤트는 보고되지 않습니다.
  • Finished

    • 테스트 실행 프로세스 실행 Kubernetes 작업이 완료되었습니다.
1

다음 예시 dry-run-job.yaml 파일 에 저장하고 kubectl apply -f dry-run-job.yaml를 실행 하여 클러스터 에 적용 . 그러면 Atlas Kubernetes Operator --dry-run 매개변수를 사용하여 Kubernetes 작업으로 시작됩니다. Atlas Kubernetes Operator 의 모든 조정은 한 번만 실행 되며, Atlas 의 리소스 사양과 상태 간에 변경 사항이 있는 경우 각 리소스 에 대한 이벤트를 발생시킵니다.

Atlas 리소스를 변경하지 않고도 이 명령을 여러 번 실행 수 있습니다.

1apiVersion: batch/v1
2kind: Job
3metadata:
4 name: ako-dry-run
5 namespace: mongodb-atlas-system
6spec:
7 backoffLimit: 1
8 template:
9 spec:
10 containers:
11 - args:
12 - --atlas-domain=https://cloud.mongodb.com/
13 - --log-level=info
14 - --log-encoder=json
15 - --dry-run
16 command:
17 - /manager
18 env:
19 - name: OPERATOR_POD_NAME
20 value: ako-dry-run
21 - name: OPERATOR_NAMESPACE
22 value: mongodb-atlas-system
23 - name: WATCH_NAMESPACE
24 value: mongodb-atlas-system
25 - name: JOB_NAME
26 value: ako-dry-run
27 image: quay.io/mongodb/mongodb-atlas-kubernetes-operator:2.8.0
28 imagePullPolicy: Always
29 livenessProbe:
30 failureThreshold: 3
31 httpGet:
32 path: /healthz
33 port: 8081
34 scheme: HTTP
35 initialDelaySeconds: 15
36 periodSeconds: 20
37 successThreshold: 1
38 timeoutSeconds: 1
39 name: ako-dry-run
40 restartPolicy: Never
41 serviceAccountName: mongodb-atlas-operator
2

Kubernetes 작업이 완료되면 다음 명령을 실행 하여 방출된 이벤트를 나열할 수 있습니다.

kubectl -n mongodb-atlas-system get events --field-selector reason=DryRun

이 명령은 다음과 유사한 출력을 반환합니다.

LAST SEEN TYPE REASON OBJECT MESSAGE
103s Normal DryRun atlasproject/my-project Would delete (DELETE) /api/atlas/v1.0/groups/6558f184beba40022cbb2043/integrations/SLACK
101s Warning DryRun atlasproject/my-project finished dry run

--log-level 을(를) debug(으)로 설정하다 Atlas Kubernetes Operator Atlas Kubernetes Operator 를 managed Atlas 리소스에 적용한 변경 사항에 대한 자세한 차이점을 제공합니다. 이 차이점은 Atlas Kubernetes Operator 사용자 지정 리소스의 현재 상태 와 Atlas Kubernetes Operator Atlas 환경에 적용 할 상태 간의 차이를 확인할 수 있는 테스트 실행 기능 과 함께 사용할 때 특히 유용합니다.

이 기능 Atlas 로 전송된 PUT 또는 PATCH 요청의 결과를 Atlas 환경에 있는 Atlas Kubernetes Operator 사용자 지정 리소스의 현재 상태 와 비교하여 알려집니다.

참고

이러한 비교를 용이하게 하기 위해, Atlas Kubernetes Operator Atlas 에 GET 요청 보내 Atlas 의 현재 리소스 상태 학습 . 따라서 로그 수준을 디버그로 설정하다 비프로덕션 환경에서만 설정하는 것이 좋습니다. 이 기능 Atlas 의 부하를 증가시킬 수 있습니다.

차이점을 확인하려면 Atlas Kubernetes Operator 명령을 실행 때 --log-level=debug 플래그를 설정하다 해야 합니다. Atlas Kubernetes Operator 구조화된 로깅을 사용하므로 사람의 가독성을 높이기 위해 구조화된 로깅 뷰어에서 JSON diff를 분석하는 것이 좋습니다. 다음 예시 구조화된 로깅 뷰어에 표시되는 YAML 형식의 렌더링된 Atlas Kubernetes Operator DEBUG 로그 줄을 보여줍니다.

apiVersion: atlas.mongodb.com/v1
kind: AtlasDeployment
metadata:
name: test
namespace: flex
spec:
flexSpec:
name: test
providerSettings:
backingProviderName: AWS
regionName: US_EAST_1
terminationProtectionEnabled: true -> false
projectRef:
name: test