Table of Contents |
---|
Scenario 01 - Considering microservice replication across multiple locations with replication within each cluster
Diagram
Testing Steps
- Install ISTIO - Deploy istio control plane in each cluster. (NOTE - For testing use common root CA)
- Configure DNS - To provide resolution of service from remote clusters, istio uses its own DNS called istiocoredns which provides the resolution of remote istio services
Eg:
NOTE - In order to utilize istiocoredns, Kubernetes DNS' must be configured to stub a domain in a specific format
3. Use configMap to add a stub domain to the Kubernetes's DNS.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
kind: ConfigMap data: Corefile: | .:53 { errors health kubernetes cluster.local in-addr.arpa ip6.arpa { pods insecure upstream fallthrough in-addr.arpa ip6.arpa } prometheus :9153 proxy . /etc/resolv.conf cache 30 loop reload loadbalance } global:53 { errors cache 30 proxy . 10.43.57.78 } |
4. Add Istio service entry with details of the remote servers (server service 03 and server service 04) to the cluster where the client is running
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
apiVersion: networking.istio.io/v1alpha3 kind: ServiceEntry metadata: name: servicename-bar spec: hosts: # template for the remote service name - <servicename.namespace.global> - httpbin.bar.global # Treat remote cluster services as part of the service mesh # as all clusters in the service mesh share the same root of trust. location: MESH_INTERNAL ports: - name: http1 number: 8000 protocol: http resolution: DNS addresses: # the IP address to which httpbin.bar.global will resolve to # must be unique for each remote service, within a given cluster. # This address need not be routable. Traffic for this IP will be captured # by the sidecar and routed appropriately. - 240.0.0.2 endpoints: # This is the routable address of the ingress gateway in cluster2 that # sits in front of sleep.foo service. Traffic from the sidecar will be # routed to this address. - address: 172.25.55.50 ports: http1: 15443 # Do not change this port value |
5. Create istio virtual service on the client cluster with all the destination server that it wants to connect. The API calls from the client can be load balanced by assigned weight to each server. This can be achieved using DestinationRule as well.
6. Verify that client pod is sending requests to servers in the order of assigned weight
IN PROGRESS......