This page is part of a multi-page guide that explains how to install Anthos Service Mesh version 1.7.8 on a GKE cluster for a mesh containing multiple clusters that are in different Cloud projects. For installations on a single-cluster mesh or for a mesh containing multiple clusters in the same Cloud project, refer to Installation, migration, and upgrade for GKE. If you have a multi-cluster/multi-project mesh that you are migrating from Istio, refer to Migrating from Istio to Anthos Service Mesh.
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.
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. This command also sets the current context for
kubectl
to 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.7.8-asm.10-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.7.8-asm.10-linux-amd64.tar.gz.1.sig openssl dgst -verify /dev/stdin -signature istio-1.7.8-asm.10-linux-amd64.tar.gz.1.sig istio-1.7.8-asm.10-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.7.8-asm.10-linux-amd64.tar.gz
The command creates an installation directory in your current working directory named
istio-1.7.8-asm.10
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.7.8-asm.10-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.7.8-asm.10-osx.tar.gz.1.sig openssl dgst -sha256 -verify /dev/stdin -signature istio-1.7.8-asm.10-osx.tar.gz.1.sig istio-1.7.8-asm.10-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.7.8-asm.10-osx.tar.gz
The command creates an installation directory in your current working directory named
istio-1.7.8-asm.10
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.7.8-asm.10-win.zip
-
Download the signature file and use
openssl
to verify the signature:curl -LO https://storage.googleapis.com/gke-release/asm/istio-1.7.8-asm.10-win.zip.1.sig openssl dgst -verify - -signature istio-1.7.8-asm.10-win.zip.1.sig istio-1.7.8-asm.10-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.7.8-asm.10-win.zip
The command creates an installation directory in your current working directory named
istio-1.7.8-asm.10
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.7.8-asm.10
-
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 prepare the resource configuration files:
Mesh CA
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:
kpt pkg get \ https://github.com/GoogleCloudPlatform/anthos-service-mesh-packages.git/asm@release-1.7-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 tag to the version of Anthos Service Mesh that you are installing:
kpt cfg set asm anthos.servicemesh.tag 1.7.8-asm.10
Set the validating webhook to use a revision label:
kpt cfg set asm anthos.servicemesh.rev asm-178-10
When you install Anthos Service Mesh, you set a revision label on
istiod
. You need to set the same revision on the validating webhook.Because the clusters in your multi-cluster configuration are in different projects, you need to configure the trust domain aliases for the other projects that will form the multi-cluster/multi-project service mesh.
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:
- anthos.servicemesh.rev
- anthos.servicemesh.tag
- anthos.servicemesh.trustDomainAliases
- gcloud.compute.location
- gcloud.container.cluster
- gcloud.core.project
- gcloud.project.environProjectNumber
You can ignore the values for the other setters.
Citadel
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:
kpt pkg get \ https://github.com/GoogleCloudPlatform/anthos-service-mesh-packages.git/asm@release-1.7-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 tag to the version of Anthos Service Mesh that you are installing:
kpt cfg set asm anthos.servicemesh.tag 1.7.8-asm.10
Set the validating webhook to use a revision label:
kpt cfg set asm anthos.servicemesh.rev asm-178-10
When you install Anthos Service Mesh, you set a revision label on
istiod
. You need to set the same revision on the validating webhook.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:
- anthos.servicemesh.rev
- anthos.servicemesh.tag
- gcloud.compute.location
- gcloud.container.cluster
- gcloud.core.project
- gcloud.project.environProjectNumber
You can ignore the values for the other setters.
Installing Anthos Service Mesh
Mesh CA
Verify that the current
kubeconfig
context is pointing to the cluster that you want to install Anthos Service Mesh on:kubectl config current-context
The output is in the following format:
gke_PROJECT_ID_CLUSTER_LOCATION_CLUSTER_NAME
The
kubeconfig
context and the values of thekpt
setters must match. If needed, run thegcloud container clusters get-credentials
command to set the currentkubeconfig
context.Run the following command, which installs Anthos Service Mesh using the
asm-gcp-multiproject
profile. 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/istio/istio-operator.yaml \ -f asm/istio/options/multiproject.yaml \ -f asm/istio/options/multicluster.yaml \ --revision=asm-178-10
The
--revision
argument adds a revision label in the formatistio.io/rev=asm-178-10
toistiod
. The revision label is used by the automatic sidecar injector webhook to associate injected sidecars with a particularistiod
revision. To enable sidecar auto-injection for a namespace, you must label it with a revision matching anistiod
Deployment.The following files override the settings in the
istio-operator.yaml
file:The
multiproject.yaml
file sets theasm-gcp-multiproject
profile.The
multicluster.yaml
file configures the settings that Anthos Service Mesh needs for a multi-cluster configuration.
Configure the validating webhook to locate
istiod
with the revision label:kubectl apply -f asm/istio/istiod-service.yaml
This command creates a service entry that lets the validating webhook automatically check configurations before they are applied.
Deploy the Canonical Service controller to your cluster:
kubectl apply -f asm/canonical-service/controller.yaml
The Canonical Service controller groups workloads belonging to the same logical service. For more information about Canonical Services, see the Canonical Service overview.
Citadel
Verify that the current
kubeconfig
context is pointing to the cluster that you want to install Anthos Service Mesh on:kubectl config current-context
The output is in the following format:
gke_PROJECT_ID_CLUSTER_LOCATION_CLUSTER_NAME
The
kubeconfig
context and the values of thekpt
setters must match. If needed, run thegcloud container clusters get-credentials
command to set the currentkubeconfig
context.Create the
istio-system
namespace:kubectl create namespace istio-system
Create a secret
cacerts
:kubectl create secret generic cacerts \ -n istio-system \ --from-file=ca-cert.pem \ --from-file=ca-key.pem \ --from-file=root-cert.pem \ --from-file=cert-chain.pem
For more information, see Plugging in existing CA Certificates.
Run the following command to install Anthos Service Mesh using the
asm-gcp-multiproject
profile. 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/istio/istio-operator.yaml \ -f asm/istio/options/citadel-ca.yaml \ -f asm/istio/options/multiproject.yaml \ -f asm/istio/options/multicluster.yaml \ --revision=asm-178-10
The
--revision
argument adds a revision label in the formatistio.io/rev=asm-178-10
toistiod
. The revision label is used by the automatic sidecar injector webhook to associate injected sidecars with a particularistiod
revision. To enable sidecar auto-injection for a namespace, you must label it with a revision matching anistiod
Deployment.The following files override the settings in the
istio-operator.yaml
file:The
citadel-ca.yaml
configures Citadel as the CA.The
multiproject.yaml
file sets theasm-gcp-multiproject
profile.The
multicluster.yaml
file configures the settings that Anthos Service Mesh needs for a multi-cluster configuration.
Configure the validating webhook to locate
istiod
with the revision label:kubectl apply -f asm/istio/istiod-service.yaml
This command creates a service entry that lets the validating webhook automatically check configurations before they are applied.
Deploy the Canonical Service controller to your cluster:
kubectl apply -f asm/canonical-service/controller.yaml
The Canonical Service controller groups workloads belonging to the same logical service. For more information about Canonical Services, see the Canonical Service overview.
Check the control plane components
Check that the control plane pods in istio-system
are up:
kubectl get pod -n istio-system
Expected output is similar to the following:
NAME READY STATUS RESTARTS AGE istio-ingressgateway-cff9f5c7d-qg4ls 1/1 Running 0 7m5s istio-ingressgateway-cff9f5c7d-vlkzb 1/1 Running 0 7m20s istiod-66b587859c-886gx 1/1 Running 0 7m33s istiod-66b587859c-dfs2j 1/1 Running 0 7m33s
Injecting sidecar proxies
Anthos Service Mesh uses sidecar proxies to enhance network security, reliability, and
observability. With Anthos Service Mesh, these functions are abstracted away from the
application's primary container and implemented in a common out-of-process proxy
delivered as a separate container in the same Pod. To inject your Pods with
the sidecar proxy, you configure automatic sidecar proxy injection
(auto-injection) by labeling your namespaces with the same revision
label that you set on istiod
when you installed Anthos Service Mesh.
You need to enable auto-injection on any namespaces with workloads that were running on your cluster before you installed Anthos Service Mesh.
Before you deploy new workloads, make sure to configure auto-injection so that Anthos Service Mesh can monitor and secure traffic.
To enable auto-injection:
Use the following command to locate the revision label on
istiod
:kubectl -n istio-system get pods -l app=istiod --show-labels
The output looks similar to the following:
NAME READY STATUS RESTARTS AGE LABELS istiod-asm-178-10-5788d57586-bljj4 1/1 Running 0 23h app=istiod,istio.io/rev=asm-178-10,istio=istiod,pod-template-hash=5788d57586 istiod-asm-178-10-5788d57586-vsklm 1/1 Running 1 23h app=istiod,istio.io/rev=asm-178-10,istio=istiod,pod-template-hash=5788d57586
In the output, under the
LABELS
column, note the value of theistiod
revision label, which follows the prefixistio.io/rev=
. In this example, the value isasm-178-10
.Apply the revision label and remove the
istio-injection
label if it exists. In the following command,NAMESPACE
is the name of the namespace where you want to enable auto-injection, andREVISION
is the revision label you noted in the previous step.kubectl label namespace NAMESPACE istio-injection-istio.io/rev=REVISION --overwrite
You can ignore the message
"istio-injection not found"
in the output. That means that the namespace didn't previously have theistio-injection
label, which you should expect in new installations of Anthos Service Mesh or new deployments. Because auto-injection fails if a namespace has both theistio-injection
and the revision label, allkubectl label
commands in the Anthos Service Mesh documentation include removing theistio-injection
label.If workloads were running on your cluster before you installed Anthos Service Mesh, restart the Pods to trigger re-injection.
How you restart Pods depends on your application and the environment the cluster is in. For example, in your staging environment, you might simply delete all the Pods, which causes them to restart. But in your production environment, you might have a process that implements a blue-green deployment so that you can safely restart Pods to avoid traffic interruption.
You can use
kubectl
to perform a rolling restart:kubectl rollout restart deployment -n NAMESPACE
Verify that your Pods are configured to point to the new version of
istiod
.kubectl get pods -n NAMESPACE -l istio.io/rev=REVISION
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.