Highly available cross-region deployments with Kubernetes

Highly available cross-region deployments with Kubernetes

Out-of-the-box Kubernetes makes it easy to deploy and scale your applications within one Kubernetes cluster in one single region. But with the Kubernetes Federation API and the use of service meshes like Istio, it’s also possible to deploy an application over multiple clusters in different regions, so that it becomes truly highly available even if a complete region fails.

Bastian Hofmann explains how to set the Kubernetes cluster federation up and how to deploy your applications to make best use of it, especially regarding monitoring, persistent storage, latencies, and data integrity.

Ded87c77266697ee6981c2277bb97633?s=128

Bastian Hofmann

November 06, 2019
Tweet

Transcript

  1. 2.
  2. 7.
  3. 13.
  4. 17.

    Why

  5. 23.
  6. 28.

    apiVersion: apps/v1 kind: Deployment metadata: name: nginx spec: template: spec:

    containers: - image: nginx name: nginx nodeSelector: failure-domain.beta.kubernetes.io/region: dbl
  7. 32.

    apiVersion: v1 kind: Service metadata: name: nginx spec: type: ClusterIP

    ports: - port: 80 targetPort: 80 selector: app: nginx
  8. 34.

    apiVersion: v1 kind: Service metadata: name: nginx spec: type: LoadBalancer

    ports: - port: 80 targetPort: 80 selector: app: nginx
  9. 38.

    apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: standard provisioner: kubernetes.io/gce-pd parameters:

    type: pd-standard volumeBindingMode: WaitForFirstConsumer allowedTopologies: - matchLabelExpressions: - key: failure-domain.beta.kubernetes.io/zone values: - us-central1-a - us-central1-b
  10. 45.
  11. 46.

    Beskow, Paul & Vik, Knut-Helge & Halvorsen, Pål & Griwodz,

    Carsten. (2009). The partial migration of game state and dynamic server selection to reduce latency. Multimedia Tools Appl.. 45. 83-107. 10.1007/s11042-009-0287-7.
  12. 48.
  13. 87.
  14. 90.

    Cluster 1 Cluster 2 WireGuard VPN Kubernetes Master Components Kubernetes

    Master Components Nginx Nginx Nginx Service Nginx Service Curl
  15. 96.

    cluster.region2:53 { forward . 10.10.11.10 } .:53 { kubernetes cluster.local

    cluster.region1 in-addr.arpa ip6.arpa { pods insecure upstream fallthrough in-addr.arpa ip6.arpa } forward . /etc/resolv.conf loop loadbalance }
  16. 97.

    cluster.region1:53 { forward . 10.10.10.10 } .:53 { kubernetes cluster.local

    cluster.region2 in-addr.arpa ip6.arpa { pods insecure upstream fallthrough in-addr.arpa ip6.arpa } forward . /etc/resolv.conf loop loadbalance }
  17. 107.

    Cluster 1 Cluster 2 Kubernetes Master Components Kubernetes Master Components

    Kubefed Controller FederatedService FederatedDeployment
  18. 108.

    Cluster 1 Cluster 2 Kubernetes Master Components Kubernetes Master Components

    Nginx Service Nginx Service Kubefed Controller Kubefed Controller Nginx Nginx
  19. 109.
  20. 111.

    Cluster 1 Cluster 2 WireGuard VPN Kubernetes Master Components Kubernetes

    Master Components Nginx Nginx Nginx Service Nginx Service Curl LB LB
  21. 113.
  22. 115.
  23. 118.
  24. 124.
  25. 128.
  26. 129.
  27. 130.

    Cluster 1 Cluster 2 Istio Gateway Istio Control Plane Kubernetes

    Master Components Kubernetes Master Components Istio Nginx Nginx Nginx Service Nginx Service Istio Gateway Curl
  28. 139.