Google Kubernetes Engine
This example demonstrates how to use Istio's multicluster feature to join 2 Google Kubernetes Engine2 clusters together, using the multicluster installation instructions3.
Before you begin
In addition to the prerequisites for installing Istio the following setup is required for this example:
This sample requires a valid Google Cloud Platform project with billing enabled. If you are not an existing GCP user, you may be able to enroll for a $300 US Free Trial4 credit.
- Create a Google Cloud Project5 to host your GKE clusters.
Install and initialize the Google Cloud SDK6
Create the GKE Clusters
Set the default project for
gcloud
to perform actions on:Create 2 GKE clusters for use with the multicluster feature. Note:
--enable-ip-alias
is required to allow inter-cluster direct pod-to-pod communication. Thezone
value must be one of the GCP zones7.Wait for clusters to transition to the
RUNNING
state by polling their statuses via the following command:Get the clusters’ credentials (command details8):
Validate
kubectl
access to each cluster:Check cluster-1
Check cluster-2:
Create a
cluster-admin
cluster role binding tied to the Kubernetes credentials associated with your GCP user. Note: replace `mygcp@gmail.com9` with the email tied to your Google Cloud account:
Create a Google Cloud firewall rule
To allow the pods on each cluster to directly communicate, create the following rule:
Install the Istio control plane
The following generates an Istio installation manifest, installs it, and enables automatic sidecar injection in
the default
namespace:
Wait for pods to come up by polling their statuses via the following command:
Generate remote cluster manifest
Get the IPs of the control plane pods:
Generate remote cluster manifest:
Install remote cluster manifest
The following installs the minimal Istio components and enables automatic sidecar injection on
the namespace default
in the remote cluster:
Create remote cluster's kubeconfig for Istio Pilot
The istio-remote
Helm chart creates a service account with minimal access for use by Istio Pilot
discovery.
Prepare environment variables for building the
kubeconfig
file for the service accountistio-multi
:NOTE: An alternative to
base64 --decode
isopenssl enc -d -base64 -A
on many systems.Create a
kubeconfig
file in the working directory for the service accountistio-multi
:
At this point, the remote clusters’ kubeconfig
files have been created in the ${WORK_DIR}
directory.
The filename for a cluster is the same as the original kubeconfig
cluster name.
Configure Istio control plane to discover the remote cluster
Create a secret and label it properly for each remote cluster:
Deploy Bookinfo Example Across Clusters
Install Bookinfo on the first cluster. Remove the
reviews-v3
deployment to deploy on remote:Create the
reviews-v3.yaml
manifest for deployment on the remote:Note: The
ratings
service definition is added to the remote cluster becausereviews-v3
is a client ofratings
and creating the service object creates a DNS entry. The Istio sidecar in thereviews-v3
pod will determine the properratings
endpoint after the DNS lookup is resolved to a service address. This would not be necessary if a multicluster DNS solution were additionally set up, e.g. as in a federated Kubernetes environment.Install the
reviews-v3
deployment on the remote.Get the
istio-ingressgateway
service's external IP to access thebookinfo
page to validate that Istio is including the remote'sreviews-v3
instance in the load balancing of reviews versions:Access
http://<GATEWAY_IP>/productpage
repeatedly and each version of reviews should be equally loadbalanced, includingreviews-v3
in the remote cluster (red stars). It may take several accesses (dozens) to demonstrate the equal loadbalancing betweenreviews
versions.
Uninstalling
The following should be done in addition to the uninstall of Istio as described in the Kubernetes multicluster installation instructions3:
Delete the Google Cloud firewall rule:
Delete the
cluster-admin
cluster role binding from each cluster no longer being used for Istio:Delete any GKE clusters no longer in use. The following is an example delete command for the remote cluster,
cluster-2
:
See also
IBM Cloud Kubernetes Service & IBM Cloud Private10
Example multicluster between IBM Cloud Kubernetes Service & IBM Cloud Private.
Example multicluster IBM Cloud Private install of Istio.
Install Istio with multicluster support.
Instructions to download the Istio release.
Instructions to setup a Google Kubernetes Engine cluster for Istio.
Describes the options available when installing Istio using the included Helm chart.