tf_homelab/traefik.tf

73 lines
1.2 KiB
Terraform
Raw Normal View History

resource "kubernetes_deployment" "traefik" {
metadata {
name = "traefik"
labels = {
name = "traefik.k3s.seyshiro.de"
}
namespace = kubernetes_namespace.testing.metadata.0.name
}
spec {
replicas = 1
selector {
match_labels = {
name = "traefik.k3s.seyshiro.de"
}
}
template {
metadata {
labels = {
name = "traefik.k3s.seyshiro.de"
}
}
spec {
container {
image = "traefik:v3.0"
name = "traefik"
port {
container_port = 80
}
port {
container_port = 8080
}
resources {
limits = {
cpu = "0.5"
memory = "512Mi"
}
requests = {
cpu = "250m"
memory = "50Mi"
}
}
}
}
}
}
}
resource "kubernetes_service" "traefik" {
metadata {
name = "traefik"
namespace = kubernetes_namespace.testing.metadata.0.name
}
spec {
selector = {
name = kubernetes_deployment.traefik.spec.0.template.0.metadata.0.labels.name
}
port {
port = 80
target_port = 80
}
type = "NodePort"
}
}