Anthos Service Mesh 1.6

Installing Anthos Service Mesh on GKE on AWS

This guide explains how to do a clean installation of Anthos Service Mesh version 1.6.8-asm.9 on an existing GKE on AWS cluster.

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:

Requirements

  • Make sure the user cluster that you install Anthos Service Mesh on has at least 4 vCPUs, 15 GB memory, and 4 replicas.

  • Review Naming service ports before you deploy workloads.

  • Make sure your cluster version is listed in Supported environments.

Restrictions

Only one installation of Anthos Service Mesh per Google Cloud project is supported. Multiple mesh deployments in a single project aren't supported.

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:

  1. Authenticate with the Cloud SDK:

    gcloud auth login
    
  2. Update the components:

    gcloud components update
    
  3. Install kubectl:

    gcloud components install kubectl
    
  4. If you want to deploy and test your installation with the Online Boutique sample application, install kpt:

    gcloud components install kpt
    
  5. Switch context to your user cluster:

    kubectl config use-context CLUSTER_NAME
  6. 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

  1. Download the Anthos Service Mesh installation file to your current working directory:

    curl -LO https://storage.googleapis.com/gke-release/asm/istio-1.6.8-asm.9-linux-amd64.tar.gz
  2. Download the signature file and use openssl to verify the signature:

    curl -LO https://storage.googleapis.com/gke-release/asm/istio-1.6.8-asm.9-linux-amd64.tar.gz.1.sig
    openssl dgst -verify - -signature istio-1.6.8-asm.9-linux-amd64.tar.gz.1.sig istio-1.6.8-asm.9-linux-amd64.tar.gz <<'EOF'
    -----BEGIN PUBLIC KEY-----
    MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEWZrGCUaJJr1H8a36sG4UUoXvlXvZ
    wQfk16sxprI2gOJ2vFFggdq3ixF2h4qNBt0kI7ciDhgpwS8t+/960IsIgw==
    -----END PUBLIC KEY-----
    EOF

    The expected output is: Verified OK

  3. 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.8-asm.9-linux-amd64.tar.gz

    The command creates an installation directory in your current working directory named istio-1.6.8-asm.9. The istio-1.6.8-asm.9/bin directory contains the istioctl command-line tool that you use to install Anthos Service Mesh.

  4. Ensure that you're in the Anthos Service Mesh installation's root directory.

    cd istio-1.6.8-asm.9
  5. For convenience, add the /bin directory to your PATH:

    export PATH=$PWD/bin:$PATH
  6. Create a namespace called istio-system for the control plane components:

    kubectl create namespace istio-system

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

Install Anthos Service Mesh:

istioctl install --set profile=asm-multicloud

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, GKE on AWS creates private Ingress services.

  1. 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"
    
  2. Install Anthos Service Mesh:

    istioctl install --set profile=asm-multicloud \
     -f istio-operator-internal-lb.yaml
    

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

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.

Before you deploy workloads, make sure to configure sidecar proxy injection so that Anthos Service Mesh can monitor and secure traffic.

Any workloads that were running on your cluster before you installed Anthos Service Mesh need to have the sidecar proxy injected or updated so they have the current Anthos Service Mesh version. Before you deploy new workloads, make sure to configure sidecar proxy injection so that Anthos Service Mesh can monitor and secure traffic.

You can enable automatic sidecar injection with one command, for example:

kubectl label namespace NAMESPACE istio-injection=enabled --overwrite

where NAMESPACE is the name of the namespace for your application's services or default if you didn't explicitly create a namespace.

For more information, see Injecting sidecar proxies.

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:

  1. Create the INGRESS_HOST environment variable:

    export INGRESS_HOST=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].hostname}')
    
  2. Create the INGRESS_PORT environment variable:

    export INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].port}')
    
  3. To test, deploy a sample application, such as the Online Boutique.

  4. To access the application on your browser, use the value of $INGRESS_HOST:$INGRESS_PORT in the URL.