You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
useStrictSecurity: default pod securityContext sets fsGroup without fsGroupChangePolicy: OnRootMismatch #2854
With useStrictSecurity: true, getDefaultPodSecurityContext (internal/controller/operator/factory/build/security.go) sets fsGroup: 65534 but leaves fsGroupChangePolicy unset. Kubernetes then defaults it to Always: on every pod start, the kubelet recursively chowns and chmods the whole data volume. That affects every CR with persistent storage: VMSingle, VLSingle, VMAgent persistent queue, VMStorage, VLStorage, VMAlertmanager and so on.
On large volumes this slows every restart. Our VLSingle holds about 730 GiB in 180k files; VMSingle about 73 GiB. The first switch from a root-owned volume to 65534 needs the full walk, but after that, OnRootMismatch would skip it.
Setting it yourself means giving a full spec.securityContext. That replaces the strict defaults entirely (containerSecurityContext() takes the user value as-is), so you have to restate all of them just to add one field.
To Reproduce
Create a VMSingle (or VLSingle) with useStrictSecurity: true and a PVC.
kubectl get pod -o jsonpath='{.spec.securityContext}' shows fsGroup: 65534 with no fsGroupChangePolicy.
Restart the pod: the kubelet walks the whole volume on each start.
Expected behavior
The strict defaults include fsGroupChangePolicy: OnRootMismatch, as the operator already defaults for VMAlertmanager outside strict mode (#2392).
Version
vm-operator v0.75.2 (the default is the same on master), GKE 1.37.2.
Additional context
Alternatively, merge a user securityContext field by field over the strict defaults instead of replacing them. Then securityContext: {fsGroupChangePolicy: OnRootMismatch} next to useStrictSecurity: true would be enough.
Activity
f41gh7 commentedon Nov 23, 2026
As far as I understand, by default operator sets
fsGroupChangePolicy.There is only one condition, if it's not correct - if
k8stools.IsFSGroupChangePolicySupported()returns false.