add pvc-autoresizer for automatic PVC expansion before volumes fill up [ci skip]
Deploy topolvm/pvc-autoresizer controller that monitors kubelet_volume_stats via Prometheus and auto-expands annotated PVCs. Annotated all 9 block-storage PVCs (proxmox-lvm) with per-PVC thresholds and max limits. Updated PVFillingUp alert to critical/10m (means auto-expansion failed) and added PVAutoExpanding info alert at 80%.
This commit is contained in:
parent
b2cac8cc97
commit
ce7b8c2b2e
12 changed files with 113 additions and 3 deletions
|
|
@ -157,6 +157,13 @@ resource "helm_release" "mysql_cluster" {
|
||||||
|
|
||||||
datadirVolumeClaimTemplate = {
|
datadirVolumeClaimTemplate = {
|
||||||
storageClassName = "proxmox-lvm"
|
storageClassName = "proxmox-lvm"
|
||||||
|
metadata = {
|
||||||
|
annotations = {
|
||||||
|
"resize.topolvm.io/threshold" = "80%"
|
||||||
|
"resize.topolvm.io/increase" = "20%"
|
||||||
|
"resize.topolvm.io/storage_limit" = "100Gi"
|
||||||
|
}
|
||||||
|
}
|
||||||
resources = {
|
resources = {
|
||||||
requests = {
|
requests = {
|
||||||
storage = "30Gi"
|
storage = "30Gi"
|
||||||
|
|
@ -897,6 +904,11 @@ resource "null_resource" "pg_cluster" {
|
||||||
search_path: '"$user", public'
|
search_path: '"$user", public'
|
||||||
enableAlterSystem: true
|
enableAlterSystem: true
|
||||||
enableSuperuserAccess: true
|
enableSuperuserAccess: true
|
||||||
|
inheritedMetadata:
|
||||||
|
annotations:
|
||||||
|
resize.topolvm.io/threshold: "80%"
|
||||||
|
resize.topolvm.io/increase: "20%"
|
||||||
|
resize.topolvm.io/storage_limit: "100Gi"
|
||||||
storage:
|
storage:
|
||||||
size: 20Gi
|
size: 20Gi
|
||||||
storageClass: proxmox-lvm
|
storageClass: proxmox-lvm
|
||||||
|
|
|
||||||
|
|
@ -145,6 +145,11 @@ resource "kubernetes_persistent_volume_claim" "calibre_config_iscsi" {
|
||||||
metadata {
|
metadata {
|
||||||
name = "ebooks-calibre-config-proxmox"
|
name = "ebooks-calibre-config-proxmox"
|
||||||
namespace = kubernetes_namespace.ebooks.metadata[0].name
|
namespace = kubernetes_namespace.ebooks.metadata[0].name
|
||||||
|
annotations = {
|
||||||
|
"resize.topolvm.io/threshold" = "80%"
|
||||||
|
"resize.topolvm.io/increase" = "50%"
|
||||||
|
"resize.topolvm.io/storage_limit" = "10Gi"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
spec {
|
spec {
|
||||||
access_modes = ["ReadWriteOnce"]
|
access_modes = ["ReadWriteOnce"]
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,11 @@ resource "kubernetes_persistent_volume_claim" "prometheus_server_pvc" {
|
||||||
metadata {
|
metadata {
|
||||||
name = "prometheus-data-proxmox"
|
name = "prometheus-data-proxmox"
|
||||||
namespace = kubernetes_namespace.monitoring.metadata[0].name
|
namespace = kubernetes_namespace.monitoring.metadata[0].name
|
||||||
|
annotations = {
|
||||||
|
"resize.topolvm.io/threshold" = "90%"
|
||||||
|
"resize.topolvm.io/increase" = "10%"
|
||||||
|
"resize.topolvm.io/storage_limit" = "500Gi"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
spec {
|
spec {
|
||||||
|
|
|
||||||
|
|
@ -801,13 +801,20 @@ serverFiles:
|
||||||
severity: warning
|
severity: warning
|
||||||
annotations:
|
annotations:
|
||||||
summary: "Disk {{ $labels.mountpoint }} on {{ $labels.instance }}: {{ $value | printf \"%.1f\" }}% free (threshold: 10%)"
|
summary: "Disk {{ $labels.mountpoint }} on {{ $labels.instance }}: {{ $value | printf \"%.1f\" }}% free (threshold: 10%)"
|
||||||
|
- alert: PVAutoExpanding
|
||||||
|
expr: (kubelet_volume_stats_used_bytes / kubelet_volume_stats_capacity_bytes) * 100 > 80 and kubelet_volume_stats_capacity_bytes < 1099511627776
|
||||||
|
for: 5m
|
||||||
|
labels:
|
||||||
|
severity: info
|
||||||
|
annotations:
|
||||||
|
summary: "PV {{ $labels.persistentvolumeclaim }} in {{ $labels.namespace }}: {{ $value | printf \"%.0f\" }}% used — auto-expansion should trigger"
|
||||||
- alert: PVFillingUp
|
- alert: PVFillingUp
|
||||||
expr: (kubelet_volume_stats_used_bytes / kubelet_volume_stats_capacity_bytes) * 100 > 95 and kubelet_volume_stats_capacity_bytes < 1099511627776
|
expr: (kubelet_volume_stats_used_bytes / kubelet_volume_stats_capacity_bytes) * 100 > 95 and kubelet_volume_stats_capacity_bytes < 1099511627776
|
||||||
for: 30m
|
for: 10m
|
||||||
labels:
|
labels:
|
||||||
severity: warning
|
severity: critical
|
||||||
annotations:
|
annotations:
|
||||||
summary: "PV {{ $labels.persistentvolumeclaim }} in {{ $labels.namespace }}: {{ $value | printf \"%.0f\" }}% used (threshold: 95%)"
|
summary: "PV {{ $labels.persistentvolumeclaim }} in {{ $labels.namespace }}: {{ $value | printf \"%.0f\" }}% used — auto-expansion may have failed"
|
||||||
- alert: PVPredictedFull
|
- alert: PVPredictedFull
|
||||||
expr: predict_linear(kubelet_volume_stats_used_bytes[6h], 3600*24) > kubelet_volume_stats_capacity_bytes
|
expr: predict_linear(kubelet_volume_stats_used_bytes[6h], 3600*24) > kubelet_volume_stats_capacity_bytes
|
||||||
for: 1h
|
for: 1h
|
||||||
|
|
|
||||||
|
|
@ -188,6 +188,11 @@ resource "kubernetes_persistent_volume_claim" "nextcloud_data_iscsi" {
|
||||||
metadata {
|
metadata {
|
||||||
name = "nextcloud-data-proxmox"
|
name = "nextcloud-data-proxmox"
|
||||||
namespace = kubernetes_namespace.nextcloud.metadata[0].name
|
namespace = kubernetes_namespace.nextcloud.metadata[0].name
|
||||||
|
annotations = {
|
||||||
|
"resize.topolvm.io/threshold" = "80%"
|
||||||
|
"resize.topolvm.io/increase" = "20%"
|
||||||
|
"resize.topolvm.io/storage_limit" = "100Gi"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
spec {
|
spec {
|
||||||
access_modes = ["ReadWriteOnce"]
|
access_modes = ["ReadWriteOnce"]
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,11 @@ resource "kubernetes_persistent_volume_claim" "novelapp-data" {
|
||||||
metadata {
|
metadata {
|
||||||
name = "novelapp-data-proxmox"
|
name = "novelapp-data-proxmox"
|
||||||
namespace = kubernetes_namespace.novelapp.metadata[0].name
|
namespace = kubernetes_namespace.novelapp.metadata[0].name
|
||||||
|
annotations = {
|
||||||
|
"resize.topolvm.io/threshold" = "80%"
|
||||||
|
"resize.topolvm.io/increase" = "100%"
|
||||||
|
"resize.topolvm.io/storage_limit" = "5Gi"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
spec {
|
spec {
|
||||||
access_modes = ["ReadWriteOnce"]
|
access_modes = ["ReadWriteOnce"]
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,11 @@ resource "kubernetes_persistent_volume_claim" "plotting-book-data" {
|
||||||
metadata {
|
metadata {
|
||||||
name = "plotting-book-data-proxmox"
|
name = "plotting-book-data-proxmox"
|
||||||
namespace = kubernetes_namespace.plotting-book.metadata[0].name
|
namespace = kubernetes_namespace.plotting-book.metadata[0].name
|
||||||
|
annotations = {
|
||||||
|
"resize.topolvm.io/threshold" = "80%"
|
||||||
|
"resize.topolvm.io/increase" = "100%"
|
||||||
|
"resize.topolvm.io/storage_limit" = "5Gi"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
spec {
|
spec {
|
||||||
access_modes = ["ReadWriteOnce"]
|
access_modes = ["ReadWriteOnce"]
|
||||||
|
|
|
||||||
4
stacks/pvc-autoresizer/main.tf
Normal file
4
stacks/pvc-autoresizer/main.tf
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
module "pvc_autoresizer" {
|
||||||
|
source = "./modules/pvc-autoresizer"
|
||||||
|
tier = local.tiers.cluster
|
||||||
|
}
|
||||||
39
stacks/pvc-autoresizer/modules/pvc-autoresizer/main.tf
Normal file
39
stacks/pvc-autoresizer/modules/pvc-autoresizer/main.tf
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
variable "tier" { type = string }
|
||||||
|
|
||||||
|
resource "kubernetes_namespace" "pvc_autoresizer" {
|
||||||
|
metadata {
|
||||||
|
name = "pvc-autoresizer"
|
||||||
|
labels = {
|
||||||
|
tier = var.tier
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "helm_release" "pvc_autoresizer" {
|
||||||
|
namespace = kubernetes_namespace.pvc_autoresizer.metadata[0].name
|
||||||
|
create_namespace = false
|
||||||
|
name = "pvc-autoresizer"
|
||||||
|
atomic = true
|
||||||
|
timeout = 300
|
||||||
|
|
||||||
|
repository = "https://topolvm.github.io/pvc-autoresizer"
|
||||||
|
chart = "pvc-autoresizer"
|
||||||
|
|
||||||
|
values = [yamlencode({
|
||||||
|
controller = {
|
||||||
|
args = {
|
||||||
|
prometheusURL = "http://prometheus-server.monitoring.svc.cluster.local:80"
|
||||||
|
interval = "10m"
|
||||||
|
}
|
||||||
|
resources = {
|
||||||
|
requests = {
|
||||||
|
memory = "64Mi"
|
||||||
|
cpu = "10m"
|
||||||
|
}
|
||||||
|
limits = {
|
||||||
|
memory = "128Mi"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})]
|
||||||
|
}
|
||||||
8
stacks/pvc-autoresizer/terragrunt.hcl
Normal file
8
stacks/pvc-autoresizer/terragrunt.hcl
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
include "root" {
|
||||||
|
path = find_in_parent_folders()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependency "infra" {
|
||||||
|
config_path = "../infra"
|
||||||
|
skip_outputs = true
|
||||||
|
}
|
||||||
|
|
@ -61,6 +61,11 @@ resource "helm_release" "redis" {
|
||||||
enabled = true
|
enabled = true
|
||||||
storageClass = "proxmox-lvm"
|
storageClass = "proxmox-lvm"
|
||||||
size = "2Gi"
|
size = "2Gi"
|
||||||
|
annotations = {
|
||||||
|
"resize.topolvm.io/threshold" = "80%"
|
||||||
|
"resize.topolvm.io/increase" = "50%"
|
||||||
|
"resize.topolvm.io/storage_limit" = "10Gi"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resources = {
|
resources = {
|
||||||
|
|
@ -81,6 +86,11 @@ resource "helm_release" "redis" {
|
||||||
enabled = true
|
enabled = true
|
||||||
storageClass = "proxmox-lvm"
|
storageClass = "proxmox-lvm"
|
||||||
size = "2Gi"
|
size = "2Gi"
|
||||||
|
annotations = {
|
||||||
|
"resize.topolvm.io/threshold" = "80%"
|
||||||
|
"resize.topolvm.io/increase" = "50%"
|
||||||
|
"resize.topolvm.io/storage_limit" = "10Gi"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resources = {
|
resources = {
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,11 @@ resource "kubernetes_persistent_volume_claim" "vaultwarden_data" {
|
||||||
metadata {
|
metadata {
|
||||||
name = "vaultwarden-data-proxmox"
|
name = "vaultwarden-data-proxmox"
|
||||||
namespace = kubernetes_namespace.vaultwarden.metadata[0].name
|
namespace = kubernetes_namespace.vaultwarden.metadata[0].name
|
||||||
|
annotations = {
|
||||||
|
"resize.topolvm.io/threshold" = "80%"
|
||||||
|
"resize.topolvm.io/increase" = "100%"
|
||||||
|
"resize.topolvm.io/storage_limit" = "5Gi"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
spec {
|
spec {
|
||||||
access_modes = ["ReadWriteOnce"]
|
access_modes = ["ReadWriteOnce"]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue