feat(tf): base infra for coyote - #262
Conversation
|
Test Coverage: 73.48% |
b818094 to
543bbfd
Compare
6276754 to
47f3596
Compare
ad7233e to
08c9df1
Compare
fdf1359 to
c212590
Compare
| name = local.eks_cluster_name | ||
| kubernetes_version = var.k8s_version | ||
| endpoint_private_access = true | ||
| endpoint_public_access = true |
There was a problem hiding this comment.
Can we avoid this? What do we do in the clickhouse clusters?
There was a problem hiding this comment.
We can avoid it. Should I enable just the private access in this PR itself or a separate one that includes the tailscale config ? Fyi: It can be disabled later.
There was a problem hiding this comment.
Ok, we can do it later. Let's just make sure it's on the list.
There was a problem hiding this comment.
I checked this. In order to achieve this we need to have the terraform runner able to connect to the private endpoint of the eks. This way the terraform runner running the terraform code will be able to connect to the EKS. For this we may have to use self hosted terraform runner with the tailscale configured. I don't think this is required but we can do this at a later stage if at all needed for more security.
| @@ -0,0 +1,39 @@ | |||
| resource "helm_release" "metrics_server" { | |||
There was a problem hiding this comment.
I haven't looked into this closely, but can we just do this?
There was a problem hiding this comment.
I have implemented this in the EKS module itself along with a few other addons.
| value = module.net.eks_subnet_ids | ||
| } | ||
|
|
||
| # eks |
| } | ||
| } | ||
|
|
||
| # provider "datadog" { |
There was a problem hiding this comment.
I don't have the valid datadog creds for dev.
|
Ok, some things from actually reviewing the infra in AWS
|
fecafe2 to
4fcd12c
Compare
|
svix-jbrown
left a comment
There was a problem hiding this comment.
Wow, this is a lot of config that's totally distinct from and not compatible with the other two EKS setups we have. What's the long-term plan here? Are we committing to maintaining a totally-separate stack of terraform for this project? Is this just to set up for testing the helm chart/operator/whatever and tear down later?
On an architectural note, I'm skeptical of having the same terraform config create the EKS cluster and also install resources on it; this caused an endless number of problems for clickhouse (the official recommendation is that the config for a provider should not depend on the outcome of something else inside the same terraform state), which is why we have two totally independent terraform instances there. Ideally we would be using Terraform Stacks to get independent execution for the lower level that creates the network/EKS cluster, and the higher level that installs resources onto the cluster. If we don't want to use Stacks, we could also do it by having two different terraform states like we do for clickhouse (or we can just accept that sometimes this will fail in obscure ways).
| } | ||
|
|
||
| module "eks_sa_role_lb_ctrl" { | ||
| source = "terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts" |
There was a problem hiding this comment.
spurious slash
| source = "terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts" | |
| source = "terraform-aws-modules/iam/aws/modules/iam-role-for-service-accounts" |
There was a problem hiding this comment.
Not spurious, it is scoped for the iam-role-for-service-accounts submodule.
| most_recent = true | ||
| } | ||
|
|
||
| kube-proxy = { | ||
| most_recent = true | ||
| } | ||
|
|
||
| vpc-cni = { | ||
| most_recent = true | ||
| before_compute = true | ||
| } | ||
|
|
||
| aws-ebs-csi-driver = { | ||
| most_recent = true | ||
| service_account_role_arn = module.ebs_csi_irsa.arn | ||
| } | ||
|
|
||
| eks-pod-identity-agent = { | ||
| most_recent = true | ||
| } | ||
|
|
||
| metrics-server = { | ||
| most_recent = true | ||
| } | ||
|
|
||
| kube-state-metrics = { | ||
| most_recent = true | ||
| } | ||
|
|
||
| external-dns = { | ||
| most_recent = true |
There was a problem hiding this comment.
setting most_recent on these seems like a footgun; it means that sometimes a random terraform apply will have a side-effect of bumping a component. I kind of think we should be pinning all of the versions (which I think we do for the other EKS cluster).
There was a problem hiding this comment.
Most of these will work well for the cluster_version they have released it against. I wasn't in favour of using addons for cert-manager and external-dns but gave in considering the ease of use. I agree any major version change and I'll be in cold waters. I am taking out cert-manager and external-dns out of these addons section and am going to use a plain helm_release. For one reason: the lack of documentation on what goes behind it. I tried looking it up and it is not easy.
| "system-node-group-0" = { | ||
| instance_types = var.system_instance_types, | ||
| min_size = var.system_min_node_count, | ||
| max_size = var.system_max_node_count, | ||
| desired_size = var.system_desired_node_count, | ||
| kubernetes_version = var.k8s_version | ||
| ami_type = var.system_ami_type, | ||
| enable_efa_only = false, # this is enabled by default and might not allow common instance types? | ||
| use_latest_ami_release_version = true, | ||
| subnet_ids = var.eks_subnet_ids | ||
| taints = { | ||
| critical_addons = { | ||
| key = "CriticalAddonsOnly", | ||
| value = "true", | ||
| effect = "NO_SCHEDULE" | ||
| } | ||
| } | ||
| }, |
There was a problem hiding this comment.
node groups with multiple AZs in them are dangerous because they'll break anything with an attached PVC, because the autoscaling controller doesn't know how to handle them. We should start this out right, with one node group of each class in each subnet.
There was a problem hiding this comment.
-
Would the coyote application place a criteria on users to deploy the db in a nodegroup without multi-az? Most clusters using this would have multi-az already into it? Shouldn't we architect the k8s operator in such a way that the operator chooses a primary zone for the db app (depending on the cloud) and sticks with it for the PVC with headless service that allows one to connect to a specific zone?
-
Will this db app need multi-az clustering at some point in time (I don't know when that will be if at all) say read replicas across AZ for better perf(?
| kubernetes_version = var.k8s_version | ||
| ami_type = var.system_ami_type, | ||
| enable_efa_only = false, # this is enabled by default and might not allow common instance types? | ||
| use_latest_ami_release_version = true, |
There was a problem hiding this comment.
same comment as before; setting this means that a random terraform apply will do the (downtime-inducing!) AMI upgrade on the node group. We should be pinning AMI releases and only upgrading by hand (and with staging/prod rollouts).
There was a problem hiding this comment.
True. Will fix it.
| } | ||
|
|
||
| # auth | ||
| authentication_mode = "API_AND_CONFIG_MAP" |
There was a problem hiding this comment.
do we actually need the config map? I know it was deprecated a long time ago and I am optimistic that we can just use IAM principals for new stuff
There was a problem hiding this comment.
I have just explicitly set the default value here. I can remove it but let's go with the defaults unless aws changes it?
| # only ipv4 | ||
| # for eks subnet, mimicking private subnet from | ||
| # https://github.com/terraform-aws-modules/terraform-aws-vpc/blob/cf18c37591f860908e2223b4f488787e8a5f74f3/main.tf | ||
|
|
There was a problem hiding this comment.
do we also want to create network endpoints for S3 (and any other services we use that have free endpoints) in here?
|
|
||
| #ToDo: Dedicated AZ for monitoring/node affinity based on availability zone | ||
| # : for ebs vicinity | ||
| resource "helm_release" "kube_prometheus_stack" { |
There was a problem hiding this comment.
is there a reason this is set up totally differently than the prometheus that we use for everything else? It's not using the same repository, it's not on the same version, and it doesn't have the same config.
| @@ -0,0 +1,16 @@ | |||
| resource "kubernetes_storage_class_v1" "gp3_ebs" { | |||
There was a problem hiding this comment.
why is this in the observability section instead of in the main EKS cluster section?
also, in the other clusters we intentionally disable gp2 so it doesn't get picked; is that no longer necessary?
There was a problem hiding this comment.
So this SC was only scoped for observability but i'll change it and use a general one since I guess it isn't a norm to scope it for particular module. One SC would be enough for all the cluster requirements.
|
|
||
| parameters = { | ||
| type = "gp3" | ||
| } |
There was a problem hiding this comment.
we should be enabling default encryption on ebs volumes
| } | |
| parameters = { | |
| type = "gp3" | |
| encrypted = "true" |
|
|
||
| variable "app_instance_types" { | ||
| type = list(string) | ||
| default = ["t3.micro"] |
There was a problem hiding this comment.
I don't think anything will fit on a t3.micro.... I don't even think kubelet will fit on a t3.micro.
There was a problem hiding this comment.
Agree. will fix it.
41556a5 to
5087c6f
Compare
5087c6f to
05e43bc
Compare
9d6bbc9 to
632c6a0
Compare
632c6a0 to
0a9aefe
Compare
|
Can we move this under the |
|
||||||||||||||||||||||||
This PR creates the base infra for coyote eks.
Relates to: Start w/ some basic infra for Coyote #187