How to upgrade Juju from 2.8.0 when using Kubernetes
If you are using Juju 2.8.0 with Kubernetes and want to upgrade the following steps need to be performed manually. These steps only need to be performed if you have a Juju Kubernetes Controller or are running Kubernetes models. If your current version is not 2.8.0 then these this document can be safely ignored.
Upgrading A Juju Kubernetes Controller From 2.8.0
The following is a list of steps that need to be completed when upgrading a Juju controller that is on version 2.8.0 running inside of Kubernetes.
- Identify the namespace that the Juju controller runs in. For example when bootstrapping a default Microk8s this will be
kubectl get namespaces
- Follow the normal steps in the Juju release notes for upgrading the Juju controller. As an example:
- Find the Kubernetes Juju controller statefulset inside the namespace identified in step 1. For example this is called “controller” on a default microk8s bootstrap.
kubectl get statefulsets -n <namespace_step1>
- Edit the statefulset identified in step 3 with the following. Find the image line of the Juju container in the opened text editor and change the tag of the juju image to the upgraded version. For example if you are upgrading from Juju 2.8.0 => 2.8.1 the new Juju image tag would become
kubectl edit statefulset <statefulset_step3> -n <namespace_step1>
- Let Kubernetes restart the Statefulset pods and verify that the controller has spun up correctly and responding.
Upgrading A Juju Model Agent From 2.8.0
The following is a list of steps that need to be completed when upgrading a Juju controller that is on version 2.8.0. These steps need to be completed for every Juju model inside of the Kubernetes cluster.
- Identify the namespaces for each Juju model that is running inside of a Kubernetes cluster. There is a 1 to 1 mapping between model name and Kubernetes namespace. If your Juju controller runs inside of Kubernetes you must include this namespace in your list as well. See steps above:
kubectl get namespaces
- With the Juju controller updated to the latest version please update each identified Kubernetes namespace with:
juju juju upgrade-model
- For each identified Kubernetes namespace from step 1 please apply the following. Edit the model operator Kubernetes in each deployment and change the jujud container image tag to the desired upgrade version. For example if you are upgrading from Juju 2.8.0 => 2.8.1 the new Juju image tag would become
kubectl edit deployment modeloperator -n <namespace_step1>
These steps outline the process for upgrading Juju Kubernetes components from 2.8.0. Juju was unable to safely perform these upgrade steps due to a bug in the source code of 2.8.0. The steps above have been tested on several deployments but if you find any issues or would like clarification please leave a discourse post here for us.