ネームスペース2でのアップグレード

ネームスペーススコープのmynamespace2ネームスペースのTimesTenオペレータをアップグレードします。

  1. ネームスペース2に切り替えます(この例ではmynamespace2)。
    kubectl config set-context --current --namespace=mynamespace2

    出力は、次のようになります。

    Context "default" modified.
  2. このネームスペースでTimesTenオペレータが実行されていることを確認します。
    kubectl get pods

    出力は、次のようになります。

    NAME                                 READY   STATUS    RESTARTS   AGE
    ...
    timesten-operator-577f7fbc6f-h8hj8   1/1     Running   0          12d
    ...
  3. アップグレード用のYAMLマニフェスト・ファイルを含むディレクトリに移動します。この例では、new_kube_files/deployディレクトリにこのファイルが含まれています。
    cd new_kube_files/deploy
  4. 必要なサービス・アカウント、ロールおよびロール・バインディングを置き換えます。
    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
  5. ネームスペース(この例ではservice_account_cluster_n2.yaml)のservice_account_cluster.yamlファイルのコピーを作成します。
    cp service_account_cluster.yaml service_account_cluster_n2.yaml
  6. 次の手順を実行して、service_account_cluster_n2.yaml YAMLファイルを置き換えます:
    1. (オプション): service_account_cluster_n2.yamlファイルの内容を表示します。
      cat service_account_cluster_n2.yaml
      出力は、次のようになります。
      # Copyright (c) 2025, Oracle and/or its affiliates.
      apiVersion: rbac.authorization.k8s.io/v1
      kind: ClusterRole
      metadata:
        name: timesten-operator
        # If running multiple operators on the same cluster:
        #name: timesten-operator-<NAMESPACE>
      rules:
      - apiGroups:
        - ""
        resources:
        - nodes
        verbs:
        - get
        - list
        - watch
      - apiGroups:
        - ""
        resources:
        - persistentvolumeclaims
        verbs:
        - get
        - list
        - watch
        - delete
      ---
      kind: ClusterRoleBinding
      apiVersion: rbac.authorization.k8s.io/v1
      metadata:
        name: timesten-operator
        # If running multiple operators on the same cluster:
        #name: timesten-operator-<NAMESPACE>
      subjects:
      - kind: ServiceAccount
        name: timesten-operator
        #namespace: <NAMESPACE>
      roleRef:
        kind: ClusterRole
        name: timesten-operator
        # If running multiple operators on the same cluster:
        #name: timesten-operator-<NAMESPACE>
        apiGroup: rbac.authorization.k8s.io
    2. テキスト・エディタを使用して、service_account_cluster_n2.yamlファイルを変更します。
      必要な変更を加えます:
      • #namespaceを見つけ、#を削除し、<NAMESPACE>を実際のネームスペースの名前(この例ではmynamespace2)に置き換えます。

      • #nameの3つの出現箇所を見つけて#を削除し、<NAMESPACE>を実際のネームスペースの名前(この例ではmynamespace2)に置き換えます。

      vi service_account_cluster_n2.yaml
      
      # Copyright (c) 2025, Oracle and/or its affiliates.
      apiVersion: rbac.authorization.k8s.io/v1
      kind: ClusterRole
      metadata:
        name: timesten-operator
        # If running multiple operators on the same cluster:
        name: timesten-operator-mynamespace2
      rules:
      - apiGroups:
        - ""
        resources:
        - nodes
        verbs:
        - get
        - list
        - watch
      - apiGroups:
        - ""
        resources:
        - persistentvolumeclaims
        verbs:
        - get
        - list
        - watch
        - delete
      ---
      kind: ClusterRoleBinding
      apiVersion: rbac.authorization.k8s.io/v1
      metadata:
        name: timesten-operator
        # If running multiple operators on the same cluster:
        name: timesten-operator-mynamespace2
      subjects:
      - kind: ServiceAccount
        name: timesten-operator
        namespace: mynamespace2
      roleRef:
        kind: ClusterRole
        name: timesten-operator
        # If running multiple operators on the same cluster:
        name: timesten-operator-mynamespace2
        apiGroup: rbac.authorization.k8s.io
    3. service_account_cluster_n2.yamlファイルを保存して閉じます。
    4. service_account_cluster_n2.yamlファイルを置き換えます。
      kubectl replace -f service_account_cluster_n2.yaml
      出力は、次のようになります。
      clusterrole.rbac.authorization.k8s.io/timesten-operator-mynamespace2 replaced
      clusterrolebinding.rbac.authorization.k8s.io/timesten-operator-mynamespace2 replaced
  7. 次の手順を実行して、operator.yamlファイルを変更します:
    1. テキスト・エディタを使用して、operator.yamlファイルを変更します。

      次のように置き換えます:

      • image: container-registry.oracle.com/timesten/timesten:latestをアップグレード用のイメージの名前に置き換えます。この例では、アップグレード用のイメージの名前はcontainer-registry.oracle.com/timesten/timesten:22.1.1.35.0です。

      • マルチアーキテクチャ環境で実行している場合は、インストール時に使用した設定を使用して、affinityセクションを変更します。この例では、amd64を使用します。

      vi operator.yaml
      
      # Copyright (c) 2019 - 2025, Oracle and/or its affiliates.
      apiVersion: apps/v1
      kind: Deployment
      metadata:
        name: timesten-operator
      spec:
        replicas: 1
      ...
          spec:
            serviceAccountName: timesten-operator
            imagePullSecrets:
            - name: sekret
            containers:
              - name: timesten-operator
                image: container-registry.oracle.com/timesten/timesten:22.1.1.35.0
      ...
      # An example affinity definition; this pod will only be assigned to a node
      # running on amd64 (the default)
      #
            affinity:
              nodeAffinity:
                requiredDuringSchedulingIgnoredDuringExecution:
                  nodeSelectorTerms:
                    - matchExpressions:
                      - key: "kubernetes.io/arch"
                        operator: In
                        values: ["amd64"]
    2. operator.yamlファイルを保存し、閉じます。
  8. TimesTenオペレータのアップグレード
    kubectl replace -f operator.yaml
    出力は次のようになります。
    deployment.apps/timesten-operator replaced
  9. TimesTenオペレータが実行されていることを確認します。
    kubectl get pods
    出力は、次のようになります。
    NAME                                READY   STATUS    RESTARTS   AGE
    ...
    timesten-operator-c4b99bd8f-smjlm   1/1     Running   0          43s
    ...
  10. (オプション) TimesTenオペレータが新しいイメージを実行していることを確認します。
    kubectl describe deployment timesten-operator | grep Image

    出力は次のようになります。

    Image:       container-registry.oracle.com/timesten/timesten:22.1.1.35.0

おめでとうございます。ネームスペーススコープのmynamespace2ネームスペースのTimesTenオペレータが正常にアップグレードされました。オペレータによってcontainer-registry.oracle.com/timesten/timesten:22.1.1.35.0イメージが使用されており、このネームスペース内の既存のTimesTenClassicオブジェクトが自動的に管理されています。

mynamespace2ネームスペースのTimesTenClassicオブジェクトをアップグレードするには、「TimesTen Classicデータベースのアップグレードについて」に進みます。