Upgrading Istio¶
This document demonstrates upgrading Istio in a way that allows operators to be in control of the transition of workloads from one version to the next.
This document is an adaptation of the document entitled Canary Upgrades from the official Istio documentation.
The BookInfo sample application will serve as the workload under test.
Warning
Feature status of Revision Based Upgrades is alpha
In this exercise, we will:
- Install a Kubernetes cluster
- Install Istio v1.12.5
- Deploy the BookInfo sample application to the
default
namespace.
Next, we:
- Install Istio v1.13.2, triggering solely the upgrade of the ingress gateway (not the workloads)
- Demonstrate namespace labeling as the mechanism for controlling the desired version of Istio to use for workloads in that namespace.
- Teardown previous version of Istio, completing the upgrade.
Finally, we will demonstrate an alternative to labeling namespaces directly, by using what Istio calls Revision Tags.
Note
In the instructions that follow, I use GCP as my infastructure, but feel free to use any Kubernetes you like.
Create a K8s Cluster¶
gcloud container clusters create my-istio-cluster \
--cluster-version latest \
--machine-type "n1-standard-2" \
--num-nodes "3" \
--network "default"
Wait until cluster is ready.
Client Setup¶
In a workspace directory of your choice, download two Istio releases, 1.12.5 and 1.13.2.
Be sure to use the hardware architecture matching your workstation:
Setting your PATH¶
I use direnv to easily update my PATH so that istioctl points to version 1.12.5 or version 1.13.2 as a function of the directory that i navigate to.
Given a file named .envrc
in the folder istio-1.12.5
:
I can run direnv allow
, and note that running istioctl version
from that directory returns 1.12.5
.
Likewise, the same file in the istio-1.13.2
directory allows me to quickly switch to that version.
Install Istio¶
Install:
Check:
Check the ingressgateway Istio version:
Label the default namespace¶
Check:
Deploy BookInfo¶
Check:
kubectl exec "$(kubectl get pod -l app=ratings -o jsonpath='{.items[0].metadata.name}')" -c ratings -- curl -sS productpage:9080/productpage | grep -o "<title>.*</title>"
Configure ingress:
Check:
GATEWAY_IP=$(kubectl get svc -n istio-system istio-ingressgateway -ojsonpath='{.status.loadBalancer.ingress[0].ip}')
Open a browser and visit the BookInfo product page (at /productpage
).
Verifying that workloads use version 1.12.5¶
-
With
istioctl proxy-status
-
Checking the server_info endpoint of a sidecar:
And check that the ANNOTATIONS revision is 1-12-5
-
Describe the pod
Switch directories¶
Make sure your PATH now points to version 1.13.2 of the istioctl
CLI:
Install Istio version 1.13.2¶
Pre-check:
Install:
Analyze?:
Also, see the istioctl analyze
command reference, and
configuration analysis messsages. Possible false positive and Gateway resource.
- Both 1-13-2 and 1-12-5 istiod's are installed
- ingressgateway has been upgraded to 1.13.2
- Pods still use 1-12-5
Check:
And:
Update namespace label¶
Check:
Restart the deployments in the default namespace¶
Teardown the old version¶
Verify that the bookinfo application is still alive and well.
Using Revision Tags¶
Instead of specifying the actual revision we want, we use a semantic name, like prod
:
And then associate prod to a revision:
Check:
To change what prod means, we associate a different revision to it:
What about the Gateways?¶
Gateways can be canary-ugraded instead of using in-place upgrades.
Here's an outline of the recipe:
- Install istiod by itself (no gateway) by using the minimal profile.
- Install the gateway separately by using the empty profile.
- Can canary-deploy the gateway by creating a second deployment, and labeling the deployment with
istio.io/rev
to control which sidecar version is bundled into the pod. - This is explained in more detail here.
Closing thoughts¶
- Operators can make available a new version of Istio and notify developers to update their workloads on their own time.
- Develop a process, and automation for implementing Istio ugprades, and rollbacks. Start by listening to Pratima Nambiar from Salesforce in her Istio Community Talk.