FutureSharks / tf-kops-cluster

No longer maintained. Use Terraform EKS module instead.
https://github.com/terraform-aws-modules/terraform-aws-eks
GNU General Public License v3.0
60 stars 22 forks source link

Public subnets as variable #15

Open edahlseng opened 6 years ago

edahlseng commented 6 years ago

It appears that there's no way to specify public subnets for reuse with the cluster -- only new subnets can be created. It would be awesome if public subnets could be specified directly, overriding the creation of new resources.

FutureSharks commented 6 years ago

Hi Eric! This is by design. Public subnets cannot be shared between clusters and must be created per cluster. This is because when Kubernetes creates ELBs for a Loadbalancer services, it looks for subnets that have the KubernetesCluster tag containing the cluster FQDN.

Make sense?

Thanks, Max

edahlseng commented 6 years ago

Hi Max,

Thanks for the information. I'm still getting up to speed with all of the details and nuances of Kubernetes and kops.

Looking at Kubernetes documentation for running in existing VPCs, however, it appears that there's an option to specify the utility (public) subnets for the cluster? Though maybe this is only available in kops 1.8?

FutureSharks commented 6 years ago

So that is interesting, they have changed the behaviour in version 1.8:

This is important, for example, if your utility subnets are shared, you will not be able to launch any services that create Elastic Load Balancers (ELBs). Prior to kops 1.8 KubernetesCluster tag was used for this. This lead to several problems if there were more than one Kubernetes Cluster in a subnet. After you upgraded to kops 1.8 remove KubernetesCluster Tag from subnets otherwise kubernetes.io/cluster/<clustername> won't have any effect!

I'll have to rewrite the subnet stuff for this. Basically the subnets would have to be removed from the module, created outside the module and then tags added for each k8s cluster that would use the shared subnets.