131 lines
2.4 KiB
HCL
131 lines
2.4 KiB
HCL
resource "kubernetes_deployment" "status" {
|
|
metadata {
|
|
name = "status"
|
|
labels = {
|
|
name = "status.k3s.seyshiro.de"
|
|
}
|
|
namespace = kubernetes_namespace.testing.metadata.0.name
|
|
}
|
|
|
|
spec {
|
|
replicas = 1
|
|
|
|
selector {
|
|
match_labels = {
|
|
name = "status.k3s.seyshiro.de"
|
|
}
|
|
}
|
|
|
|
template {
|
|
metadata {
|
|
labels = {
|
|
name = "status.k3s.seyshiro.de"
|
|
}
|
|
}
|
|
|
|
spec {
|
|
container {
|
|
image = "louislam/uptime-kuma:1.23.6"
|
|
name = "status"
|
|
|
|
port {
|
|
container_port = 3001
|
|
}
|
|
|
|
resources {
|
|
limits = {
|
|
cpu = "0.5"
|
|
memory = "512Mi"
|
|
}
|
|
requests = {
|
|
cpu = "250m"
|
|
memory = "50Mi"
|
|
}
|
|
}
|
|
volume_mount {
|
|
name = "volv"
|
|
mount_path = "/app/data"
|
|
}
|
|
}
|
|
volume {
|
|
name = "volv"
|
|
persistent_volume_claim {
|
|
claim_name = kubernetes_persistent_volume.status.metadata.0.name
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
resource "kubernetes_service" "status" {
|
|
metadata {
|
|
name = "status"
|
|
namespace = kubernetes_namespace.testing.metadata.0.name
|
|
}
|
|
|
|
spec {
|
|
selector = {
|
|
name = kubernetes_deployment.status.spec.0.template.0.metadata.0.labels.name
|
|
}
|
|
port {
|
|
port = 3001
|
|
target_port = 3001
|
|
}
|
|
type = "NodePort"
|
|
|
|
}
|
|
}
|
|
|
|
resource "kubernetes_persistent_volume_claim" "status" {
|
|
metadata {
|
|
name = "status"
|
|
namespace = kubernetes_namespace.testing.metadata.0.name
|
|
}
|
|
|
|
spec {
|
|
access_modes = ["ReadWriteMany"]
|
|
resources {
|
|
requests = {
|
|
storage = "2Gi"
|
|
}
|
|
}
|
|
|
|
volume_name = kubernetes_persistent_volume.status.metadata.0.name
|
|
storage_class_name = "local-path"
|
|
}
|
|
|
|
wait_until_bound = true
|
|
}
|
|
|
|
resource "kubernetes_persistent_volume" "status" {
|
|
metadata {
|
|
name = "status"
|
|
}
|
|
|
|
spec {
|
|
access_modes = ["ReadWriteMany"]
|
|
capacity = {
|
|
storage = "2Gi"
|
|
}
|
|
node_affinity {
|
|
|
|
required {
|
|
node_selector_term {
|
|
match_fields{
|
|
key = "metadata.name"
|
|
operator = "In"
|
|
values = ["status"]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
persistent_volume_source {
|
|
local {
|
|
path = "/home/tuan/terraform/status/"
|
|
}
|
|
}
|
|
storage_class_name = "local-path"
|
|
}
|
|
}
|