项目作者: walmartdigital

项目描述 :
[DEPRECATED] An Azure Load Balancer Terraform module for K8s Cluster.
高级语言: HCL
项目地址: git://github.com/walmartdigital/k8s-lb-module.git
创建时间: 2018-12-05T17:21:26Z
项目社区:https://github.com/walmartdigital/k8s-lb-module

开源协议:

下载


Azure Load Balancer Module

This module create all required resources for deploy a public and a private load balancer on Azure. If more tnah one ip and load balancer its needed
USE STANDARD SKU.

Usage

Create a public load balancer

  1. module "az_lb" {
  2. source = "git::https://github.com/walmartdigital/k8s-lb-module.git?ref=0.1.0"
  3. resource_group = "my-resource-group"
  4. cluster_name = "my-cluster-name"
  5. environment = "staging"
  6. name_suffix = "abc123"
  7. lb_ports = {
  8. http = ["80", "Tcp", "80", "80"]
  9. https = ["443", "Tcp", "443", "443"]
  10. }
  11. }

Create a private load balancer with public and private ips

First its needed define the ips that will be used by the load balancer rules. They can be as many public and private ips as are needed:

  1. public_ips = {
  2. cockroach = {
  3. name = "cockroach"
  4. target = "workers"
  5. }
  6. }
  7. private_ips = {
  8. dns = {
  9. name = "dns"
  10. target = "workers"
  11. address_allocation = "Dynamic"
  12. ip_address = ""
  13. }
  14. }

The must be added the load balancer rules and set the visibility and the ip (frontend) that will be used:

  1. lb_ports = [
  2. {
  3. name = "dns"
  4. port = "53"
  5. protocol = "Udp"
  6. lb_rule_port_kube_dns = data.consul_keys.input.var.lb_rule_port_kube_dns
  7. lb_rule_port_kube_dns_probe = data.consul_keys.input.var.lb_rule_port_kube_dns_probe
  8. health = ""
  9. target = "workers"
  10. frontend = "dns"
  11. visibility = "private"
  12. },
  13. {
  14. name = "grpc"
  15. port = "26257"
  16. protocol = "Tcp"
  17. lb_rule_port_kube_dns = data.consul_keys.input.var.lb_rule_port_grpc
  18. lb_rule_port_kube_dns_probe = data.consul_keys.input.var.lb_rule_port_grpc
  19. health = ""
  20. target = "workers"
  21. frontend = "cockroach"
  22. visibility = "public"
  23. },
  24. {
  25. name = "http"
  26. port = "8080"
  27. protocol = "Tcp"
  28. lb_rule_port_kube_dns = data.consul_keys.input.var.lb_rule_port_http
  29. lb_rule_port_kube_dns_probe = data.consul_keys.input.var.lb_rule_port_http
  30. health = "/health"
  31. target = "workers"
  32. frontend = "cockroach"
  33. visibility = "public"
  34. }
  35. ]

Arguments

  • resource_group: A string representing the resource group where all resources will be provisioned, this resource group needs to be previously created (required).
  • cluster_name: A string used as the cluster name.
  • environment: A string used as environment where the cluster is deployed.
  • name_suffix: A string used as name suffix.
  • lb_type: A string used as the load balancer type. Default is public. If the load balancer type is private, you need to provide the following string variables: subnet_id (required), frontend_private_ip_address_allocation (optional) and frontend_private_ip_address (optional).
  • lb_ports: A list of map used to provide the load balancer rules, each item is a list, and the value is a map with the following fields:

    • name
    • port
    • protocol
    • lb_rule_port_kube_dns
    • lb_rule_port_kube_dns_probe
    • health
    • target
    • frontend
    • visibility

Outputs

  • load_balancer_public_ip: The load balancer public IP.
  • load_balancer_private_ip: The load balancer private IP.
  • lb_address_pool_id: The load balancer address pool ID.