Skip to content

Node OOM crash and cluster recovery

Date: 2026-06-24
Severity: High
Duration: ~3 hours
Affected Node: ubuntu-mashup-gitlab-haproxy
Secondary Issue: worker-node-a disk pressure


Summary

A memory exhaustion event on ubuntu-mashup-gitlab-haproxy caused the node to go NotReady, taking down APISIX ingress, VictoriaMetrics storage, and several other workloads. Root cause was unbounded memory usage by vmagent triggering the OOM killer, which then killed APISIX (openresty) workers due to no memory limits being set. A secondary disk pressure issue on worker-node-a was discovered during recovery.


Timeline

Time Event
~05:03 UTC vmagent invokes OOM killer on ubuntu-mashup-gitlab-haproxy
~05:03 UTC openresty (APISIX) killed — 10+ worker processes terminated
~05:04 UTC Kubelet stops posting node status
~05:04 UTC Node goes NotReady, taints added: unreachable:NoExecute, unreachable:NoSchedule
~05:04 UTC vmstorage pods go down, APISIX ingress offline
~05:30 UTC Incident discovered
~05:35 UTC systemctl restart k3s on ubuntu-mashup-gitlab-haproxy
~05:40 UTC Node returns to Ready
~05:45 UTC Disk pressure discovered on worker-node-a (90% full)
~05:50 UTC 27GB Docker build cache cleared on worker-node-a
~05:55 UTC Disk pressure cleared, Longhorn recovers
~06:10 UTC All vmstorage volumes return to healthy
~06:30 UTC All remediation tasks completed

Root Cause

Primary: OOM on ubuntu-mashup-gitlab-haproxy

[34857502] nfsd invoked oom-killer
[34857502] Out of memory: Killed process 2765805 (openresty)
  • Node had zero swap configured
  • vmagent had no memory limits — consumed unbounded RAM
  • APISIX/openresty had no memory limits — Kubernetes assigned it BestEffort QoS class (oom_score_adj=1000) making it the first OOM kill target
  • With 15GB RAM fully consumed and no swap, the kernel killed openresty workers
  • APISIX crash → kubelet lost connectivity → node NotReady

Secondary: Disk Pressure on worker-node-a

  • Disk at 90% (87GB/97GB)
  • 40GB Longhorn replicas (VictoriaMetrics storage)
  • 27GB Docker build cache (unused)
  • Longhorn manager evicted → vmstorage replicas became degraded
  • disk-pressure taint added automatically by kubelet

Impact

  • APISIX ingress offline (all traffic affected)
  • VictoriaMetrics storage pods down (metrics unavailable)
  • ArgoCD, Zitadel, GitLab, Planka running on affected node — briefly disrupted
  • Longhorn volumes for vmstorage in faulted/degraded state

Recovery Steps

1. Restart k3s on affected node

systemctl restart k3s
- Brought node back to Ready - Automatically rotated expiring certificates

2. Clean Docker build cache on worker-node-a

docker builder prune -af
# Freed 27GB, disk went from 90% → 63%

3. Remove disk pressure taint and restart k3s

kubectl taint node worker-node-a node.kubernetes.io/disk-pressure:NoSchedule-
systemctl restart k3s
# DiskPressure condition cleared

4. Delete evicted/failed pods

kubectl delete pod -n longhorn-system --field-selector=status.phase=Failed
kubectl delete pod -n ingress-apisix --field-selector=status.phase=Failed

5. Delete orphaned Longhorn volume

kubectl delete volume -n longhorn-system pvc-44f1318d-090d-446a-939a-29e092bc1c8c
# Freed 4GB

6. Wait for Longhorn volumes to recover

watch kubectl get volume -n longhorn-system | grep -E "4f4eaf6e|f242adaf|cebd6223"
# degraded → healthy (took ~15 minutes)

Remediation Tasks Completed

Swap Added

Node Swap Status
ubuntu-mashup-gitlab-haproxy 8GB Added + fstab
worker-node-a 4GB Already existed
ubuntu-24-04-lts-control-plane 8GB Added + fstab

Memory Limits Applied

Workload Namespace Requests Limits
apisix ingress-apisix cpu:100m, mem:256Mi cpu:1, mem:2Gi
apisix-etcd ingress-apisix cpu:50m, mem:128Mi cpu:500m, mem:512Mi
apisix-ingress-controller ingress-apisix cpu:50m, mem:128Mi cpu:500m, mem:512Mi
vmagent-0 monitoring cpu:10m, mem:25Mi cpu:500m, mem:512Mi
vmagent-1 monitoring cpu:10m, mem:25Mi cpu:500m, mem:512Mi

Certificate Rotation Cron

Scheduled on all 3 nodes — first Saturday of each month:

Node Cron Schedule Time
worker-node-a 0 1 1-7 * 6 1:00am
ubuntu-mashup-gitlab-haproxy 0 2 1-7 * 6 2:00am
ubuntu-24-04-lts-control-plane 0 3 1-7 * 6 3:00am

Cron file: /etc/cron.d/k3s-cert-rotate

0 1 1-7 * 6 root systemctl restart k3s

Docker Cleanup

Node Action Freed
ubuntu-mashup-gitlab-haproxy Builder prune + image prune ~83GB
worker-node-a Volume prune ~234MB
ubuntu-24-04-lts-control-plane Nothing (already empty) 0

ubuntu-mashup-gitlab-haproxy has a live MariaDB container (johorZoo database, last updated 2026-06-23) running outside Kubernetes on port 3306. Do not remove Docker from this node.


Secondary Incident: APISIX 413 on CI Pipeline (Docker Image Push)

Problem

After the APISIX Helm upgrade during recovery, GitLab CI pipelines started failing with 413 Request Entity Too Large when pushing Docker images to Nexus registry (registry.nexus.castis.io).

ERROR: unknown: <html>
<head><title>413 Request Entity Too Large</title></head>
<body><center><h1>413 Request Entity Too Large</h1></center>
<hr><center>openresty</center>

Root Cause

During recovery, helm repo update pulled the latest APISIX chart which automatically upgraded from chart 2.14.1 (APISIX 3.16.0) to chart 2.15.0 (APISIX 3.17.0). The new version appears to have changed default nginx body size or buffer settings, causing large Docker image layer pushes (~38MB) to be rejected.

Fix

Rolled back to the last known working revision:

helm history apisix -n ingress-apisix  # identified revision 20 as last stable
helm rollback apisix 20 -n ingress-apisix --no-hooks

Then re-applied memory limits via Helm values with correct top-level resources key:

helm get values apisix -n ingress-apisix > /tmp/apisix-values.yaml
cat >> /tmp/apisix-values.yaml << 'EOF'
resources:
  requests:
    cpu: 100m
    memory: 256Mi
  limits:
    cpu: 1000m
    memory: 2Gi
EOF
helm upgrade apisix apisix/apisix -n ingress-apisix -f /tmp/apisix-values.yaml --no-hooks --version 2.14.1

Key Learnings

  • Always pin Helm chart versions with --version flag on production upgrades — never run bare helm upgrade which pulls latest
  • The correct resources key for this chart is top-level resources, NOT apisix.resources — verify with helm show values apisix/apisix | grep -A5 "^resources:"
  • APISIX 3.17.0 may have changed default body size limits — investigate before upgrading
  • When upgrading APISIX in future, test with a Docker image push to Nexus as part of validation

Current Status

  • Stable on APISIX chart 2.14.1 (APISIX 3.16.0)
  • Memory limit: 2Gi (increased from 1Gi to handle large image pushes)
  • CI pipeline working

Outstanding Items

Item Priority Notes
Migrate MariaDB into Kubernetes Medium Currently running in plain Docker, exposed on 0.0.0.0:3306, no redundancy
Clean up Loki/Tempo/Vector PVCs Low 25GB recoverable if these services are decommissioned
Set memory limits on other monitoring pods Medium vmstorage, vminsert, vmselect should be reviewed
Expand worker-node-a disk Medium 97GB is small given 40GB Longhorn replicas
Investigate APISIX 3.17.0 413 issue Low Before upgrading, test body size behavior and set explicit client_max_body_size
APISIX Helm values fix Low Resources under apisix.resources in values don't apply — use top-level resources key

Lessons Learned

  1. Always set memory limits — pods without limits get BestEffort QoS and are first OOM kill targets
  2. Always configure swap — zero swap means OOM = immediate process kills and potential node crash
  3. Docker on k3s nodes accumulates garbage — build cache should be pruned regularly or Docker removed if not needed
  4. Certificate expiry — k3s certs expire annually, restart k3s regularly to auto-rotate (now automated)
  5. Monitor node disk usage — Longhorn replicas grow over time, disk alerts should be configured
  6. Always pin Helm chart versions — never run helm upgrade without --version on production, it silently pulls latest and can introduce breaking changes

Cluster State After Recovery

NAME                             STATUS   ROLES                              AGE
ubuntu-24-04-lts-control-plane   Ready    control-plane,etcd,master          456d
ubuntu-mashup-gitlab-haproxy     Ready    control-plane,etcd,master,worker   246d
worker-node-a                    Ready    control-plane,etcd,master          246d

All nodes Ready. All pods running. Longhorn volumes healthy.