Alertmanager Silences Not Preserved After k3os 1.25 Upgrade – What Configuration Change Is Needed?
0 reputation · 13 Nov 2022, 00:54 UTC
0 reputation · 13 Nov 2022, 00:54 UTC
We want to maintain Alertmanager silence definitions across k3os upgrades so that noise‑reducing alerts remain effective after a new release is applied.
The silences live in the k3s-alertmanager ConfigMap in kube-system, which is regenerated during an upgrade. There is no built‑in persistence for these custom rules, and the default Alertmanager grouping does not filter by node label, causing duplicate alerts.
1. Does k3os provide a mechanism to lock the Alertmanager ConfigMap so that silences survive upgrades?
2. What configuration change or external store can we use to preserve silence definitions across upgrades?
3. Is there a recommended pattern for defining silences that remain stable when the monitoring stack is refreshed during an upgrade?
Configure Alertmanager to write its silence database to a persistent volume via --storage.path. The k3s-alertmanager ConfigMap only holds static configuration; silences are runtime state stored in silence.db and are lost when the pod restarts or the ConfigMap is regenerated during a k3os upgrade.
--storage.path (default /alertmanager).k3s-alertmanager ConfigMap and restarting the Alertmanager pod. Any in-memory or emptyDir silences vanish.kube-system) with accessModes: [ReadWriteOnce] and sufficient capacity (a few hundred MB is ample for silence metadata)./alertmanager and ensure the --storage.path=/alertmanager flag is set (it is the default, but verify).fsGroup in the pod security context (e.g., fsGroup: 65534) so the Alertmanager process (UID 65534) can write to the volume after upgrades recreate the pod.apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: alertmanager-silences
namespace: kube-system
spec:
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 500Mi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: alertmanager
namespace: kube-system
spec:
template:
spec:
securityContext:
fsGroup: 65534
containers:
- name: alertmanager
volumeMounts:
- name: data
mountPath: /alertmanager
volumes:
- name: data
persistentVolumeClaim:
claimName: alertmanager-silences
Apply the PVC first, then patch the existing Deployment (or StatefulSet if your k3os version uses one). The next upgrade will preserve silence.db because the PVC survives pod replacement.
If you already run Thanos, Cortex, or Mimir, configure Alertmanager’s --web.external-url and remote storage flags to push silences there. This adds network dependency and cost; a local PVC is simpler for single-cluster k3os.
Is Alertmanager deployed as part of the k3s embedded monitoring stack, or as a separate Helm release (e.g., kube-prometheus-stack)? The patch target (Deployment vs. StatefulSet, label selectors, namespace) differs. If it’s a Helm release, use alertmanager.persistentVolume.enabled=true in your values file instead of manual patching.
amtool.kubectl rollout restart deployment/alertmanager -n kube-system).Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.