This guide explains how to install Anthos Service Mesh version 1.7.8-asm.10 on Anthos clusters on AWS.
With Anthos Service Mesh, the Istio Ingress Gateway comes preinstalled. But if you prefer to use an ingress controller, you can use Anthos Service Mesh to set up a Kubernetes Ingress resource. This guide shows you how to install Anthos Service Mesh and optionally set up a Kubernetes Ingress resource.
Before you begin
Before you begin the Anthos Service Mesh installation, make sure you have performed the following tasks:
- Install a management service.
- Create a user cluster.
- Set up AWS networking.
- Review the following requirements and restrictions before beginning the setup.
Requirements
Make sure the user cluster that you install Anthos Service Mesh on has at least 4 vCPUs, 15 GB memory, and 4 nodes.
Review Naming service ports before you deploy workloads.
Make sure your cluster version is listed in Supported environments.
Restrictions
A Google Cloud project can only have one mesh associated with it.
Set up your environment
You need the following tools on the machine you want to install Anthos Service Mesh from. Note that you can install Anthos Service Mesh only on a user cluster, not an admin cluster.
- The
curl
command-line tool. - The Cloud SDK (the
gcloud
command-line tool).
After installing the Cloud SDK:
Authenticate with the Cloud SDK:
gcloud auth login
Update the components:
gcloud components update
Install
kubectl
:gcloud components install kubectl
Install the required version of
kpt
:curl -L https://github.com/GoogleContainerTools/kpt/releases/download/v0.39.2/kpt_linux_amd64 > kpt_0_39_2 chmod +x kpt_0_39_2 alias kpt="$(readlink -f kpt_0_39_2)"
Switch context to your user cluster:
kubectl config use-context CLUSTER_NAME
Grant cluster admin permissions to your user account (your Google Cloud login email address). 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=USER_ACCOUNT
Download the installation file
Linux
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
Ensure that you're in the Anthos Service Mesh installation's root directory.
cd istio-1.7.8-asm.10
Mac OS
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
Ensure that you're in the Anthos Service Mesh installation's root directory.
cd istio-1.7.8-asm.10
Windows
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
Installing Anthos Service Mesh
This section explains how to install Anthos Service Mesh on your user cluster, which
enables the Supported default features listed on the
Supported features page for the
asm-multicloud
profile. You can choose to enable Ingress for the public subnet
or the private subnet.
Public
If needed, change to the
istio-1.7.8-asm.10
directory. Theistioctl
client is version dependent. Make sure that you use the version in theistio-1.7.8-asm.10/bin
directory.Run the following command to install Anthos Service Mesh. 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.Install Anthos Service Mesh:
bin/istioctl install \ -f manifests/profiles/asm-multicloud.yaml \ --set revision=asm-178-10
The
--set 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 that matches the label onistiod
.Configure the validating webhook so that it can locate the
istiod
service with the revision label:kubectl apply -f istiod-service.yaml
This command creates a service entry that lets the validating webhook automatically check configurations before they are applied.
Private
In the following, you add the
service.beta.kubernetes.io/aws-load-balancer-internal
annotation to all
services that Anthos Service Mesh creates. When this annotation is present,
Anthos clusters on AWS creates private Ingress services.
If needed, change to the
istio-1.7.8-asm.10
directory. Theistioctl
client is version dependent. Make sure that you use the version in theistio-1.7.8-asm.10/bin
directory.Save the following YAML to a file called
istio-operator-internal-lb.yaml
:apiVersion: install.istio.io/v1alpha1 kind: IstioOperator spec: components: ingressGateways: - enabled: true k8s: serviceAnnotations: service.beta.kubernetes.io/aws-load-balancer-internal: "true" name: istio-ingressgateway
Run the following command to install Anthos Service Mesh. 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.bin/istioctl install \ -f manifests/profiles/asm-multicloud.yaml \ --set revision=asm-178-10 \ -f istio-operator-internal-lb.yaml
The
--set 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 that matches the label onistiod
.Configure the validating webhook so that it can locate the
istiod
service with the revision label:kubectl apply -f istiod-service.yaml
This command creates a service entry that lets the validating webhook automatically check configurations before they are applied.
Installing without Prometheus and Kiali
By default in Anthos Service Mesh 1.7 and earlier, Anthos Service Mesh installs
Prometheus and
Kiali from their original package repositories
at docker.io
and quay.io
. If you don't want to install these tools or
allow connections to these repositories, pass
-set addonComponents.prometheus.enabled=false
and
--set addonComponents.kiali.enabled=false
to istioctl install
. For example,
use the following command to exclude Prometheus and Kiali from
the public subnet installation installation.
bin/istioctl install \
-f manifests/profiles/asm-multicloud.yaml \
--set addonComponents.prometheus.enabled=false \
--set addonComponents.kiali.enabled=false \
--revision=asm-178-10
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-74cc894bfd-786rg 1/1 Running 0 7m19s istiod-78cdbbbdb-d7tps 1/1 Running 0 7m36s promsd-576b8db4d6-lqf64 2/2 Running 1 7m19s
You have now installed the Anthos Service Mesh control plane with the preinstalled Ingress Gateway. If you only need ingress functionality using an Ingress controller, you are ready to install applications on your cluster. See Creating an example Deployment, which shows how to configure an Ingress resource.
If you want to take advantage of all the features that Anthos Service Mesh provides, continue with the next phase of the installation to inject sidecar proxies and restart your workloads.
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
Accessing the Ingress Gateway
Anthos Service Mesh provides a preconfigured Ingress Gateway, the
istio-ingressgateway
, that you can use to manage inbound traffic to
applications running on your service mesh. To make applications accessible
from outside of your cluster, (such as from a browser):
You need to get the external IP address or host name and port of the external load balancer that the
istio-ingressgateway
is configured to use.Your application must define a Gateway and VirtualService resource, similar to the Online Boutique sample application's
frontend-gateway.yaml
.
To get the external address of the istio-ingressgateway
:
Create the
INGRESS_HOST
environment variable:export INGRESS_HOST=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].hostname}')
Create the
INGRESS_PORT
environment variable:export INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].port}')
To test, deploy a sample application, such as the Online Boutique.
To access the application on your browser, use the value of
$INGRESS_HOST:$INGRESS_PORT
in the URL.
Troubleshooting
Anthos clusters on AWS requires tags on subnets that contain load balancer
endpoints. Anthos clusters on AWS automatically tags all subnets specified in the
spec.Networking.ServiceLoadBalancerSubnetIDs
field of the AWSCluster
resource.
If you would like to add additional subnets to your user cluster, or if you need to re-apply tags to existing subnets, perform the following steps.
From your
anthos-aws
directory, useanthos-gke
to switch context to your management service.cd anthos-aws anthos-gke aws management get-credentials
Get the ID of your cluster's AWS VPC with
kubectl
and store it as a variable.export VPC_ID=$(\ env HTTP_PROXY=http://localhost:8118 \ kubectl get awscluster cluster-0 -o jsonpath='{.spec.networking.vpcID}')
Check the variables content with
echo
. The output resemblesvpc-12345678abcdef0
.echo $VPC_ID
Save your cluster ID into an environment variable.
export CLUSTER_ID=$(\ env HTTP_PROXY=http://localhost:8118 \ kubectl get awscluster cluster-0 -o jsonpath='{.status.clusterID}')
You can check the variable with
echo
:echo $CLUSTER_ID
The response includes your cluster ID.
gke-12345678
If you installed Anthos clusters on AWS into a dedicated VPC, you can use the
aws
command-line tool to retrieve the subnet ID.Select from the following options:
- Public, if you want to expose Services on your public subnet.
- Private, if you want to expose Services on your private subnet.
Multiple subnets, if you want to expose Services on multiple subnets.
Public
export SUBNET_ID=$(aws ec2 describe-subnets \ --filters "Name=vpc-id,Values=$VPC_ID" "Name=tag:Name,Values=*public*" \ --query "Subnets[*].SubnetId" \ --output text)
The output is an object that contains your subnet ID. It resembles
subnet-1234abcdefg
. You can check the variable withecho
:echo $SUBNET_ID
The response includes your subnet ID.
subnet-012345678abcdef
Private
export SUBNET_ID=$(aws ec2 describe-subnets \ --filters "Name=vpc-id,Values=$VPC_ID" "Name=tag:Name,Values=*private*" \ --query "Subnets[*].SubnetId" \ --output text)
The output is an object that contains your subnet ID. It resembles
subnet-1234abcdefg
. You can check the variable withecho
:echo $SUBNET_ID
The response includes your subnet ID.
subnet-012345678abcdef
Multiple subnets
If you are using multiple subnets for your AWSNodePools (for example, if you use multiple availability zones), you need to tag your subnet IDs individually.
Retrieve your list of subnet IDs with
aws ec2 describe-subnets
.To get a list of all public subnets, run the following command:
aws ec2 describe-subnets \ --filters "Name=vpc-id,Values=$VPC_ID" "Name=tag:Name,Values=*public*" \ --query "Subnets[*].SubnetId" \ --output text
To get a list of all private subnets, run the following command:
aws ec2 describe-subnets \ --filters "Name=vpc-id,Values=$VPC_ID" "Name=tag:Name,Values=*private*" \ --query "Subnets[*].SubnetId" \ --output text
The response includes your subnet IDs.
subnet-012345678abcdef subnet-abcdef123456789 subnet-123456789abcdef
Tag your subnet with your cluster ID. If you have multiple subnets, select Multiple subnets.
Single subnet
aws ec2 create-tags \ --resources $SUBNET_ID \ --tags Key=kubernetes.io/cluster/$CLUSTER_ID,Value=shared
Multiple subnets
For each of your subnets, run the following command:
aws ec2 create-tags \ --resources subnet-ids \ --tags Key=kubernetes.io/cluster/$CLUSTER_ID,Value=shared
Replace subnet-ids with the list of subnet IDs, separated by spaces. For example,
subnet-012345678abcdef subnet-abcdef123456789 subnet-123456789abcdef
.
What's next
Create an example deployment on Anthos clusters on AWS.