AI エージェント向け: ドキュメントインデックスは https://www.mongodb.com/ja-jp/docs/llms.txt で利用できます。すべてのページの markdown バージョンは、いずれかの URL パスに .md を追加することで利用できます。
Docs Menu

Kubernetes Operator 用のMongoDBコントロールのアップグレード

次の手順では、Kubernetes Operator を最新バージョンにアップグレードする方法の概要を説明します。 このアップグレード プロセスは、Kubernetes Operator のインストール プロセスと並行して行われます。

注意

全体で同じ名前空間を使用する

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
---
...
1

重大な変更を避けるため、既存の配置の設定と同じ設定を選択していることを確認する必要があります。 任意の Kubernetes Operator インストール設定の詳細については、「 Operator Helm のインストール設定 」を参照してください。

2

<version>プレースホルダーにデータを入力し、次のkubectlコマンドを実行して、選択したバージョンの Kubernetes Operator を Kubernetes クラスターに配置します。

kubectl apply -f https://raw.githubusercontent.com/mongodb/mongodb-kubernetes/1.4.0/public/mongodb-kubernetes.yaml
3

<version>プレースホルダーにデータを入力し、次のkubectlコマンドを実行して、選択したバージョンの CRD を Kubernetes クラスターに配置します。

kubectl apply -f https://raw.githubusercontent.com/mongodb/mongodb-kubernetes/1.4.0/public/crds.yaml

Kubernetes用のMongoDB Helm Charts を使用します。

1

現在の Helm テンプレートのバージョンを確認するには、次のコマンドを実行します。

helm search repo mongodb/mongodb-kubernetes

現在インストールされているバージョンが最新リリースでない場合は、次のコマンドを実行して Helm リポジトリを更新します。

helm repo update mongodb

Helm リポジトリがローカルにインストールされていない場合は、次のコマンドを実行してインストールできます。

helm repo add mongodb https://mongodb.github.io/helm-charts
2

重大な変更を避けるため、既存の配置の設定と同じ設定を選択していることを確認する必要があります。 任意の Kubernetes Operator インストール設定の詳細については、「 Operator Helm のインストール設定 」を参照してください。

3

<version>プレースホルダーにデータを入力し、次のkubectlコマンドを実行して CRD を Kubernetes クラスターに配置します。

kubectl apply -f https://raw.githubusercontent.com/mongodb/mongodb-kubernetes/1.4.0/public/crds.yaml
4

次のhelmコマンドを実行して、Kubernetes Operator を Kubernetes クラスター内のデフォルトの名前空間に配置します。

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

次の手順は、環境の構成方法によって異なります。

注意

全体で同じ名前空間を使用する

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
---
...
1

重大な変更を避けるため、既存の配置の設定と同じ設定を選択していることを確認する必要があります。 任意の Kubernetes Operator インストール設定の詳細については、「 Operator Helm のインストール設定 」を参照してください。

以下のように、 <openshift-pull-secret>ServiceAccountの定義に追加する必要があります。

---
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>
2

<version> プレースホルダーにデータを入力し、次の OC を実行します。

oc apply -f https://raw.githubusercontent.com/mongodb/mongodb-kubernetes/1.4.0/public/mongodb-kubernetes-openshift.yaml
3

次の OC コマンドを実行します。

<version> プレースホルダーにデータを入力し、次の oc コマンドを実行して、選択したバージョンの CRD をKubernetesクラスターに配置します。

oc apply -f https://raw.githubusercontent.com/mongodb/mongodb-kubernetes/1.4.0/public/crds.yaml
1

現在の Helm テンプレートのバージョンを確認するには、次のコマンドを実行します。

helm search repo mongodb/mongodb-kubernetes

現在インストールされているバージョンが最新リリースでない場合は、次のコマンドを実行して Helm リポジトリを更新します。

helm repo update mongodb

Helm リポジトリがローカルにインストールされていない場合は、次のコマンドを実行してインストールできます。

helm repo add mongodb https://mongodb.github.io/helm-charts
2

重大な変更を避けるため、既存の配置の設定と同じ設定を選択していることを確認する必要があります。 任意の Kubernetes Operator インストール設定の詳細については、「 Operator Helm のインストール設定 」を参照してください。

3

<version>プレースホルダーにデータを入力し、次のkubectlコマンドを実行して CRD を Kubernetes クラスターに配置します。

kubectl apply -f https://raw.githubusercontent.com/mongodb/mongodb-kubernetes/1.4.0/public/crds.yaml
4

次のhelmコマンドを実行して、Kubernetes Operator を Kubernetes クラスター内のデフォルトの名前空間に配置します。

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 Operator のトラブルシューティングについては、「 Kubernetes Operator からのログの確認 」やその他のトラブルシューティング トピックを参照してください。

重要

Kubernetes Operator または名前空間を削除する必要がある場合は、まずMongoDB リソースを削除する必要があります。

Kubernetes Operator が正しくインストールされたことを確認するには、次のコマンドを実行し、出力を確認します。

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 Operator のトラブルシューティングについては、「 Kubernetes Operator からのログの確認 」やその他のトラブルシューティング トピックを参照してください。

重要

Kubernetes Operator または名前空間を削除する必要がある場合は、まずMongoDB リソースを削除する必要があります。

MongoDB Controls for Kubernetes Operator をアップグレードすると、次のことが可能になります。