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
Copy file name to clipboardExpand all lines: docs/security.md
+31-35Lines changed: 31 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,50 +37,46 @@ for editing [`vmagent` custom resources](https://docs.victoriametrics.com/operat
37
37
38
38
## Security policies
39
39
40
-
VictoriaMetrics operator provides several security features, such as [PodSecurityPolicies](https://kubernetes.io/docs/concepts/policy/pod-security-policy/),
VictoriaMetrics operator provides several security features. First of all, it's built-in hardening configuration.
42
41
43
-
### PodSecurityPolicy
42
+
Environment variable `VM_ENABLESTRICTSECURITY=true` applies generic security options to the all created resources.
44
43
45
-
> PodSecurityPolicy was [deprecated](https://kubernetes.io/docs/concepts/security/pod-security-policy/) in Kubernetes v1.21, and removed from Kubernetes in v1.25.
44
+
Such as `PodSecurityContext`and `SecurityContext` per `Container`
46
45
47
-
If your Kubernetes version is under v1.25 and want to use PodSecurityPolicy, you can set env `VM_PSPAUTOCREATEENABLED: "true"` in operator, it will create serviceAccount for each cluster resource and binds default `PodSecurityPolicy` to it.
46
+
```yaml
47
+
securityContext:
48
+
// '65534' refers to 'nobody' in all the used default images like alpine, busybox.
49
+
fsGroup: 65534
50
+
fsGroupChangePolicy: OnRootMismatch
51
+
runAsGroup: 65534
52
+
runAsNonRoot: true
53
+
runAsUser: 65534
54
+
seccompProfile:
55
+
type: RuntimeDefault
56
+
```
57
+
58
+
59
+
It's also possible to config strict security on resource basis:
48
60
49
-
Default psp:
50
61
```yaml
51
-
apiVersion: policy/v1beta1
52
-
kind: PodSecurityPolicy
62
+
apiVersion: operator.victoriametrics.com/v1beta1
63
+
kind: VMSingle
53
64
metadata:
54
-
name: vmagent-example
65
+
name: strict-security
66
+
namespace: monitoring-system
55
67
spec:
56
-
allowPrivilegeEscalation: false
57
-
fsGroup:
58
-
rule: RunAsAny
59
-
hostNetwork: true
60
-
requiredDropCapabilities:
61
-
- ALL
62
-
runAsUser:
63
-
rule: RunAsAny
64
-
seLinux:
65
-
rule: RunAsAny
66
-
supplementalGroups:
67
-
rule: RunAsAny
68
-
volumes:
69
-
- persistentVolumeClaim
70
-
- secret
71
-
- emptyDir
72
-
- configMap
73
-
- projected
74
-
- downwardAPI
75
-
- nfs
68
+
retentionPeriod: "2"
69
+
removePvcAfterDelete: true
70
+
useStrictSecurity: true
71
+
storage:
72
+
accessModes:
73
+
- ReadWriteOnce
74
+
resources:
75
+
requests:
76
+
storage: 25Gi
76
77
```
77
78
78
-
User may also override default pod security policy with setting: `spec.podSecurityPolicyName: "psp-name"`.
79
-
80
-
## PodSecurityContext
81
-
82
-
VictoriaMetrics operator will add default Security Context to managed pods and containers if env `EnableStrictSecurity: "true"` is set.
83
-
The following SecurityContext will be applied:
79
+
In addition, operator supports more granular per resource security configuration with [spec.securityContext](https://docs.victoriametrics.com/operator/api/#securitycontext) and [ContainerSecurityContext](https://docs.victoriametrics.com/operator/api/#containersecuritycontext)
0 commit comments