This guide explains how to migrate from Istio 1.6 to Anthos Service Mesh 1.6.14 on a GKE cluster. If you have an earlier version of Istio installed, you must first upgrade Istio to 1.6.
Before you begin
Before you install Anthos Service Mesh, make sure that you have:
- Set up your environment to install the tools that you need.
- Set up your project to enable the required APIs and set permissions.
- Set up your cluster to enable the required cluster options.
- Reviewed Preparing to migrate from Istio.
Setting credentials and permissions
Initialize your project to ready it for installation. Among other things, this command creates a service account to let control plane components, such as the sidecar proxy, securely access your project's data and resources:
curl --request POST \ --header "Authorization: Bearer $(gcloud auth print-access-token)" \ --data '' \ "https://meshconfig.googleapis.com/v1alpha1/projects/${PROJECT_ID}:initialize"
The command responds with empty curly braces:
{}
Get authentication credentials to interact with the cluster:
gcloud container clusters get-credentials ${CLUSTER_NAME} \ --project=${PROJECT_ID}
Grant cluster admin permissions to the current user. You need these permissions to create the necessary role based access control (RBAC) rules for Anthos Service Mesh:
kubectl create clusterrolebinding cluster-admin-binding \ --clusterrole=cluster-admin \ --user="$(gcloud config get-value core/account)"
If you see the "cluster-admin-binding" already exists
error, you can safely
ignore it and continue with the existing cluster-admin-binding.
Downloading the installation file
-
Download the Anthos Service Mesh installation file to your current working
directory:
curl -LO https://storage.googleapis.com/gke-release/asm/istio-1.6.14-asm.2-linux-amd64.tar.gz
-
Download the signature file and use
openssl
to verify the signature:curl -LO https://storage.googleapis.com/gke-release/asm/istio-1.6.14-asm.2-linux-amd64.tar.gz.1.sig openssl dgst -verify /dev/stdin -signature istio-1.6.14-asm.2-linux-amd64.tar.gz.1.sig istio-1.6.14-asm.2-linux-amd64.tar.gz <<'EOF' -----BEGIN PUBLIC KEY----- MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEWZrGCUaJJr1H8a36sG4UUoXvlXvZ wQfk16sxprI2gOJ2vFFggdq3ixF2h4qNBt0kI7ciDhgpwS8t+/960IsIgw== -----END PUBLIC KEY----- EOF
The expected output is:
Verified OK
-
Extract the contents of the file to any location on your file system. For
example, to extract the contents to the current working directory:
tar xzf istio-1.6.14-asm.2-linux-amd64.tar.gz
The command creates an installation directory in your current working directory named
istio-1.6.14-asm.2
that contains:- Sample applications in the
samples
directory. - The
istioctl
command-line tool that you use to install Anthos Service Mesh is in thebin
directory. - The Anthos Service Mesh configuration profiles are in the
manifests/profiles
directory.
- Sample applications in the
-
Download the Anthos Service Mesh installation file to your current working
directory:
curl -LO https://storage.googleapis.com/gke-release/asm/istio-1.6.14-asm.2-osx.tar.gz
-
Download the signature file and use
openssl
to verify the signature:curl -LO https://storage.googleapis.com/gke-release/asm/istio-1.6.14-asm.2-osx.tar.gz.1.sig openssl dgst -sha256 -verify /dev/stdin -signature istio-1.6.14-asm.2-osx.tar.gz.1.sig istio-1.6.14-asm.2-osx.tar.gz <<'EOF' -----BEGIN PUBLIC KEY----- MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEWZrGCUaJJr1H8a36sG4UUoXvlXvZ wQfk16sxprI2gOJ2vFFggdq3ixF2h4qNBt0kI7ciDhgpwS8t+/960IsIgw== -----END PUBLIC KEY----- EOF
The expected output is:
Verified OK
-
Extract the contents of the file to any location on your file system. For
example, to extract the contents to the current working directory:
tar xzf istio-1.6.14-asm.2-osx.tar.gz
The command creates an installation directory in your current working directory named
istio-1.6.14-asm.2
that contains:- Sample applications in the
samples
directory. - The
istioctl
command-line tool that you use to install Anthos Service Mesh is in thebin
directory. - The Anthos Service Mesh configuration profiles are in the
manifests/profiles
directory.
- Sample applications in the
-
Download the Anthos Service Mesh installation file to your current working
directory:
curl -LO https://storage.googleapis.com/gke-release/asm/istio-1.6.14-asm.2-win.zip
-
Download the signature file and use
openssl
to verify the signature:curl -LO https://storage.googleapis.com/gke-release/asm/istio-1.6.14-asm.2-win.zip.1.sig openssl dgst -verify - -signature istio-1.6.14-asm.2-win.zip.1.sig istio-1.6.14-asm.2-win.zip <<'EOF' -----BEGIN PUBLIC KEY----- MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEWZrGCUaJJr1H8a36sG4UUoXvlXvZ wQfk16sxprI2gOJ2vFFggdq3ixF2h4qNBt0kI7ciDhgpwS8t+/960IsIgw== -----END PUBLIC KEY----- EOF
The expected output is:
Verified OK
-
Extract the contents of the file to any location on your file system. For
example, to extract the contents to the current working directory:
tar xzf istio-1.6.14-asm.2-win.zip
The command creates an installation directory in your current working directory named
istio-1.6.14-asm.2
that contains:- Sample applications in the
samples
directory. - The
istioctl
command-line tool that you use to install Anthos Service Mesh is in thebin
directory. - The Anthos Service Mesh configuration profiles are in the
manifests/profiles
directory.
- Sample applications in the
-
Ensure that you're in the Anthos Service Mesh installation's root directory.
cd istio-1.6.14-asm.2
-
For convenience, add the tools in the
/bin
directory to your PATH:export PATH=$PWD/bin:$PATH
Linux
Mac OS
Windows
Preparing resource configuration files
When you run the istioctl install
command, you specify
-f istio-operator.yaml
on the command line. This file contains information
about your project and cluster that Anthos Service Mesh requires. You need to download
a package that contains istio-operator.yaml
and other resource configuration
files so that you can set the project and cluster information.
To get started, choose a package to download based on the certificate authority (CA) that you want to use:
asm
: thumb_up_alt This package enables Mesh CA, which we recommend for new installations.asm-citadel
: Optionally, you can enable Citadel as the CA. Before choosing this package, refer to Choosing a certificate authority for more information.
To prepare the resource configuration files:
Create a new directory for the Anthos Service Mesh package resource configuration files. We recommend that you use the cluster name as the directory name.
Change to the directory where you want to download the Anthos Service Mesh package.
Download the package you want to use, based on the CA
Mesh CA
Download the
asm
package, which enables Mesh CA:kpt pkg get \ https://github.com/GoogleCloudPlatform/anthos-service-mesh-packages.git/asm@release-1.6-asm asm
Citadel
Download the
asm-citadel
package, which enables Citadel as the CA:kpt pkg get \ https://github.com/GoogleCloudPlatform/anthos-service-mesh-packages.git/asm-citadel@release-1.6-asm asm
Set the project ID for the project that the cluster was created in:
kpt cfg set asm gcloud.core.project ${PROJECT_ID}
Set the project number for the fleet host project:
kpt cfg set asm gcloud.project.environProjectNumber ${FLEET_PROJECT_NUMBER}
Set the cluster name:
kpt cfg set asm gcloud.container.cluster ${CLUSTER_NAME}
Set the default zone or region:
kpt cfg set asm gcloud.compute.location ${CLUSTER_LOCATION}
Set the configuration profile that you plan to use:
If all of your clusters are in the same project, set the
asm-gcp
profile:kpt cfg set asm anthos.servicemesh.profile asm-gcp
If your service mesh contains or will contain multiple clusters that are in different projects, set the
asm-gcp-multiproject
profile (beta):kpt cfg set asm anthos.servicemesh.profile asm-gcp-multiproject
If you set the
asm-gcp-multiproject
profile and downloaded theasm
package, which enables Mesh CA, you need to configure the trust domain aliases for the other projects that will form the multi-cluster/multi-project service mesh. Otherwise, skip this step.Get the project ID of all clusters that will be in the multi-cluster/multi-project mesh.
For each cluster's project ID, set the trust domain aliases. For example, if you have clusters in 3 projects, run the following command and replace
PROJECT_ID_1
,PROJECT_ID_2
, andPROJECT_ID_3
with each cluster's project ID.kpt cfg set asm anthos.servicemesh.trustDomainAliases PROJECT_ID_1.svc.id.goog PROJECT_ID_2.svc.id.goog PROJECT_ID_3.svc.id.goog
As you configure the clusters in the other projects, you can use the same command.
The trust domain aliases enables Mesh CA to authenticate workloads on clusters in other projects. In addition to setting the trust domain aliases, after installing Anthos Service Mesh, you have to enable cross-cluster load balancing.
Output the values of the
kpt
setters:kpt cfg list-setters asm
In the output from the command verify that the values for the following setters are correct:
- gcloud.compute.location
- gcloud.container.cluster
- gcloud.core.project
- gcloud.project.environProjectNumber
Migrating to Anthos Service Mesh
To migrate from Istio, we recommend that you follow the
dual control plane upgrade process
(referred to as canary upgrades in the Istio documentation). With a dual control
plane upgrade, you install a new version of the control plane alongside the
existing control plane. When installing the new version, you include a
revision
label that identifies the version of the new control plane. Each
revision is a full Anthos Service Mesh control plane implementation with its own
Deployment and Service.
You then migrate to the new version by setting the same revision
label on your
workloads to point to the new control plane and performing a rolling restart to
re-inject the proxies with the new Anthos Service Mesh version. With this approach,
you can monitor the effect of the upgrade on a small percentage of your
workloads. After testing your application, you can migrate all traffic to the
new version. This approach is much safer than doing an in-place upgrade where a
new control plane immediately replaces the previous version of the control
plane.
Updating the control plane
Run the following command to deploy the new control plane using the
configuration profile that you set in the istio-operator.yaml
file. If you
want to enable a
supported optional feature,
include -f
and the YAML filename on the following command line. See
Enabling optional features
for more information.
istioctl install \ -f asm/cluster/istio-operator.yaml \ --set revision=asm-1614-2
The --set revision
argument adds a istio.io/rev
label to istiod
. After
running the command, you have two control plane Deployments and Services running
side-by-side:
kubectl get pods -n istio-system
Example output:
NAME READY STATUS RESTARTS AGE istio-ingressgateway-c56675fcd-86zdn 1/1 Running 0 2m9s istio-ingressgateway-c56675fcd-vn4nv 1/1 Running 0 2m21s istiod-asm-1614-2-6d5cfd4b89-xztlr 1/1 Running 0 3m44s istiod-fb7f746f4-wcntn 1/1 Running 0 50m
Redeploying workloads
Installing the new revision has no impact on the existing sidecar proxies. To
upgrade these, you must configure them to point to the new control plane. This
is controlled during sidecar injection based on the namespace label
istio.io/rev
.
Update workloads to be injected with the new Anthos Service Mesh version:
kubectl label namespace NAMESPACE istio-injection- istio.io/rev=asm-1614-2 --overwrite
The
istio-injection
label must be removed because it takes precedence over theistio.io/rev
label.Restart the Pods to trigger re-injection:
kubectl rollout restart deployment -n NAMESPACE
Verify that the Pods are configured to point to the
istiod-asm-1614-2
control plane:kubectl get pods -n NAMESPACE -l istio.io/rev=asm-1614-2
Test your application to verify that the workloads are working correctly.
If you have workloads in other namespaces, repeat the previous steps for each namespace.
If you are satisfied that your application is working as expected, skip to Complete the migration. Otherwise do the following steps to rollback to the previous version:
To rollback:
Update workloads to be injected with the previous version of the control plane:
kubectl label namespace NAMESPACE istio.io/rev- istio-injection=enabled --overwrite
Restart the Pods to trigger re-injection so the proxies have the previous version:
kubectl rollout restart deployment -n NAMESPACE
Redeploy the previous version of the
istio-ingressgateway
:kubectl -n istio-system rollout undo deploy istio-ingressgateway
Remove the new control plane:
kubectl delete Service,Deployment,HorizontalPodAutoscaler,PodDisruptionBudget istiod-asm-1614-2 -n istio-system --ignore-not-found=true
Complete the migration
If you are satisfied that your application is working as expected, do the following steps to complete the migration to Anthos Service Mesh:
If you are migrating from the Istio on GKE add-on, disable the add-on:
gcloud beta container clusters update CLUSTER_NAME \ --project=CLUSTER_PROJECT_ID \ --update-addons=Istio=DISABLED
Run the following command to deploy the Canonical Service controller:
kubectl apply -f asm/canonical-service/controller.yaml
The command deploys the Canonical Service controller to your cluster. The Canonical Service controller groups workloads belonging to the same logical service, and it is required to unlock extra functionality in the Services dashboard in the Google Cloud console. For more information, refer to Enabling and disabling the Canonical Service controller.
Remove the old control plane:
kubectl delete Service,Deployment,HorizontalPodAutoscaler,PodDisruptionBudget istiod -n istio-system --ignore-not-found=true
Viewing the Anthos Service Mesh dashboards
This section is applicable only if you installed Anthos Service Mesh with the
asm-gcp
configuration profile. If you used the asm-gcp-multiproject
profile
to install Anthos Service Mesh, telemetry data won't be available on the Anthos Service Mesh
dashboards in the Google Cloud console.
After you have workloads deployed on your cluster with the sidecar proxies injected, you can explore the Anthos Service Mesh pages in the Google Cloud console to see all of the observability features that Anthos Service Mesh offers. Note that it takes about one or two minutes for telemetry data to be displayed in the Google Cloud console after you deploy workloads.
Access to Anthos Service Mesh in the Google Cloud console is controlled by Identity and Access Management (IAM). To access the Anthos Service Mesh pages, a Project Owner must grant users the Project Editor or Viewer role, or the more restrictive roles described in Controlling access to Anthos Service Mesh in the Google Cloud console.
In the Google Cloud console, go to Anthos Service Mesh.
Select the Cloud project from the drop-down list on the menu bar.
If you have more than one service mesh, select the mesh from the Service Mesh drop-down list.
To learn more, see Exploring Anthos Service Mesh in the Google Cloud console.
In addition to the Anthos Service Mesh pages, metrics related to your services (such as the number of requests received by a particular service) are sent to Cloud Monitoring, where they appear in the Metrics Explorer.
To view metrics:
In the Google Cloud console, go to the Monitoring page:
Select Resources > Metrics Explorer.
For a full list of metrics, see Istio metrics in the Cloud Monitoring documentation.
Registering your cluster
You must register your cluster with the project's fleet to gain access to the unified user interface in the Google Cloud console. A fleet provides a unified way to view and manage the clusters and their workloads, including clusters outside Google Cloud.
See Registering clusters to the fleet for information on registering your cluster.