Upgrade in Namespace Two

Let's upgrade the TimesTen Operator in the mynamespace2 namespace at namespace-scope.

  1. Switch to namespace two (mynamespace2, in this example).
    kubectl config set-context --current --namespace=mynamespace2

    The output is similar to the following:

    Context "default" modified.
  2. Confirm a TimesTen Operator is running in this namespace.
    kubectl get pods

    The output is similar to the following:

    NAME                                 READY   STATUS    RESTARTS   AGE
    ...
    timesten-operator-577f7fbc6f-h8hj8   1/1     Running   0          12d
    ...
  3. Change to the directory that contains the YAML manifest files for the upgrade. In this example, the new_kube_files/deploy directory contains the files.
    cd new_kube_files/deploy
  4. Replace the required service account, role, and role binding.
    kubectl replace -f service_account.yaml
    The output is similar to the following:
    role.rbac.authorization.k8s.io/timesten-operator replaced
    serviceaccount/timesten-operator replaced
    rolebinding.rbac.authorization.k8s.io/timesten-operator replaced
  5. Make a copy of the service_account_cluster.yaml file for the namespace (service_account_cluster_n2.yaml, in this example).
    cp service_account_cluster.yaml service_account_cluster_n2.yaml
  6. Replace the service_account_cluster_n2.yaml YAML file by doing the following:
    1. (Optional): Display the contents of the service_account_cluster_n2.yaml file.
      cat service_account_cluster_n2.yaml
      The output is similar to the following:
      # 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. Use a text editor to modify the service_account_cluster_n2.yaml file.
      Make the following changes:
      • Locate #namespace, remove #, and replace <NAMESPACE> with the name of your namespace (mynamespace2, in this example).

      • Locate the three occurrences of #name, remove #, and replace <NAMESPACE> with the name of your namespace (mynamespace2, in this example).

      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. Save and close the service_account_cluster_n2.yaml file.
    4. Replace the service_account_cluster_n2.yaml file.
      kubectl replace -f service_account_cluster_n2.yaml
      The output is similar to the following:
      clusterrole.rbac.authorization.k8s.io/timesten-operator-mynamespace2 replaced
      clusterrolebinding.rbac.authorization.k8s.io/timesten-operator-mynamespace2 replaced
  7. Modify the operator.yaml file by doing the following:
    1. Use a text editor to modify the operator.yaml file.

      Replace the following:

      • image: Replace container-registry.oracle.com/timesten/timesten:latest with the name of the image for the upgrade. In this example, the name of the image for the upgrade is container-registry.oracle.com/timesten/timesten:22.1.1.35.0.

      • If you are running in a multi-architecture environment, modify the affinity section, using the same setting you used during installation. This example uses 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. Save and close the operator.yaml file.
  8. Upgrade the TimesTen Operator.
    kubectl replace -f operator.yaml
    The output is the following:
    deployment.apps/timesten-operator replaced
  9. Verify the TimesTen Operator is running.
    kubectl get pods
    The output is similar to the following:
    NAME                                READY   STATUS    RESTARTS   AGE
    ...
    timesten-operator-c4b99bd8f-smjlm   1/1     Running   0          43s
    ...
  10. (Optional) Verify the TimesTen Operator is running the new image.
    kubectl describe deployment timesten-operator | grep Image

    The output is the following:

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

Congratulations! You successfully upgraded the TimesTen Operator in the mynamespace2 namespace at namespace-scope. The Operator is using the container-registry.oracle.com/timesten/timesten:22.1.1.35.0 image and is automatically managing any existing TimesTenClassic objects in this namespace.

To upgrade TimesTenClassic objects in the mynamespace2 namespace, proceed to About Upgrading TimesTen Classic Databases.