다음 절차에서는 Kubernetes Operator를 최신 버전으로 업그레이드 하는 방법을 간략하게 설명합니다. 이 업그레이드 프로세스 는 Kubernetes Operator 설치 프로세스 와 유사합니다.
Kubernetes 에서 실행되는 Kubernetes Operator용 MongoDB 컨트롤러 업그레이드
참고
전체적으로 동일한 네임스페이스 사용
By default, the Kubernetes Operator deploys all resources in your Kubernetes cluster to the namespace mongodb. You can deploy Kubernetes Operator resources to a different namespace by editing all values for metadata.namespace in mongodb-kubernetes.yaml. You must also update the subjects[0].namespace value in every RoleBinding and ClusterRoleBinding in the same file. If you omit this value, the bindings look for the ServiceAccount in the default mongodb namespace and can't find it:
apiVersion: v1 kind: ServiceAccount metadata: name: mongodb-kubernetes-operator namespace: production apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: mongodb-kubernetes-operator namespace: production roleRef: apiGroup: rbac.authorization.k8s.io kind: Role name: mongodb-kubernetes-operator subjects: - kind: ServiceAccount name: mongodb-kubernetes-operator namespace: production apiVersion: apps/v1 kind: Deployment metadata: name: mongodb-kubernetes-operator namespace: production # Example truncated ...
Customize your Kubernetes Operator YAML before upgrading it.
호환성이 손상되는 변경을 방지하려면 기존 배포서버 와 동일한 설정을 선택해야 합니다. 선택적 Kubernetes 연산자 설치 설정에 학습 보려면 연산자 Helm 설치 설정을 참조하세요.
Kubernetes 용 MongoDB Helm Charts사용합니다.
Update to the latest version of the MongoDB Helm Charts for Kubernetes.
다음 명령을 실행하여 현재 Helm 템플릿의 버전을 확인합니다.
helm search repo mongodb/mongodb-kubernetes
현재 설치된 버전이 최신 릴리스 가 아닌 경우 다음 명령을 실행 하여 Helm 리포지토리를 업데이트 합니다.
helm repo update mongodb
Helm 리포지토리가 로컬에 설치되어 있지 않은 경우 다음을 실행 하여 설치할 수 있습니다.
helm repo add mongodb https://mongodb.github.io/helm-charts
Helm 차트를 사용자 지정하기 전에 업그레이드하세요.
호환성이 손상되는 변경을 방지하려면 기존 배포서버 와 동일한 설정을 선택해야 합니다. 선택적 Kubernetes 연산자 설치 설정에 학습 보려면 연산자 Helm 설치 설정을 참조하세요.
Kubernetes Operator를 업그레이드합니다.
다음 helm 명령을 실행하여 Kubernetes 클러스터 의 기본값 네임스페이스 에 Kubernetes Operator를 배포 합니다.
helm upgrade mongodb-kubernetes-operator mongodb/mongodb-kubernetes
다음과 같이 --namespace 및 --namespace-create 플래그를 전달하여 기본이 아닌 네임스페이스 에 Kubernetes Operator를 배포 수 있습니다.
helm upgrade mongodb-kubernetes-operator mongodb/mongodb-kubernetes \ --namespace mongodb \ --create-namespace
OpenShift 에서 실행되는 Kubernetes Operator용 MongoDB 컨트롤러 업그레이드
다음 단계는 환경이 구성된 방식에 따라 달라집니다:
참고
전체적으로 동일한 네임스페이스 사용
By default, the Kubernetes Operator deploys all resources in your Kubernetes cluster to the namespace mongodb. You can deploy Kubernetes Operator resources to a different namespace by editing all values for metadata.namespace in mongodb-kubernetes-openshift.yaml. You must also update the subjects[0].namespace value in every RoleBinding and ClusterRoleBinding in the same file. If you omit this value, the bindings look for the ServiceAccount in the default mongodb namespace and can't find it:
apiVersion: v1 kind: ServiceAccount metadata: name: mongodb-kubernetes-operator namespace: production apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: mongodb-kubernetes-operator namespace: production roleRef: apiGroup: rbac.authorization.k8s.io kind: Role name: mongodb-kubernetes-operator subjects: - kind: ServiceAccount name: mongodb-kubernetes-operator namespace: production apiVersion: apps/v1 kind: Deployment metadata: name: mongodb-kubernetes-operator namespace: production # Example truncated ...
업그레이드하기 전에 Kubernetes 연산자 YAML 을 사용자 지정합니다.
호환성이 손상되는 변경을 방지하려면 기존 배포서버 와 동일한 설정을 선택해야 합니다. 선택적 Kubernetes 연산자 설치 설정에 학습 보려면 연산자 Helm 설치 설정을 참조하세요.
ServiceAccount 정의에 <openshift-pull-secret> 를 추가해야 합니다.
apiVersion: v1 kind: ServiceAccount metadata: name: enterprise-operator namespace: mongodb imagePullSecrets: - name: <openshift-pull-secret> apiVersion: v1 kind: ServiceAccount metadata: name: mongodb-kubernetes-appdb namespace: mongodb imagePullSecrets: - name: <openshift-pull-secret> apiVersion: v1 kind: ServiceAccount metadata: name: mongodb-kubernetes-database-pods namespace: mongodb imagePullSecrets: - name: <openshift-pull-secret>
새 버전의 Kubernetes 연산자로 업그레이드합니다.
<version> 자리 표시자를 채우고 다음 oc를 실행 .
oc apply -f https://raw.githubusercontent.com/mongodb/mongodb-kubernetes/1.4.0/public/mongodb-kubernetes-openshift.yaml
Upgrade the CustomResourceDefinitions for MongoDB deployments.
다음 oc 명령을 실행합니다.
<version> 자리 표시자를 채우고 다음 oc 명령을 실행 선택한 버전의 CRD를 Kubernetes 클러스터에 배포.
oc apply -f https://raw.githubusercontent.com/mongodb/mongodb-kubernetes/1.4.0/public/crds.yaml
Update to the latest version of the MongoDB Helm Charts for Kubernetes.
다음 명령을 실행하여 현재 Helm 템플릿의 버전을 확인합니다.
helm search repo mongodb/mongodb-kubernetes
현재 설치된 버전이 최신 릴리스 가 아닌 경우 다음 명령을 실행 하여 Helm 리포지토리를 업데이트 합니다.
helm repo update mongodb
Helm 리포지토리가 로컬에 설치되어 있지 않은 경우 다음을 실행 하여 설치할 수 있습니다.
helm repo add mongodb https://mongodb.github.io/helm-charts
Helm 차트를 사용자 지정하기 전에 업그레이드하세요.
호환성이 손상되는 변경을 방지하려면 기존 배포서버 와 동일한 설정을 선택해야 합니다. 선택적 Kubernetes 연산자 설치 설정에 학습 보려면 연산자 Helm 설치 설정을 참조하세요.
Kubernetes Operator를 업그레이드합니다.
다음 helm 명령을 실행하여 Kubernetes 클러스터 의 기본값 네임스페이스 에 Kubernetes Operator를 배포 합니다.
helm upgrade mongodb-kubernetes-operator mongodb/mongodb-kubernetes
다음과 같이 --namespace 및 --namespace-create 플래그를 전달하여 기본이 아닌 네임스페이스 에 Kubernetes Operator를 배포 수 있습니다.
helm upgrade mongodb-kubernetes-operator mongodb/mongodb-kubernetes \ --namespace mongodb \ --create-namespace
Kubernetes 연산자 문제를 해결하려면 Kubernetes 연산자 의 로그 검토 및 기타 문제 해결 주제를 참조하세요.
중요
Kubernetes Operator 또는 네임스페이스 를 제거해야 하는 경우 먼저 MongoDB 리소스를 제거해야 합니다.
설치 확인
Kubernetes 연산자가 올바르게 설치되었는지 확인하려면 다음 명령을 실행하고 출력을 확인합니다.
kubectl describe deployments mongodb-kubernetes-operator -n <metadata.namespace>
oc describe deployments mongodb-kubernetes-operator -n <metadata.namespace>
기본적으로 배포는 mongodb 네임스페이스에 존재합니다. 다음 오류 메시지가 나타나면 올바른 네임스페이스를 사용하고 있는지 확인합니다.
Error from server (NotFound): deployments.apps "mongodb-kubernetes-operator" not found
Kubernetes 연산자 문제를 해결하려면 Kubernetes 연산자 의 로그 검토 및 기타 문제 해결 주제를 참조하세요.
중요
Kubernetes Operator 또는 네임스페이스 를 제거해야 하는 경우 먼저 MongoDB 리소스를 제거해야 합니다.
다음 단계
Kubernetes Operator용 MongoDB 컨트롤러를 업그레이드한 후 다음을 수행할 수 있습니다.