- Kubernetesオペレータ・ユーザーズ・ガイド
- アップグレードの実行
- オペレータのアップグレード
オペレータのアップグレード
この項のタスクでは、オペレータを新しいパッチまたはパッチセットにアップグレードする方法を示します。ネームスペース内にデプロイ済のTimesTenClassicおよびTimesTenScaleoutオブジェクトがある場合は、オペレータのアップグレードを実行できます。
まず、Kubernetesクラスタを新しいCRDおよびサービス・アカウントで更新しましょう。
- 開発ホストで、
new_kube_files
ディレクトリに移動します。次に、Kubernetesクラスタで実行されているCRDを置き換えます。cd new_kube_files
kubectl replace -f crd.yaml
出力は次のようになります。
customresourcedefinition.apiextensions.k8s.io/ timestenclassics.timesten.oracle.com/timestenscaleouts.timesten.oracle.com replaced
- サービス・アカウントを置き換えます。
kubectl replace -f service_account.yaml
出力は次のようになります。role.rbac.authorization.k8s.io/timesten-operator replaced serviceaccount/timesten-operator replaced rolebinding.rbac.authorization.k8s.io/timesten-operator replaced
次は、オペレータをアップグレードしましょう。
- (オプション): オペレータが動作中であることを確認します。
kubectl get pods
出力は次のようになります。
NAME READY STATUS RESTARTS AGE sample-0 2/2 Running 0 14h sample-1 2/2 Running 0 14h sample2-0 2/2 Running 0 14h sample2-1 2/2 Running 0 14h timesten-operator-778878dc6b-4mc77 1/1 Running 0 15h
オペレータの名前は
timesten-operator-778878dc6b-4mc77
です。その他のポッドは、ネームスペース内のsample
およびsample2
TimesTenClassicオブジェクトに関連付けられています。 timesten-operator
デプロイメントをアップグレードします。operator.yaml
ファイル内の次のフィールドを編集します:-
replicas:
1
1
を、実行するオペレータのコピーの数に置き換えます。開発およびテストの場合は、値1
を使用できます。ただし、高可用性を確保する目的で、複数のレプリカを実行できます。 -
sekret
を、Kubernetesでレジストリからのイメージのプルに使用する、イメージ・プル・シークレットの名前に置き換えます。 -
新しいTimesTenコンテナ・イメージを参照するように
image
の行を置き換えます。この例では、新しいイメージはcontainer-registry.oracle.com/timesten/timesten:22.1.1.19.0
です。
vi operator.yaml apiVersion: apps/v1 kind: Deployment metadata: name: timesten-operator spec: replicas: 1 selector: matchLabels: name: timesten-operator template: metadata: labels: name: timesten-operator spec: serviceAccountName: timesten-operator imagePullSecrets: - name: sekret containers: - name: timesten-operator image: container-registry.oracle.com/timesten/timesten:22.1.1.19.0 command: - /timesten/operator/operator/timesten-operator imagePullPolicy: Always env: - name: WATCH_NAMESPACE valueFrom: fieldRef: fieldPath: metadata.namespace - name: POD_NAME valueFrom: fieldRef: fieldPath: metadata.name - name: OPERATOR_NAME value: "timesten-operator" securityContext: runAsNonRoot: true privileged: false allowPrivilegeEscalation: false capabilities: drop: - all
-
timesten-operator
デプロイメントを更新します。kubectl replace -f operator.yaml
出力は次のようになります。deployment.apps/timesten-operator replaced
- 新しいオペレータが実行されていることを確認します。
kubectl get pods
出力は次のようになります。
NAME READY STATUS RESTARTS AGE sample-0 2/2 Running 0 15h sample-1 2/2 Running 0 15h sample2-0 2/2 Running 0 15h sample2-1 2/2 Running 0 15h timesten-operator-6f9d96bdfc-h22lm 1/1 Running 0 9s
新しいオペレータの名前は
timesten-operator-6f9d96bdfc-h22lm
です。 - 新しい
timesten-operator
デプロイメントを確認します。kubectl describe deployment timesten-operator
出力は次のようになります。
Name: timesten-operator Namespace: mynamespace CreationTimestamp: Sun, 08 Jan 2023 01:22:28 +0000 Labels: <none> Annotations: deployment.kubernetes.io/revision: 3 Selector: name=timesten-operator Replicas: 1 desired | 1 updated | 1 total | 1 available | 0 unavailable StrategyType: RollingUpdate MinReadySeconds: 0 RollingUpdateStrategy: 25% max unavailable, 25% max surge Pod Template: Labels: name=timesten-operator Service Account: timesten-operator Containers: timesten-operator: Image: container-registry.oracle.com/timesten/timesten:22.1.1.19.0 Port: <none> Host Port: <none> Command: /timesten/operator/operator/timesten-operator Environment: WATCH_NAMESPACE: (v1:metadata.namespace) POD_NAME: (v1:metadata.name) OPERATOR_NAME: timesten-operator Mounts: <none> Volumes: <none> Conditions: Type Status Reason ---- ------ ------ Available True MinimumReplicasAvailable Progressing True NewReplicaSetAvailable OldReplicaSets: <none> NewReplicaSet: timesten-operator-6f9d96bdfc (1/1 replicas created) Events: ...
timesten-operator
デプロイメントが正常に更新されました。新しいオペレータによってcontainer-registry.oracle.com/timesten/timesten:22.1.1.19.0
コンテナ・イメージが使用されており、ネームスペース内の既存のTimesTenClassicおよびTimesTenScaleoutオブジェクトが自動的に管理されています。