Upgrading Google Distributed Cloud

Upgrading Google Distributed Cloud

When you install a new version of bmctl, you can upgrade your existing clusters that were created with an earlier version. Upgrading a cluster to the latest Google Distributed Cloud version brings added features and fixes to your cluster. It also ensures that your cluster remains supported. You can upgrade admin, hybrid, standalone, or user clusters with the bmctl upgrade cluster command.

Preflight checks are run before a cluster upgrade to validate cluster status and node health.

The following examples show the upgrade process from the initial version, 1.6.0, to Google Distributed Cloud 1.6.1.

You can upgrade 1.6.1 to 1.6.2 in the same fashion. Skip upgrades (1.6.0 to 1.6.2) are also supported.

Upgrading admin, standalone, or hybrid clusters Google Distributed Cloud

When you download and install a new version of bmctl, you can upgrade your admin, hybrid, and standalone clusters created with an earlier version. For a given version of bmctl, clusters can be upgraded to the same version only.

First, you download the latest bmctl, then modify the appropriate cluster config files, and then you issue the bmctl upgrade cluster command to complete the upgrade.

  1. Download the latest bmctl from the Cloud Storage bucket:
    gcloud storage cp gs://anthos-baremetal-release/bmctl/1.6.2/linux-amd64/bmctl bmctl
    chmod a+x bmctl
    
  2. Modify the cluster config YAML file to change the Google Distributed Cloud cluster version from 1.6.1 to 1.6.2. The following shows an example from an admin cluster config:
  3. ---
    apiVersion: baremetal.cluster.gke.io/v1
    kind: Cluster
    metadata:
      name: cluster1
      namespace: cluster-cluster1
    spec:
      # Cluster type. This can be:
      #   1) admin:  to create an admin cluster. This can later be used to create user clusters.
      #   2) user:   to create a user cluster. Requires an existing admin cluster.
      #   3) hybrid: to create a hybrid cluster that runs admin cluster components and user workloads.
      #   4) standalone: to create a cluster that manages itself, runs user workloads, but does not manage other clusters.
      type: admin
      # Anthos cluster version.
      # Change the following line from 1.6.0 to 1.6.1, shown below
      anthosBareMetalVersion: 1.6.1
  4. Use the bmctl upgrade cluster command to complete the upgrade, where CLUSTER_NAME is the name of your cluster and ADMIN_KUBECONFIG specifies the path to the admin cluster kubeconfig file:
  5. bmctl upgrade cluster -c CLUSTER_NAME --kubeconfig ADMIN_KUBECONFIG
    

Upgrading a user cluster

Once you have successfully upgraded an admin, hybrid, or standalone cluster, you can upgrade the user cluster it manages.

First modify the appropriate user cluster config file, then issue the kubectl apply command to apply the revised config file and complete the upgrade.

  1. Modify the user cluster config YAML file to change the Google Distributed Cloud cluster version from 1.6.0 to 1.6.1
  2. ---
    apiVersion: baremetal.cluster.gke.io/v1
    kind: Cluster
    metadata:
      name: cluster1
      namespace: cluster-cluster1
    spec:
      # Cluster type. This can be:
      #   1) admin:  to create an admin cluster. This can later be used to create user clusters.
      #   2) user:   to create a user cluster. Requires an existing admin cluster.
      #   3) hybrid: to create a hybrid cluster that runs admin cluster components and user workloads.
      #   4) standalone: to create a cluster that manages itself, runs user workloads, but does not manage other clusters.
      type: user
      # Anthos cluster version.
      # Change the following line from 1.6.0 to 1.6.1, shown below
      anthosBareMetalVersion: 1.6.1
  3. Issue the kubectl command to apply the revised user cluster config and create the cluster:
  4.   kubectl --kubeconfig ADMIN_KUBECONFIG apply -f USER_CLUSTER_CONFIG
      
    ADMIN_KUBECONFIG specifies the path to the admin cluster kubeconfig file, and USER_CLUSTER_CONFIG specifies the path to the user cluster YAML file you edited in the previous section. For example, for an admin cluster named admin, and a user cluster config named user1, the command would be:
    kubectl --kubeconfig bmctl-workspace/admin/admin-kubeconfig apply /
      -f bmctl-workspace/user1/user1.yaml
    

Verifying the user cluster upgrade

To verify the user cluster version after an upgrade, use the kubectl get command to return the version.

For example, to verify the cluster version is at 1.6.1 after upgrading from 1.6.0, issue the following command:

kubectl get cluster.baremetal.cluster.gke.io -n cluster-USER_CLUSTER_NAME \
  -o jsonpath='{.status.anthosBareMetalVersion}' --kubeconfig ADMIN_KUBECONFIG

Where:

  • ADMIN_KUBECONFIG specifies the path to the admin cluster kubeconfig file.
  • USER_CLUSTER_NAME is the name of your user cluster.

If the upgrade has been successful, the command returns the upgraded version number. Note that an upgrade may take as long as 30 minutes to complete.