Kubernetes Add-On Upgrade Script

Description of the Kubernetes add-on upgrade script with syntax and script options.

Starting HPE Ezmeral Runtime Enterprise 5.5.0, HPE decouples the upgrade of the HPE Ezmeral Runtime Enterprise platform from Kubernetes-related components.

With this feature, the user can upgrade the following Kubernetes related components, without performing the complete HPE Ezmeral Runtime Enterprise platform upgrade. For more details, see Upgrading Kubernetes Bundles.

python k8s_addon_upgrade.py -c <controller> -f <credentials_file> -k <cluster-name> 
{ --required-only | -a <add-on-list> } [ -t | --dry-run ]
python k8s_addon_upgrade.py -c <controller> -f <credentials_file> -k <cluster-name> { -r | --refresh }

Description

The Kubernetes add-on upgrade script, k8s_addon_upgrade.py, lists the installed and manifest versions of the specified add-ons, and upgrades or installs the specified add-ons on the specified Kubernetes cluster.

  • Required privileges: Platform Administrator

  • This script is intended to be executed after upgrading the HPE Ezmeral Runtime Enterprise software and after upgrading HPE Ezmeral Data Fabric on Kubernetes clusters.

  • Execute the script from the following directory of the primary HPE Ezmeral Runtime Enterprise controller:

    /opt/hpe/kubernetes/tools

  • This script must be run on each Kubernetes cluster.

Parameters

-h, --help

Shows the help and exits.

--required-only

Specifies that only the required add-ons are to be upgraded or installed.

-a ADDONS, --addons=ADDONS

ADDONS is a comma-separated list of add-ons to upgrade.

On Data Fabric clusters, this script does not support upgrading the datafabric, picasso-tenant, or picasso-compute add-ons. Those add-ons are upgraded as part of procedure to upgrade HPE Ezmeral Data Fabric on Kubernetes.

When you use the -a or --addons parameter, only the add-ons you specify in the command are upgraded. If you have an add-on that is deployed on the cluster and you do not include it in the list, that add-on is not upgraded.

To display a list of the required add-ons (currently deployed and that need to be deployed) and the current optional add-ons, run the command using the -t or --dry-run parameter.

-c CONTROLLER, --controller=CONTROLLER

CONTROLLER is the HPE Ezmeral Runtime Enterprise controller, specified as one of the following:

  • The IP address of the controller host
  • The cluster IP address (if platform HA is enabled)
  • The IP address of a Gateway host
-f CREDFILE, --file=CREDFILE

CREDFILE specifies the path to a JSON file that specifies the site admin tenant, and that contains the username and password to use to connect to the controller host. This JSON file stores the username under the key user and the password under the key password.

For example:
{
  "user": "myadminuser",
  "password": "admin789",
  "tenant": "/api/v1/tenant/1"
}

If you do not specify the site admin tenant as shown in the preceding example, users that have Platform Administrator privilges but are not the default Platform Administrator (Site Admin) might receive a 404 error when the add-on upgrade script attempts to access the Kubernetes manifest.

-k K8SCLUSTER, --k8scluster=K8SCLUSTER
K8SCLUSTER specifies the name of the Kubernetes cluster.
-l LOGFILE, --logfile=LOGFILE

LOGFILE specifies the path and name of the log file.

Default: ./k8s_addon_upgrade.log

-t, --dry-run

Prints the operations without applying them.

The output of the command lists the deployed add-ons, the version that is deployed on the cluster, and the version in the manifest. It also lists all the add-ons that can be upgraded or deployed.

By executing the script with the -t or --dry-run parameter, you can compare the deployed and manifest versions of optional add-ons, such as istio, to determine whether or not you want to upgrade that add-on. If you have applications that require earlier versions of an add-on, for example, you might not want to include that add-on when you execute the script to perform the upgrade.

-x, --https

Connect to the controller using HTTPS.

-r, --refresh

Specifies that failed add-on upgrade or installation attempts be retried. On success, the operation clears any warnings and puts the cluster into a ready state.

When this parameter is specified, the -a and --required-only parameters are ignored.

Usage

The recommended procedure is the following:

  1. Execute the script with the -t parmeter to display the list of deployed and available add-ons. For the optional add-ons, compare the deployed and manifest version and determine whether you want to upgrade the add-on.
  2. Execute the script with the --required-only parameter to upgrade and deploy the required add-ons.
  3. Optionally, upgrade or deploy optional add-ons by executing the script with the -a parameter and listing the optional add-ons you want to upgrade or deploy.

The script upgrades only the add-ons that you specify in the command, either all required add-ons when you specify --required-only, or only the add-ons that you specify with the -a parameter.

The script can be run multiple times. Add-ons that have matching manifest and deployed versions are not affected.

In the following example:

  • HTTPS is enabled on the controller at IP address 192.0.2.5
  • The -x parameter specifies to use HTTPS for the connection.
  • The cluster name is my-k8s-cluster
  • The --required-only parameter is used instead of the -a parameter.
  • The -t (test) parameter is specified, which means that both required and optional add-ons will be listed but not upgraded.
  • A partial output of the command is shown. In the example, the argocd add-on is new to the my-k8s-cluster cluster, so there is no value displayed for the deployed version.

python /opt/hpe/kubernetes/tools
python k8s_addon_upgrade.py -c 192.0.2.5 -f /tmp/cred.json -x -k my-k8s-cluster --required-only -t

Cluster my-k8s-cluster required add-ons info:
  argocd:
    deployed version: , tools: 
    manifest version: 1.8.4-1, tools: 0.4
...
  hpecp-agent:
    deployed version: 1.1.2-1, tools: 0.1
    manifest version: 1.1.5-4, tools: 0.4
...
Cluster my-k8s-cluster deployed additional add-ons info:
...
Done