Skip to content

Commit 025c86b

Browse files
committed
Promote sysctls to Beta
1 parent 83d9cef commit 025c86b

File tree

2 files changed

+31
-15
lines changed

2 files changed

+31
-15
lines changed

content/en/docs/reference/command-line-tools-reference/feature-gates.md

+2
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ different Kubernetes components.
8686
| `SupportIPVSProxyMode` | `false` | Beta | 1.9 | 1.9 |
8787
| `SupportIPVSProxyMode` | `true` | Beta | 1.10 | |
8888
| `SupportPodPidsLimit` | `false` | Alpha | 1.10 | |
89+
| `Sysctls` | `true` | `Beta` | 1.11 | |
8990
| `TaintBasedEvictions` | `false` | Alpha | 1.6 | |
9091
| `TaintNodesByCondition` | `false` | Alpha | 1.8 | |
9192
| `TokenRequest` | `false` | Alpha | 1.10 | |
@@ -211,6 +212,7 @@ Each feature gate is designed for enabling/disabling a specific feature:
211212
- `SupportIPVSProxyMode`: Enable providing in-cluster service load balancing using IPVS.
212213
See [service proxies](/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies) for more details.
213214
- `SupportPodPidsLimit`: Enable the support to limiting PIDs in Pods.
215+
- `Sysctls`: Comma-separated whitelist of unsafe sysctls or unsafe sysctl patterns (ending in `*`)
214216
- `TaintBasedEvictions`: Enable evicting pods from nodes based on taints on nodes and tolerations on Pods.
215217
See [taints and tolerations](/docs/concepts/configuration/taint-and-toleration/) for more details.
216218
- `TaintNodesByCondition`: Enable automatic tainting nodes based on [node conditions](/docs/concepts/architecture/nodes/#condition).

content/en/docs/tasks/administer-cluster/sysctl-cluster.md

+29-15
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ application tuning. _Unsafe_ sysctls are enabled on a node-by-node basis with a
7474
flag of the kubelet, e.g.:
7575

7676
```shell
77-
$ kubelet --experimental-allowed-unsafe-sysctls \
77+
$ kubelet --allowed-unsafe-sysctls \
7878
'kernel.msg*,net.ipv4.route.min_pmtu' ...
7979
```
8080

@@ -105,20 +105,25 @@ manually by the cluster admin, either by means of the underlying Linux
105105
distribution of the nodes (e.g. via `/etc/sysctls.conf`) or using a DaemonSet
106106
with privileged containers.
107107

108-
The sysctl feature is an alpha API. Therefore, sysctls are set using annotations
108+
The sysctl feature is a beta API. The sysctls are set through pod security context
109109
on pods. They apply to all containers in the same pod.
110110

111-
Here is an example, with different annotations for _safe_ and _unsafe_ sysctls:
111+
Here is an example, (notice there is no distinction between _safe_ and _unsafe_ sysctls in the spec):
112112

113113
```yaml
114114
apiVersion: v1
115115
kind: Pod
116116
metadata:
117117
name: sysctl-example
118-
annotations:
119-
security.alpha.kubernetes.io/sysctls: kernel.shm_rmid_forced=1
120-
security.alpha.kubernetes.io/unsafe-sysctls: net.ipv4.route.min_pmtu=1000,kernel.msgmax=1 2 3
121118
spec:
119+
securityContext:
120+
sysctls:
121+
- name: kernel.shm_rmid_forced
122+
value: 1
123+
- name: net.ipv4.route.min_pmtu
124+
value: 1000,
125+
- name: kernel.msgmax
126+
value: 1 2 3
122127
...
123128
```
124129
{{% /capture %}}
@@ -143,13 +148,22 @@ is recommended to use
143148
[taints on nodes](/docs/concepts/configuration/taint-and-toleration/)
144149
to schedule those pods onto the right nodes.
145150

146-
## PodSecurityPolicy Annotations
151+
## PodSecurityPolicy
147152

148-
The use of sysctl in pods can be controlled via annotation on the PodSecurityPolicy.
153+
The use of sysctl in pods can be controlled through `allowedUnsafeSysctls` and
154+
`forbiddenSysctls` fields on the PodSecurityPolicy.
149155

150-
Sysctl annotation represents a whitelist of allowed safe and unsafe sysctls
151-
in a pod spec. It's a comma-separated list of plain sysctl names or sysctl patterns
152-
(which end in `*`). The string `*` matches all sysctls.
156+
By default, all safe sysctls are allowed. Currently, the whitelist of safe sysctls corresponds to:
157+
158+
* `kernel.shm_rmid_forced`
159+
* `net.ipv4.ip_local_port_range`
160+
* `net.ipv4.tcp_syncookies`
161+
162+
Both `allowedUnsafeSysctls` and `forbiddenSysctls` are lists of plain sysctl names
163+
or sysctl patterns (which end in `*`). The string `*` matches all sysctls.
164+
165+
The `allowedUnsafeSysctls` field excludes sysctls from the whitelist (`*` means no safe sysctls allowed).
166+
Any sysctl specified by the `forbiddenSysctls` is on the other hand allowed (`*` means all unsafe sysctls allowed).
153167

154168
Here is an example, it authorizes binding user creating pod with corresponding sysctls.
155169

@@ -158,12 +172,12 @@ apiVersion: policy/v1beta1
158172
kind: PodSecurityPolicy
159173
metadata:
160174
name: sysctl-psp
161-
annotations:
162-
security.alpha.kubernetes.io/sysctls: 'net.ipv4.route.*,kernel.msg*'
163175
spec:
176+
allowedUnsafeSysctls:
177+
- kernel.msg*
178+
forbiddenSysctls:
179+
- kernel.shm_rmid_forced
164180
...
165181
```
166182

167183
{{% /capture %}}
168-
169-

0 commit comments

Comments
 (0)