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

@ -6,6 +6,12 @@ Notable changes between versions.
* Update Calico from v3.6.0 to v3.6.1 * Update Calico from v3.6.0 to v3.6.1
#### AWS
* Add ability to load balance TCP applications ([#443](https://github.com/poseidon/typhoon/pull/443))
* Output the network load balancer ARN as `nlb_id`
* Accept a `worker_target_groups` (ARN) list to which worker instances should be added
#### Google Cloud #### Google Cloud
* Add ability to load balance TCP/UDP applications ([#442](https://github.com/poseidon/typhoon/pull/442)) * Add ability to load balance TCP/UDP applications ([#442](https://github.com/poseidon/typhoon/pull/442))

View File

@ -37,6 +37,11 @@ output "kubeconfig" {
# Outputs for custom load balancing # 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" { output "worker_target_group_http" {
description = "ARN of a target group of workers for HTTP traffic" description = "ARN of a target group of workers for HTTP traffic"
value = "${module.workers.target_group_http}" 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" 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" { variable "controller_clc_snippets" {
type = "list" type = "list"
description = "Controller Container Linux Config snippets" description = "Controller Container Linux Config snippets"

View File

@ -11,6 +11,7 @@ module "workers" {
os_image = "${var.os_image}" os_image = "${var.os_image}"
disk_size = "${var.disk_size}" disk_size = "${var.disk_size}"
spot_price = "${var.worker_price}" spot_price = "${var.worker_price}"
target_groups = ["${var.worker_target_groups}"]
# configuration # configuration
kubeconfig = "${module.bootkube.kubeconfig-kubelet}" 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" 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" { variable "clc_snippets" {
type = "list" type = "list"
description = "Container Linux Config snippets" description = "Container Linux Config snippets"

View File

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

View File

@ -242,6 +242,7 @@ Reference the DNS zone id with `"${aws_route53_zone.zone-for-clusters.zone_id}"`
| disk_size | Size of the EBS volume in GB | "40" | "100" | | disk_size | Size of the EBS volume in GB | "40" | "100" |
| disk_type | Type of the EBS volume | "gp2" | standard, gp2, io1 | | disk_type | Type of the EBS volume | "gp2" | standard, gp2, io1 |
| disk_iops | IOPS of the EBS volume | "0" (i.e. auto) | "400" | | disk_iops | IOPS of the EBS volume | "0" (i.e. auto) | "400" |
| worker_target_groups | Target group ARNs to which worker instances should be added | [] | ["${aws_lb_target_group.app.id}"] |
| worker_price | Spot price in USD for workers. Leave as default empty string for regular on-demand instances | "" | "0.10" | | worker_price | Spot price in USD for workers. Leave as default empty string for regular on-demand instances | "" | "0.10" |
| controller_clc_snippets | Controller Container Linux Config snippets | [] | [example](/advanced/customization/) | | controller_clc_snippets | Controller Container Linux Config snippets | [] | [example](/advanced/customization/) |
| worker_clc_snippets | Worker Container Linux Config snippets | [] | [example](/advanced/customization/) | | worker_clc_snippets | Worker Container Linux Config snippets | [] | [example](/advanced/customization/) |