Replicated control planes
Follow this guide to install an Istio multicluster deployment with replicated control plane instances in every cluster and using gateways to connect services across clusters.
Instead of using a shared Istio control plane to manage the mesh, in this configuration each cluster has its own Istio control plane installation, each managing its own endpoints. All of the clusters are under a shared administrative control for the purposes of policy enforcement and security.
A single Istio service mesh across the clusters is achieved by replicating shared services and namespaces and using a common root CA in all of the clusters. Cross-cluster communication occurs over the Istio gateways of the respective clusters.
Prerequisites
Two or more Kubernetes clusters with versions: 1.15, 1.16, 1.17, 1.18.
Authority to deploy the Istio control plane1 on each Kubernetes cluster.
The IP address of the
istio-ingressgateway
service in each cluster must be accessible from every other cluster, ideally using L4 network load balancers (NLB). Not all cloud providers support NLBs and some require special annotations to use them, so please consult your cloud provider’s documentation for enabling NLBs for service object type load balancers. When deploying on platforms without NLB support, it may be necessary to modify the health checks for the load balancer to register the ingress gateway.A Root CA. Cross cluster communication requires mutual TLS connection between services. To enable mutual TLS communication across clusters, each cluster’s Istio CA will be configured with intermediate CA credentials generated by a shared root CA. For illustration purposes, you use a sample root CA certificate available in the Istio installation under the
samples/certs
directory.
Deploy the Istio control plane in each cluster
Generate intermediate CA certificates for each cluster’s Istio CA from your organization’s root CA. The shared root CA enables mutual TLS communication across different clusters.
For illustration purposes, the following instructions use the certificates from the Istio samples directory for both clusters. In real world deployments, you would likely use a different CA certificate for each cluster, all signed by a common root CA.
Run the following commands in every cluster to deploy an identical Istio control plane configuration in all of them.
Create a Kubernetes secret for your generated CA certificates using a command similar to the following. See Certificate Authority (CA) certificates2 for more details.
Install Istio:
For further details and customization options, refer to the installation instructions1.
Setup DNS
Providing DNS resolution for services in remote clusters will allow
existing applications to function unmodified, as applications typically
expect to resolve services by their DNS names and access the resulting
IP. Istio itself does not use the DNS for routing requests between
services. Services local to a cluster share a common DNS suffix
(e.g., svc.cluster.local
). Kubernetes DNS provides DNS resolution for these
services.
To provide a similar setup for services from remote clusters, you name
services from remote clusters in the format
<name>.<namespace>.global
. Istio also ships with a CoreDNS server that
will provide DNS resolution for these services. In order to utilize this
DNS, Kubernetes’ DNS must be configured to stub a domain
for .global
.
Create one of the following ConfigMaps, or update an existing one, in each cluster that will be calling services in remote clusters (every cluster in the general case):
Configure application services
Every service in a given cluster that needs to be accessed from a different remote
cluster requires a ServiceEntry
configuration in the remote cluster.
The host used in the service entry should be of the form <name>.<namespace>.global
where name and namespace correspond to the service’s name and namespace respectively.
To demonstrate cross cluster access, configure the sleep service7 running in one cluster to call the httpbin8 service running in a second cluster. Before you begin:
- Choose two of your Istio clusters, to be referred to as
cluster1
andcluster2
.
You can use the
kubectl
command to access both thecluster1
andcluster2
clusters with the--context
flag, for examplekubectl get pods --context cluster1
. Use the following command to list your contexts:Store the context names of your clusters in environment variables:
Configure the example services
Deploy the
sleep
service incluster1
.Deploy the
httpbin
service incluster2
.Export the
cluster2
gateway address:This command sets the value to the gateway’s public IP, but note that you can set it to a DNS name instead, if you have one.
Create a service entry for the
httpbin
service incluster1
.To allow
sleep
incluster1
to accesshttpbin
incluster2
, we need to create a service entry for it. The host name of the service entry should be of the form<name>.<namespace>.global
where name and namespace correspond to the remote service’s name and namespace respectively.For DNS resolution for services under the
*.global
domain, you need to assign these services an IP address.If the global services have actual VIPs, you can use those, but otherwise we suggest using IPs from the class E addresses range
240.0.0.0/4
. Application traffic for these IPs will be captured by the sidecar and routed to the appropriate remote service.The configurations above will result in all traffic in
cluster1
forhttpbin.bar.global
on any port to be routed to the endpoint$CLUSTER2_GW_ADDR:15443
over a mutual TLS connection.The gateway for port 15443 is a special SNI-aware Envoy preconfigured and installed when you deployed the Istio control plane in the cluster. Traffic entering port 15443 will be load balanced among pods of the appropriate internal service of the target cluster (in this case,
httpbin.bar
incluster2
).Verify that
httpbin
is accessible from thesleep
service.
Send remote traffic via an egress gateway
If you want to route traffic from cluster1
via a dedicated egress gateway, instead of directly from the sidecars,
use the following service entry for httpbin.bar
instead of the one in the previous section.
If $CLUSTER2_GW_ADDR
is an IP address, use the $CLUSTER2_GW_ADDR - IP address
option. If $CLUSTER2_GW_ADDR
is a hostname, use the $CLUSTER2_GW_ADDR - hostname
option.
- Export the
cluster1
egress gateway address:
- Apply the httpbin-bar service entry:
If the ${CLUSTER2_GW_ADDR}
is a hostname, you can use resolution: DNS
for the endpoint resolution:
Cleanup the example
Execute the following commands to clean up the example services.
Cleanup
cluster1
:Cleanup
cluster2
:Cleanup
environment variables
:
Version-aware routing to remote services
If the remote service has multiple versions, you can add labels to the service entry endpoints. For example:
You can then create virtual services and destination rules
to define subsets of the httpbin.bar.global
service using the appropriate gateway label selectors.
The instructions are the same as those used for routing to a local service.
See multicluster version routing11
for a complete example.
Uninstalling
Uninstall Istio by running the following commands on every cluster:
Summary
Using Istio gateways, a common root CA, and service entries, you can configure a single Istio service mesh across multiple Kubernetes clusters. Once configured this way, traffic can be transparently routed to remote clusters without any application involvement. Although this approach requires a certain amount of manual configuration for remote service access, the service entry creation process could be automated.