highly available cross region deployments with kubernetes
play

Highly available cross-region deployments with Kubernetes Bastian - PowerPoint PPT Presentation

Highly available cross-region deployments with Kubernetes Bastian Hofmann @BastianHofmann Container orchestration platform Deploy, run and scale your services in isolated containers No vendor lock in Standardized APIs Runs on Your laptop


  1. Highly available cross-region deployments with Kubernetes Bastian Hofmann @BastianHofmann

  2. Container orchestration platform

  3. Deploy, run and scale your services in isolated containers

  4. No vendor lock in

  5. Standardized APIs

  6. Runs on

  7. Your laptop

  8. Bare metal

  9. Cloud Providers

  10. And if you don't want to install and maintain Kubernetes yourself

  11. Managed Kubernetes

  12. Self-healing built in

  13. But what happens when a complete datacenter is not available

  14. Multi-Region Kubernetes Setups

  15. Why

  16. Availability

  17. Scalability

  18. More Points-of-Presence

  19. Reduce dependencies on one single cloud provider

  20. Because of the standardised API across providers Kubernetes can help

  21. Features

  22. Scheduling by Node Labels

  23. failure- domain.beta.kubernetes.io/ region=dbl failure- domain.beta.kubernetes.io/ zone=dbl1

  24. Regions vs availability zone

  25. failure- domain.beta.kubernetes.io/ region=dbl failure- domain.beta.kubernetes.io/ zone=dbl1

  26. apiVersion: apps/v1 kind: Deployment metadata: name: nginx spec: template: spec: containers: - image: nginx name: nginx nodeSelector: failure-domain.beta.kubernetes.io/region: dbl

  27. Affinities

  28. spec: affinity: podAntiAffinity: requiredDuringSchedulingIgnoredDuringExecution: - topologyKey: "failure-domain.beta.kubernetes.io/ region" labelSelector: matchLabels: app: nginx

  29. Service discovery with built in DNS

  30. apiVersion: v1 kind: Service metadata: name: nginx spec: type: ClusterIP ports: - port: 80 targetPort: 80 selector: app: nginx

  31. External LoadBalancers

  32. apiVersion: v1 kind: Service metadata: name: nginx spec: type: LoadBalancer ports: - port: 80 targetPort: 80 selector: app: nginx

  33. external-dns

  34. StorageClasses

  35. Some storage providers support dynamic volume provisioning

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

  37. Challenges

  38. Especially over different regions

  39. External load balancing and traffic management

  40. Internal load balancing

  41. Connectivity between private networks

  42. Kubernetes DNS across multiple clusters

  43. Latencies

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

  45. Synchronising Deployments across multiple clusters

  46. Storage

  47. Data replication

  48. Split-brain problem

  49. Possible setups

  50. One cluster across AZs in one region

  51. One cluster across regions

  52. Multiple clusters connected via VPN

  53. One cluster setup

  54. One Kubernetes cluster across multiple availability zones

  55. Zone 1 Zone 2 Kubernetes Master Components Curl Nginx Service Nginx Nginx

  56. Easiest option

  57. Low latencies

  58. You can use one network

  59. All pods and services can talk with each other

  60. One cluster => one internal DNS

  61. Service Discovery and internal load balancing works

  62. External LoadBalancers work

  63. LB Zone 1 Zone 2 Kubernetes Master Components Curl Nginx Service Nginx Nginx

  64. You can mount storage across AZ

  65. One cluster state => One deployment

  66. But what if the whole region is down?

  67. One Kubernetes cluster across multiple regions and VPN connection between networks

  68. Region 1 Region 2 Kubernetes Master Components WireGuard VPN Curl Nginx Service Nginx Nginx

  69. Latencies get higher by distance

  70. You need a VPN to connect the networks

  71. WireGuard as a VPN

  72. https:/ /github.com/squat/kilo

  73. Kilo gets all Nodes from Kubernetes

  74. Discovers regions and zones by Kubernetes Node labels

  75. Configures WireGuard

  76. Routing tables

  77. All pods and services can talk with each other

  78. One cluster => one internal DNS

  79. Service Discovery and internal load balancing works

  80. You need a solution for external load balancing

  81. Region 1 Region 2 LB LB Kubernetes Master Components WireGuard VPN Curl Nginx Service Nginx Nginx

  82. You have to replicate storage yourself

  83. Not every Storage provider supports dynamic volume provisioning

  84. One cluster state => One deployment

  85. Demo

  86. Multi cluster setup

  87. Connecting multiple clusters with a VPN

  88. Cluster 1 Cluster 2 Kubernetes Master Kubernetes Master Components Components WireGuard VPN Curl Nginx Service Nginx Service Nginx Nginx

  89. WireGuard as a VPN

  90. https:/ /github.com/squat/kilo

  91. All pods and services can talk with each other

  92. Separate clusters => separate internal DNS

  93. For service discovery configure each internal DNS to resolve to other clusters

  94. 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 }

  95. 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 }

  96. Internal load balancing works

  97. You have to replicate storage yourself

  98. Every cluster has their own StorageClass that works on all nodes

Recommend


More recommend