Anthos Service Mesh 1.6

Installing Anthos Service Mesh on GKE on Google Cloud

This page explains how to do a clean installation of Anthos Service Mesh version 1.6.8 on a GKE on Google Cloud cluster. If you have a previous version of Anthos Service Mesh installed, refer to Upgrading Anthos Service Mesh on GKE.

Before you begin

Before you install Anthos Service Mesh, make sure that you have:

Setting credentials and permissions

  1. 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: {}

  1. Get authentication credentials to interact with the cluster:

    gcloud container clusters get-credentials ${CLUSTER_NAME}
    
  2. 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

    Linux

  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 /dev/stdin -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 that contains:

    • Sample applications in the samples directory.
    • The istioctl command-line tool that you use to install Anthos Service Mesh is in the bin directory.
    • The Anthos Service Mesh configuration profiles are in the install/kubernetes/operator/profiles directory.

  4. Mac OS

  5. 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-osx.tar.gz
  6. 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-osx.tar.gz.1.sig
    openssl dgst -sha256 -verify /dev/stdin -signature istio-1.6.8-asm.9-osx.tar.gz.1.sig istio-1.6.8-asm.9-osx.tar.gz <<'EOF'
    -----BEGIN PUBLIC KEY-----
    MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEWZrGCUaJJr1H8a36sG4UUoXvlXvZ
    wQfk16sxprI2gOJ2vFFggdq3ixF2h4qNBt0kI7ciDhgpwS8t+/960IsIgw==
    -----END PUBLIC KEY-----
    EOF

    The expected output is: Verified OK

  7. 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-osx.tar.gz

    The command creates an installation directory in your current working directory named istio-1.6.8-asm.9 that contains:

    • Sample applications in the samples directory.
    • The istioctl command-line tool that you use to install Anthos Service Mesh is in the bin directory.
    • The Anthos Service Mesh configuration profiles are in the install/kubernetes/operator/profiles directory.

  8. Windows

  9. 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-win.zip
  10. 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-win.zip.1.sig
    openssl dgst -verify - -signature istio-1.6.8-asm.9-win.zip.1.sig istio-1.6.8-asm.9-win.zip <<'EOF'
    -----BEGIN PUBLIC KEY-----
    MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEWZrGCUaJJr1H8a36sG4UUoXvlXvZ
    wQfk16sxprI2gOJ2vFFggdq3ixF2h4qNBt0kI7ciDhgpwS8t+/960IsIgw==
    -----END PUBLIC KEY-----
    EOF

    The expected output is: Verified OK

  11. 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-win.zip

    The command creates an installation directory in your current working directory named istio-1.6.8-asm.9 that contains:

    • Sample applications in the samples directory.
    • The istioctl command-line tool that you use to install Anthos Service Mesh is in the bin directory.
    • The Anthos Service Mesh configuration profiles are in the install/kubernetes/operator/profiles directory.

  12. Ensure that you're in the Anthos Service Mesh installation's root directory.
    cd istio-1.6.8-asm.9
  13. For convenience, add the tools in the /bin directory to your PATH:
    export PATH=$PWD/bin:$PATH

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: We recommend that you download this package, which enables Mesh CA.

  • asm-citadel: Optionally, you can enable Citadel (now incorporated in istiod) as the CA. We recommend that you only use Citadel if you have a custom CA.

To prepare the resource configuration files:

  1. 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.

  2. Change to the directory where you want to download the Anthos Service Mesh package.

  3. 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
    
  4. Set the project ID for the project that the cluster was created in:

    kpt cfg set asm gcloud.core.project ${PROJECT_ID}
    
  5. Set the project number for the environ host project:

    kpt cfg set asm gcloud.project.environProjectNumber ${ENVIRON_PROJECT_NUMBER}
    
  6. Set the cluster name:

    kpt cfg set asm gcloud.container.cluster ${CLUSTER_NAME}
    
  7. Set the default zone or region:

    kpt cfg set asm gcloud.compute.location ${CLUSTER_LOCATION}
    
  8. 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:

      kpt cfg set asm anthos.servicemesh.profile asm-gcp-multiproject
      
  9. If you set the asm-gcp profile, skip to the next step. If you set the asm-gcp-multiprojectyou profile and downloaded the asm package, which enables Mesh CA, you need to configure the trust domain aliases for the other projects that will form the multi-cluster service mesh.

    1. Get the project ID of all clusters that will be in the multi-cluster mesh.

    2. For each 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, and PROJECT_ID_3 with the project IDs for all the projects (including the current project).

      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, you have to enable cross-cluster load balancing.

  10. Optionally, you can check in the resource configuration files to your own source control system, such as Cloud Source Repositories, so that you can track changes to the files.

Installing Anthos Service Mesh

  1. If you are using Citadel as the certificate authority, and you want to use a custom CA, run the following commands:

    kubectl create namespace istio-system
    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.

  2. Run the following command to install Anthos Service Mesh 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
  3. If you used the asm-gcp profile, run the following command to enable the Anthos Service Mesh UI in Cloud Console:

    kubectl apply -f asm/canonical-service/controller.yaml

    If you used the asm-gcp-multiproject profile, currently telemetry data isn't displayed in the Anthos Service Mesh dashboards in Cloud Console. However, you can still view logs in Cloud Logging and metrics in Cloud Monitoring for each project.

Auto mutual TLS (auto mTLS) is enabled by default. With auto mTLS, a client sidecar proxy automatically detects if the server has a sidecar. The client sidecar sends mTLS to workloads with sidecars and sends plain text traffic to workloads without sidecars.

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

Validating the installation

We recommend that you use the asmctl analysis tool to validate the basic configuration of your project, cluster, and workloads. If an asmctl test fails, asmctl recommends solutions, if possible. The asmctl validate command runs basic tests that check:

  1. That the APIs required by Anthos Service Mesh are enabled on the project.
  2. That the Istio-Ingressgateway is properly configured to call Mesh CA.
  3. The general health of Istiod and Istio-Ingressgateway.

If you run the asmctl validate command with the optional --with-testing-workloads flag, in addition to the basic tests, asmctl runs security tests that check:

  1. Mutual TLS (mTLS) communication is configured properly.
  2. Mesh CA can issue certificates.

To run the security tests, asmctl deploys workloads on your cluster in a test namespace, runs the mTLS communication tests, outputs the results, and deletes the test namespace. Note that the security tests only work with Mesh CA. If you are using Citadel as the CA, the security tests fail.

To run asmctl:

  1. Ensure that gcloud application-default credentials are set:

     gcloud auth application-default login
    
  2. If you haven't already, get authentication credentials to interact with the cluster:

     gcloud container clusters get-credentials ${CLUSTER_NAME}
    
  3. To run the basic tests (assuming istio-1.6.8-asm.9/bin) is in yourPATH):

    asmctl validate
    

    On success, the command responds with output similar to the following:

    [asmctl version 0.4.1]
    Using Kubernetes context: example-context_us-central1-example-cluster
    To change the context, use the --context flag
    Validating enabled APIs
    OK
    Validating ingressgateway configuration
    OK
    Validating istio system
    OK
  4. If you enabled Mesh CA: To run both the basic and the security tests:

    asmctl validate --with-testing-workloads
    

    On success, the command responds with output similar to the following:

    [asmctl version 0.4.1]
    Using Kubernetes context: example-context_us-central1-example-cluster
    To change the context, use the --context flag
    Validating enabled APIs
    OK
    Validating ingressgateway configuration
    OK
    Validating istio system
    OK
    
    [asmctl version 0.4.1]
    Using Kubernetes context: example-context_us-central1-example-cluster
    To change the context, use the --context flag
    Validating enabled APIs
    OK
    Validating ingressgateway configuration
    OK
    Validating istio system
    OK
    Validating sample traffic
    Launching example services...
    Sent traffic to example service http code: 200
    verified mTLS configuration
    OK
    Validating issued certs
    OK

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.

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 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 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 Cloud Console after you deploy workloads.

Access to Anthos Service Mesh in the 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 Cloud Console.

  1. In the Google Cloud Console, go to Anthos Service Mesh.

    Go to Anthos Service Mesh

  2. Select the Cloud project from the drop-down list on the menu bar.

  3. 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 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:

  1. In the Google Cloud Console, go to the Monitoring page:

    Go to Monitoring

  2. 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 environ to gain access to the unified user interface in the Cloud Console. An environ provides a unified way to view and manage the clusters and their workloads, including clusters outside Google Cloud.

See Registering clusters to the environ for information on registering your cluster.

What's next