-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy patheks.tf
More file actions
102 lines (86 loc) · 2.28 KB
/
eks.tf
File metadata and controls
102 lines (86 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# 2. Create EKS cluster.
module "eks" {
source = "terraform-aws-modules/eks/aws"
version = "19.4.2"
putin_khuylo = true
cluster_name = var.cluster_name
cluster_version = var.cluster_version
cluster_endpoint_public_access = true
cluster_addons = {
coredns = {
most_recent = true
}
kube-proxy = {
most_recent = true
}
vpc-cni = {
most_recent = true
}
aws-ebs-csi-driver = {
service_account_role_arn = module.ebs_csi_irsa_role.iam_role_arn
resolve_conflicts = "OVERWRITE"
}
}
tags = var.tags
vpc_id = module.vpc.vpc_id
subnet_ids = module.vpc.private_subnets
manage_aws_auth_configmap = true
aws_auth_roles = [
# Add the CAST AI IAM role which required for CAST AI nodes to join the cluster.
{
rolearn = module.castai-eks-role-iam[0].instance_profile_role_arn
username = "system:node:{{EC2PrivateDNSName}}"
groups = [
"system:bootstrappers",
"system:nodes",
]
},
]
self_managed_node_groups = {
node_group_1 = {
name = "${var.cluster_name}-ng-1"
instance_type = "m5.large"
max_size = 5
min_size = 2
desired_size = 2
}
}
eks_managed_node_groups = {
node_group_spot = {
name = "${var.cluster_name}-spot"
min_size = 1
max_size = 10
desired_size = 1
instance_types = ["t3.large"]
capacity_type = "SPOT"
update_config = {
max_unavailable_percentage = 50 # or set `max_unavailable`
}
}
}
}
module "ebs_csi_irsa_role" {
source = "terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks"
version = "~> 4.21.1"
role_name = "ebs-csi-${var.cluster_name}"
attach_ebs_csi_policy = true
oidc_providers = {
ex = {
provider_arn = module.eks.oidc_provider_arn
namespace_service_accounts = ["kube-system:ebs-csi-controller-sa"]
}
}
}
# Example additional security group.
resource "aws_security_group" "additional" {
name_prefix = "${var.cluster_name}-additional"
vpc_id = module.vpc.vpc_id
ingress {
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = [
"10.0.0.0/8",
]
}
}