- Set memory requests = limits across 56 stacks to prevent overcommit - Right-sized limits based on actual pod usage (2x actual, rounded up) - Scaled down trading-bot (replicas=0) to free memory - Fixed OOMKilled services: forgejo, dawarich, health, meshcentral, paperless-ngx, vault auto-unseal, rybbit, whisper, openclaw, clickhouse - Added startup+liveness probes to calibre-web - Bumped inotify limits on nodes 2,3 (max_user_instances 128->8192) Post node2 OOM incident (2026-03-14). Previous kubelet config had no kubeReserved/systemReserved set, allowing pods to starve the kernel.
181 lines
4.1 KiB
HCL
181 lines
4.1 KiB
HCL
variable "tls_secret_name" {
|
|
type = string
|
|
sensitive = true
|
|
}
|
|
variable "nfs_server" { type = string }
|
|
|
|
|
|
resource "kubernetes_namespace" "ntfy" {
|
|
metadata {
|
|
name = "ntfy"
|
|
labels = {
|
|
tier = local.tiers.aux
|
|
}
|
|
}
|
|
}
|
|
|
|
module "tls_secret" {
|
|
source = "../../modules/kubernetes/setup_tls_secret"
|
|
namespace = kubernetes_namespace.ntfy.metadata[0].name
|
|
tls_secret_name = var.tls_secret_name
|
|
}
|
|
|
|
module "nfs_data" {
|
|
source = "../../modules/kubernetes/nfs_volume"
|
|
name = "ntfy-data"
|
|
namespace = kubernetes_namespace.ntfy.metadata[0].name
|
|
nfs_server = var.nfs_server
|
|
nfs_path = "/mnt/main/ntfy"
|
|
}
|
|
|
|
resource "kubernetes_deployment" "ntfy" {
|
|
metadata {
|
|
name = "ntfy"
|
|
namespace = kubernetes_namespace.ntfy.metadata[0].name
|
|
labels = {
|
|
app = "ntfy"
|
|
tier = local.tiers.aux
|
|
}
|
|
annotations = {
|
|
"reloader.stakater.com/search" = "true"
|
|
}
|
|
}
|
|
spec {
|
|
replicas = 1
|
|
strategy {
|
|
type = "RollingUpdate"
|
|
}
|
|
selector {
|
|
match_labels = {
|
|
app = "ntfy"
|
|
}
|
|
}
|
|
template {
|
|
metadata {
|
|
labels = {
|
|
app = "ntfy"
|
|
}
|
|
}
|
|
spec {
|
|
container {
|
|
image = "binwiederhier/ntfy"
|
|
name = "ntfy"
|
|
args = ["serve"]
|
|
|
|
port {
|
|
container_port = 80
|
|
}
|
|
liveness_probe {
|
|
http_get {
|
|
path = "/v1/health"
|
|
port = 80
|
|
}
|
|
initial_delay_seconds = 15
|
|
period_seconds = 30
|
|
timeout_seconds = 5
|
|
failure_threshold = 5
|
|
}
|
|
readiness_probe {
|
|
http_get {
|
|
path = "/v1/health"
|
|
port = 80
|
|
}
|
|
initial_delay_seconds = 5
|
|
period_seconds = 30
|
|
timeout_seconds = 5
|
|
failure_threshold = 3
|
|
}
|
|
env {
|
|
name = "NTFY_BASE_URL"
|
|
value = "https://ntfy.viktorbarzin.me"
|
|
}
|
|
env {
|
|
name = "NTFY_UPSTREAM_BASE_URL"
|
|
# value = "https://ntfy.viktorbarzin.me"
|
|
value = "https://ntfy.sh"
|
|
}
|
|
env {
|
|
name = "NTFY_BEHIND_PROXY"
|
|
value = "true"
|
|
}
|
|
env {
|
|
name = "NTFY_ENABLE_LOGIN"
|
|
value = "true"
|
|
}
|
|
env {
|
|
name = "NTFY_AUTH_FILE"
|
|
value = "/var/lib/ntfy/user.db"
|
|
}
|
|
env {
|
|
name = "NTFY_AUTH_DEFAULT_ACCESS"
|
|
value = "deny-all"
|
|
}
|
|
env {
|
|
name = "NTFY_ENABLE_METRICS"
|
|
value = "true"
|
|
}
|
|
volume_mount {
|
|
name = "data"
|
|
mount_path = "/var/lib/ntfy/"
|
|
}
|
|
resources {
|
|
requests = {
|
|
cpu = "10m"
|
|
memory = "64Mi"
|
|
}
|
|
limits = {
|
|
memory = "64Mi"
|
|
}
|
|
}
|
|
}
|
|
volume {
|
|
name = "data"
|
|
persistent_volume_claim {
|
|
claim_name = module.nfs_data.claim_name
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
resource "kubernetes_service" "ntfy" {
|
|
metadata {
|
|
name = "ntfy"
|
|
namespace = kubernetes_namespace.ntfy.metadata[0].name
|
|
labels = {
|
|
"app" = "ntfy"
|
|
}
|
|
annotations = {
|
|
"prometheus.io/scrape" = "true"
|
|
"prometheus.io/path" = "/metrics"
|
|
"prometheus.io/port" = "80"
|
|
}
|
|
}
|
|
|
|
spec {
|
|
selector = {
|
|
app = "ntfy"
|
|
}
|
|
port {
|
|
name = "http"
|
|
target_port = 80
|
|
port = 80
|
|
}
|
|
}
|
|
}
|
|
|
|
module "ingress" {
|
|
source = "../../modules/kubernetes/ingress_factory"
|
|
namespace = kubernetes_namespace.ntfy.metadata[0].name
|
|
name = "ntfy"
|
|
tls_secret_name = var.tls_secret_name
|
|
extra_annotations = {
|
|
"gethomepage.dev/enabled" = "true"
|
|
"gethomepage.dev/name" = "ntfy"
|
|
"gethomepage.dev/description" = "Push notifications"
|
|
"gethomepage.dev/icon" = "ntfy.png"
|
|
"gethomepage.dev/group" = "Productivity"
|
|
"gethomepage.dev/pod-selector" = ""
|
|
}
|
|
}
|