-
Notifications
You must be signed in to change notification settings - Fork 0
/
kubernetes.tf
61 lines (54 loc) · 1.04 KB
/
kubernetes.tf
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
resource "kubernetes_deployment" "webserver_deployment" {
metadata {
name = "terraform-example-webserver"
labels = {
app = "ExampleWebserver"
}
}
spec {
replicas = 2
selector {
match_labels = {
app = "ExampleWebserver"
}
}
template {
metadata {
labels = {
app = "ExampleWebserver"
}
}
spec {
container {
image = "nginx:1.21.6"
name = "my-webserver"
resources {
limits = {
cpu = "0.5"
memory = "512Mi"
}
requests = {
cpu = "250m"
memory = "50Mi"
}
}
}
}
}
}
}
resource "kubernetes_service" "webserver_service" {
metadata {
name = "terraform-example-webserver"
}
spec {
selector = {
app = kubernetes_deployment.webserver_deployment.metadata.0.labels.app
}
port {
port = 80 #8080
target_port = 80
}
type = "LoadBalancer"
}
}