Add ability to load balance TCP applications on AWS

* Add ability to load balance TCP applications (e.g. NodePort)
* Output the network load balancer ARN as `nlb_id`
* Accept a `worker_target_groups` (ARN) list to which worker
instances should be added
* AWS NLBs and target groups don't support UDP
This commit is contained in:
Dalton Hubble
2019-03-31 23:22:47 -07:00
parent aaa8e0261a
commit 60265f9b58
7 changed files with 26 additions and 0 deletions

View File

@ -37,6 +37,11 @@ output "kubeconfig" {
# Outputs for custom load balancing
output "nlb_id" {
description = "ARN of the Network Load Balancer"
value = "${aws_lb.nlb.id}"
}
output "worker_target_group_http" {
description = "ARN of a target group of workers for HTTP traffic"
value = "${module.workers.target_group_http}"

View File

@ -71,6 +71,12 @@ variable "worker_price" {
description = "Spot price in USD for autoscaling group spot instances. Leave as default empty string for autoscaling group to use on-demand instances. Note, switching in-place from spot to on-demand is not possible: https://github.com/terraform-providers/terraform-provider-aws/issues/4320"
}
variable "worker_target_groups" {
type = "list"
description = "Additional target group ARNs to which worker instances should be added"
default = []
}
variable "controller_clc_snippets" {
type = "list"
description = "Controller Container Linux Config snippets"

View File

@ -11,6 +11,7 @@ module "workers" {
os_image = "${var.os_image}"
disk_size = "${var.disk_size}"
spot_price = "${var.worker_price}"
target_groups = ["${var.worker_target_groups}"]
# configuration
kubeconfig = "${module.bootkube.kubeconfig-kubelet}"

View File

@ -64,6 +64,12 @@ variable "spot_price" {
description = "Spot price in USD for autoscaling group spot instances. Leave as default empty string for autoscaling group to use on-demand instances. Note, switching in-place from spot to on-demand is not possible: https://github.com/terraform-providers/terraform-provider-aws/issues/4320"
}
variable "target_groups" {
type = "list"
description = "Additional target group ARNs to which instances should be added"
default = []
}
variable "clc_snippets" {
type = "list"
description = "Container Linux Config snippets"

View File

@ -19,6 +19,7 @@ resource "aws_autoscaling_group" "workers" {
target_group_arns = [
"${aws_lb_target_group.workers-http.id}",
"${aws_lb_target_group.workers-https.id}",
"${var.target_groups}",
]
lifecycle {