Skip to content

Commit 90188d3

Browse files
authored
Merge pull request #31636 from tengqm/fix-links-2
Fix links and markdown format for some pages
2 parents 0ef9136 + 459a3f9 commit 90188d3

File tree

3 files changed

+207
-157
lines changed

3 files changed

+207
-157
lines changed

content/en/docs/concepts/policy/pod-security-policy.md

Lines changed: 122 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ updates.
2727
## What is a Pod Security Policy?
2828

2929
A _Pod Security Policy_ is a cluster-level resource that controls security
30-
sensitive aspects of the pod specification. The [PodSecurityPolicy](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#podsecuritypolicy-v1beta1-policy) objects
30+
sensitive aspects of the pod specification. The
31+
[PodSecurityPolicy](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#podsecuritypolicy-v1beta1-policy) objects
3132
define a set of conditions that a pod must run with in order to be accepted into
3233
the system, as well as defaults for the related fields. They allow an
3334
administrator to control the following:
@@ -54,10 +55,10 @@ administrator to control the following:
5455

5556
## Enabling Pod Security Policies
5657

57-
Pod security policy control is implemented as an optional [admission
58-
controller](/docs/reference/access-authn-authz/admission-controllers/#podsecuritypolicy).
59-
PodSecurityPolicies are enforced by [enabling the admission
60-
controller](/docs/reference/access-authn-authz/admission-controllers/#how-do-i-turn-on-an-admission-control-plug-in),
58+
Pod security policy control is implemented as an optional
59+
[admission controller](/docs/reference/access-authn-authz/admission-controllers/#podsecuritypolicy).
60+
PodSecurityPolicies are enforced by
61+
[enabling the admission controller](/docs/reference/access-authn-authz/admission-controllers/#how-do-i-turn-on-an-admission-control-plug-in),
6162
but doing so without authorizing any policies **will prevent any pods from being created** in the
6263
cluster.
6364

@@ -69,9 +70,9 @@ controller.
6970
## Authorizing Policies
7071

7172
When a PodSecurityPolicy resource is created, it does nothing. In order to use
72-
it, the requesting user or target pod's [service
73-
account](/docs/tasks/configure-pod-container/configure-service-account/) must be
74-
authorized to use the policy, by allowing the `use` verb on the policy.
73+
it, the requesting user or target pod's
74+
[service account](/docs/tasks/configure-pod-container/configure-service-account/)
75+
must be authorized to use the policy, by allowing the `use` verb on the policy.
7576

7677
Most Kubernetes pods are not created directly by users. Instead, they are
7778
typically created indirectly as part of a
@@ -132,6 +133,7 @@ subjects:
132133
If a `RoleBinding` (not a `ClusterRoleBinding`) is used, it will only grant
133134
usage for pods being run in the same namespace as the binding. This can be
134135
paired with system groups to grant access to all pods run in the namespace:
136+
135137
```yaml
136138
# Authorize all service accounts in a namespace:
137139
- kind: Group
@@ -143,45 +145,47 @@ paired with system groups to grant access to all pods run in the namespace:
143145
name: system:authenticated
144146
```
145147

146-
For more examples of RBAC bindings, see [Role Binding
147-
Examples](/docs/reference/access-authn-authz/rbac#role-binding-examples).
148-
For a complete example of authorizing a PodSecurityPolicy, see
149-
[below](#example).
148+
For more examples of RBAC bindings, see
149+
[RoleBinding examples](/docs/reference/access-authn-authz/rbac#role-binding-examples).
150+
For a complete example of authorizing a PodSecurityPolicy, see [below](#example).
150151

151152
### Recommended Practice
152153

153-
PodSecurityPolicy is being replaced by a new, simplified `PodSecurity` {{< glossary_tooltip
154-
text="admission controller" term_id="admission-controller" >}}. For more details on this change, see
155-
[PodSecurityPolicy Deprecation: Past, Present, and
156-
Future](/blog/2021/04/06/podsecuritypolicy-deprecation-past-present-and-future/). Follow these
157-
guidelines to simplify migration from PodSecurityPolicy to the new admission controller:
154+
PodSecurityPolicy is being replaced by a new, simplified `PodSecurity`
155+
{{< glossary_tooltip text="admission controller" term_id="admission-controller" >}}.
156+
For more details on this change, see
157+
[PodSecurityPolicy Deprecation: Past, Present, and Future](/blog/2021/04/06/podsecuritypolicy-deprecation-past-present-and-future/).
158+
Follow these guidelines to simplify migration from PodSecurityPolicy to the
159+
new admission controller:
160+
161+
1. Limit your PodSecurityPolicies to the policies defined by the
162+
[Pod Security Standards](/docs/concepts/security/pod-security-standards):
158163

159-
1. Limit your PodSecurityPolicies to the policies defined by the [Pod Security Standards](/docs/concepts/security/pod-security-standards):
160-
- {{< example file="policy/privileged-psp.yaml" >}}Privileged{{< /example >}}
161-
- {{< example file="policy/baseline-psp.yaml" >}}Baseline{{< /example >}}
162-
- {{< example file="policy/restricted-psp.yaml" >}}Restricted{{< /example >}}
164+
- {{< example file="policy/privileged-psp.yaml" >}}Privileged{{< /example >}}
165+
- {{< example file="policy/baseline-psp.yaml" >}}Baseline{{< /example >}}
166+
- {{< example file="policy/restricted-psp.yaml" >}}Restricted{{< /example >}}
163167

164-
2. Only bind PSPs to entire namespaces, by using the `system:serviceaccounts:<namespace>` group
168+
1. Only bind PSPs to entire namespaces, by using the `system:serviceaccounts:<namespace>` group
165169
(where `<namespace>` is the target namespace). For example:
166170

167-
```yaml
168-
apiVersion: rbac.authorization.k8s.io/v1
169-
# This cluster role binding allows all pods in the "development" namespace to use the baseline PSP.
170-
kind: ClusterRoleBinding
171-
metadata:
172-
name: psp-baseline-namespaces
173-
roleRef:
174-
kind: ClusterRole
175-
name: psp-baseline
176-
apiGroup: rbac.authorization.k8s.io
177-
subjects:
178-
- kind: Group
179-
name: system:serviceaccounts:development
180-
apiGroup: rbac.authorization.k8s.io
181-
- kind: Group
182-
name: system:serviceaccounts:canary
183-
apiGroup: rbac.authorization.k8s.io
184-
```
171+
```yaml
172+
apiVersion: rbac.authorization.k8s.io/v1
173+
# This cluster role binding allows all pods in the "development" namespace to use the baseline PSP.
174+
kind: ClusterRoleBinding
175+
metadata:
176+
name: psp-baseline-namespaces
177+
roleRef:
178+
kind: ClusterRole
179+
name: psp-baseline
180+
apiGroup: rbac.authorization.k8s.io
181+
subjects:
182+
- kind: Group
183+
name: system:serviceaccounts:development
184+
apiGroup: rbac.authorization.k8s.io
185+
- kind: Group
186+
name: system:serviceaccounts:canary
187+
apiGroup: rbac.authorization.k8s.io
188+
```
185189

186190
### Troubleshooting
187191

@@ -217,8 +221,8 @@ only non-mutating PodSecurityPolicies are used to validate the pod.
217221

218222
## Example
219223

220-
_This example assumes you have a running cluster with the PodSecurityPolicy
221-
admission controller enabled and you have cluster admin privileges._
224+
This example assumes you have a running cluster with the PodSecurityPolicy
225+
admission controller enabled and you have cluster admin privileges.
222226

223227
### Set up
224228

@@ -364,12 +368,24 @@ Let's try that again, slightly differently:
364368

365369
```shell
366370
kubectl-user create deployment pause --image=k8s.gcr.io/pause
367-
deployment "pause" created
371+
```
368372

373+
```none
374+
deployment "pause" created
375+
```
376+
```shell
369377
kubectl-user get pods
378+
```
379+
380+
```
370381
No resources found.
382+
```
371383

384+
```shell
372385
kubectl-user get events | head -n 2
386+
```
387+
388+
```
373389
LASTSEEN FIRSTSEEN COUNT NAME KIND SUBOBJECT TYPE REASON SOURCE MESSAGE
374390
1m 2m 15 pause-7774d79b5 ReplicaSet Warning FailedCreate replicaset-controller Error creating: pods "pause-7774d79b5-" is forbidden: no providers available to validate pod request
375391
```
@@ -390,6 +406,9 @@ is `default`:
390406
kubectl-admin create rolebinding default:psp:unprivileged \
391407
--role=psp:unprivileged \
392408
--serviceaccount=psp-example:default
409+
```
410+
411+
```none
393412
rolebinding "default:psp:unprivileged" created
394413
```
395414

@@ -398,6 +417,9 @@ eventually succeed in creating the pod:
398417

399418
```shell
400419
kubectl-user get pods --watch
420+
```
421+
422+
```none
401423
NAME READY STATUS RESTARTS AGE
402424
pause-7774d79b5-qrgcb 0/1 Pending 0 1s
403425
pause-7774d79b5-qrgcb 0/1 Pending 0 1s
@@ -411,6 +433,9 @@ Delete the namespace to clean up most of the example resources:
411433

412434
```shell
413435
kubectl-admin delete ns psp-example
436+
```
437+
438+
```
414439
namespace "psp-example" deleted
415440
```
416441

@@ -419,6 +444,9 @@ up separately:
419444

420445
```shell
421446
kubectl-admin delete psp example
447+
```
448+
449+
```
422450
podsecuritypolicy "example" deleted
423451
```
424452

@@ -435,7 +463,8 @@ several security mechanisms.
435463

436464
{{< codenew file="policy/restricted-psp.yaml" >}}
437465

438-
See [Pod Security Standards](/docs/concepts/security/pod-security-standards/#policy-instantiation) for more examples.
466+
See [Pod Security Standards](/docs/concepts/security/pod-security-standards/#policy-instantiation)
467+
for more examples.
439468

440469
## Policy Reference
441470

@@ -471,17 +500,17 @@ and `max`(inclusive). Defaults to no allowed host ports.
471500
**Volumes** - Provides a list of allowed volume types. The allowable values
472501
correspond to the volume sources that are defined when creating a volume. For
473502
the complete list of volume types, see [Types of
474-
Volumes](/docs/concepts/storage/volumes/#types-of-volumes). Additionally, `*`
475-
may be used to allow all volume types.
503+
Volumes](/docs/concepts/storage/volumes/#types-of-volumes). Additionally,
504+
`*` may be used to allow all volume types.
476505

477506
The **recommended minimum set** of allowed volumes for new PSPs are:
478507

479-
- configMap
480-
- downwardAPI
481-
- emptyDir
482-
- persistentVolumeClaim
483-
- secret
484-
- projected
508+
- `configMap`
509+
- `downwardAPI`
510+
- `emptyDir`
511+
- `persistentVolumeClaim`
512+
- `secret`
513+
- `projected`
485514

486515
{{< warning >}}
487516
PodSecurityPolicy does not limit the types of `PersistentVolume` objects that
@@ -493,10 +522,10 @@ should be granted permission to create `PersistentVolume` objects.
493522
**FSGroup** - Controls the supplemental group applied to some volumes.
494523

495524
- *MustRunAs* - Requires at least one `range` to be specified. Uses the
496-
minimum value of the first range as the default. Validates against all ranges.
525+
minimum value of the first range as the default. Validates against all ranges.
497526
- *MayRunAs* - Requires at least one `range` to be specified. Allows
498-
`FSGroups` to be left unset without providing a default. Validates against
499-
all ranges if `FSGroups` is set.
527+
`FSGroups` to be left unset without providing a default. Validates against
528+
all ranges if `FSGroups` is set.
500529
- *RunAsAny* - No default provided. Allows any `fsGroup` ID to be specified.
501530

502531
**AllowedHostPaths** - This specifies a list of host paths that are allowed
@@ -515,7 +544,8 @@ For example:
515544
readOnly: true # only allow read-only mounts
516545
```
517546
518-
{{< warning >}}There are many ways a container with unrestricted access to the host
547+
{{< warning >}}
548+
There are many ways a container with unrestricted access to the host
519549
filesystem can escalate privileges, including reading data from other
520550
containers, and abusing the credentials of system services, such as Kubelet.
521551
@@ -556,33 +586,33 @@ spec:
556586
**RunAsUser** - Controls which user ID the containers are run with.
557587

558588
- *MustRunAs* - Requires at least one `range` to be specified. Uses the
559-
minimum value of the first range as the default. Validates against all ranges.
589+
minimum value of the first range as the default. Validates against all ranges.
560590
- *MustRunAsNonRoot* - Requires that the pod be submitted with a non-zero
561-
`runAsUser` or have the `USER` directive defined (using a numeric UID) in the
562-
image. Pods which have specified neither `runAsNonRoot` nor `runAsUser` settings
563-
will be mutated to set `runAsNonRoot=true`, thus requiring a defined non-zero
564-
numeric `USER` directive in the container. No default provided. Setting
565-
`allowPrivilegeEscalation=false` is strongly recommended with this strategy.
591+
`runAsUser` or have the `USER` directive defined (using a numeric UID) in the
592+
image. Pods which have specified neither `runAsNonRoot` nor `runAsUser` settings
593+
will be mutated to set `runAsNonRoot=true`, thus requiring a defined non-zero
594+
numeric `USER` directive in the container. No default provided. Setting
595+
`allowPrivilegeEscalation=false` is strongly recommended with this strategy.
566596
- *RunAsAny* - No default provided. Allows any `runAsUser` to be specified.
567597

568598
**RunAsGroup** - Controls which primary group ID the containers are run with.
569599

570600
- *MustRunAs* - Requires at least one `range` to be specified. Uses the
571-
minimum value of the first range as the default. Validates against all ranges.
601+
minimum value of the first range as the default. Validates against all ranges.
572602
- *MayRunAs* - Does not require that RunAsGroup be specified. However, when RunAsGroup
573-
is specified, they have to fall in the defined range.
603+
is specified, they have to fall in the defined range.
574604
- *RunAsAny* - No default provided. Allows any `runAsGroup` to be specified.
575605

576606

577607
**SupplementalGroups** - Controls which group IDs containers add.
578608

579609
- *MustRunAs* - Requires at least one `range` to be specified. Uses the
580-
minimum value of the first range as the default. Validates against all ranges.
610+
minimum value of the first range as the default. Validates against all ranges.
581611
- *MayRunAs* - Requires at least one `range` to be specified. Allows
582-
`supplementalGroups` to be left unset without providing a default.
583-
Validates against all ranges if `supplementalGroups` is set.
612+
`supplementalGroups` to be left unset without providing a default.
613+
Validates against all ranges if `supplementalGroups` is set.
584614
- *RunAsAny* - No default provided. Allows any `supplementalGroups` to be
585-
specified.
615+
specified.
586616

587617
### Privilege Escalation
588618

@@ -627,8 +657,8 @@ added. Capabilities listed in `RequiredDropCapabilities` must not be included in
627657
`AllowedCapabilities` or `DefaultAddCapabilities`.
628658

629659
**DefaultAddCapabilities** - The capabilities which are added to containers by
630-
default, in addition to the runtime defaults. See the [Docker
631-
documentation](https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities)
660+
default, in addition to the runtime defaults. See the
661+
[Docker documentation](https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities)
632662
for the default list of capabilities when using the Docker runtime.
633663

634664
### SELinux
@@ -655,16 +685,17 @@ denoted as the string `Unmasked`.
655685

656686
### AppArmor
657687

658-
Controlled via annotations on the PodSecurityPolicy. Refer to the [AppArmor
659-
documentation](/docs/tutorials/clusters/apparmor/#podsecuritypolicy-annotations).
688+
Controlled via annotations on the PodSecurityPolicy. Refer to the
689+
[AppArmor documentation](/docs/tutorials/security/apparmor/#podsecuritypolicy-annotations).
660690

661691
### Seccomp
662692

663693
As of Kubernetes v1.19, you can use the `seccompProfile` field in the
664-
`securityContext` of Pods or containers to [control use of seccomp
665-
profiles](/docs/tutorials/clusters/seccomp). In prior versions, seccomp was
666-
controlled by adding annotations to a Pod. The same PodSecurityPolicies can be
667-
used with either version to enforce how these fields or annotations are applied.
694+
`securityContext` of Pods or containers to
695+
[control use of seccomp profiles](/docs/tutorials/security/seccomp/).
696+
In prior versions, seccomp was controlled by adding annotations to a Pod. The
697+
same PodSecurityPolicies can be used with either version to enforce how these
698+
fields or annotations are applied.
668699

669700
**seccomp.security.alpha.kubernetes.io/defaultProfileName** - Annotation that
670701
specifies the default seccomp profile to apply to containers. Possible values
@@ -681,10 +712,10 @@ are:
681712
flag is not defined, the default path will be used, which is
682713
`<root-dir>/seccomp` where `<root-dir>` is specified by the `--root-dir` flag.
683714

684-
{{< note >}}
715+
{{< note >}}
685716
The `--seccomp-profile-root` flag is deprecated since Kubernetes
686717
v1.19. Users are encouraged to use the default path.
687-
{{< /note >}}
718+
{{< /note >}}
688719

689720
**seccomp.security.alpha.kubernetes.io/allowedProfileNames** - Annotation that
690721
specifies which values are allowed for the pod seccomp annotations. Specified as
@@ -696,18 +727,22 @@ default cannot be changed.
696727

697728
By default, all safe sysctls are allowed.
698729

699-
- `forbiddenSysctls` - excludes specific sysctls. You can forbid a combination of safe and unsafe sysctls in the list. To forbid setting any sysctls, use `*` on its own.
700-
- `allowedUnsafeSysctls` - allows specific sysctls that had been disallowed by the default list, so long as these are not listed in `forbiddenSysctls`.
730+
- `forbiddenSysctls` - excludes specific sysctls. You can forbid a combination
731+
of safe and unsafe sysctls in the list. To forbid setting any sysctls, use
732+
`*` on its own.
733+
- `allowedUnsafeSysctls` - allows specific sysctls that had been disallowed by
734+
the default list, so long as these are not listed in `forbiddenSysctls`.
701735

702-
Refer to the [Sysctl documentation](
703-
/docs/tasks/administer-cluster/sysctl-cluster/#podsecuritypolicy).
736+
Refer to the [Sysctl documentation](/docs/tasks/administer-cluster/sysctl-cluster/#podsecuritypolicy).
704737

705738
## {{% heading "whatsnext" %}}
706739

707-
- See [PodSecurityPolicy Deprecation: Past, Present, and
708-
Future](/blog/2021/04/06/podsecuritypolicy-deprecation-past-present-and-future/) to learn about
709-
the future of pod security policy.
740+
- See [PodSecurityPolicy Deprecation: Past, Present, and Future](/blog/2021/04/06/podsecuritypolicy-deprecation-past-present-and-future/)
741+
to learn about the future of pod security policy.
742+
743+
- See [Pod Security Standards](/docs/concepts/security/pod-security-standards/)
744+
for policy recommendations.
710745

711-
- See [Pod Security Standards](/docs/concepts/security/pod-security-standards/) for policy recommendations.
746+
- Refer to [PodSecurityPolicy reference](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#podsecuritypolicy-v1beta1-policy)
747+
for the API details.
712748

713-
- Refer to [Pod Security Policy Reference](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#podsecuritypolicy-v1beta1-policy) for the api details.

content/en/docs/reference/using-api/deprecation-policy.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ might have to add an equivalent field or represent it as an annotation.
8585
* **Beta API versions must be supported for 9 months or 3 releases (whichever is longer) after deprecation**
8686
* **Alpha API versions may be removed in any release without prior deprecation notice**
8787

88-
This ensures beta API support covers the [maximum supported version skew of 2 releases](/docs/setup/release/version-skew-policy/).
88+
This ensures beta API support covers the [maximum supported version skew of 2 releases](/releases/version-skew-policy/).
8989

9090
{{< note >}}
9191
There are no current plans for a major version revision of Kubernetes that removes GA APIs.

0 commit comments

Comments
 (0)