Sample cluster and pods

This commit is contained in:
shockrah 2024-05-29 23:27:43 -07:00
parent 0e2eb430a5
commit 5d93ff8295
2 changed files with 71 additions and 0 deletions

View File

@ -0,0 +1,63 @@
# Plain nginx for now so that we can test out reverse dns
resource kubernetes_pod shockrah {
metadata {
name = var.shockrahxyz.name
namespace = kubernetes_namespace.websites.metadata.0.name
labels = {
app = var.shockrahxyz.name
}
}
spec {
container {
image = "nginx"
name = "${var.shockrahxyz.name}"
port {
container_port = 80
}
}
}
}
# Expose the pod above with a simple service
resource kubernetes_service shockrah {
metadata {
name = var.shockrahxyz.name
namespace = kubernetes_namespace.websites.metadata.0.name
}
spec {
selector = {
app = kubernetes_pod.shockrah.metadata.0.labels.app
}
port {
port = var.shockrahxyz.port
target_port = 80
}
type = "ExternalName"
external_name = var.shockrahxyz.dns
}
}
resource kubernetes_ingress_v1 shockrah {
metadata {
name = "shockrah"
}
spec {
rule {
http {
path {
path = "/"
backend {
service {
name = var.shockrahxyz.name
port {
number = var.shockrahxyz.port
}
}
}
}
}
}
}
}

View File

@ -19,3 +19,11 @@ variable aws_region {
sensitive = true
}
variable shockrahxyz {
type = object({
name = string
port = number
dns = string
})
}