--- title: 从 PodSecurityPolicy 映射到 Pod 安全性标准 content_type: concept weight: 95 --- 下面的表格列举了 [PodSecurityPolicy](/zh-cn/docs/concepts/security/pod-security-policy/) 对象上的配置参数,这些字段是否会变更或检查 Pod 配置,以及这些配置值如何映射到 [Pod 安全性标准(Pod Security Standards)](/zh-cn/docs/concepts/security/pod-security-standards/) 之上。 对于每个可应用的参数,表格中给出了 [Baseline](/zh-cn/docs/concepts/security/pod-security-standards/#baseline) 和 [Restricted](/zh-cn/docs/concepts/security/pod-security-standards/#restricted) 配置下可接受的取值。 对这两种配置而言不可接受的取值均归入 [Privileged](/zh-cn/docs/concepts/security/pod-security-standards/#privileged) 配置下。“无意见”意味着对所有 Pod 安全性标准而言所有取值都可接受。 如果想要了解如何一步步完成迁移,可参阅[从 PodSecurityPolicy 迁移到内置的 PodSecurity 准入控制器](/zh-cn/docs/tasks/configure-pod-container/migrate-from-psp/)。 ## PodSecurityPolicy 规约 {#podsecuritypolicy-spec} 下面表格中所列举的字段是 `PodSecurityPolicySpec` 的一部分,是通过 `.spec` 字段路径来设置的。
PodSecurityPolicySpec |
类型 | Pod 安全性标准中对应设置 |
|---|---|---|
privileged |
检查性质 | Baseline & Restricted: false / 未定义 / nil |
defaultAddCapabilities |
更改性质 & 检查性质 | 需求满足下面的 allallowedCapabilities |
allowedCapabilities |
检查性质 |
Baseline:下面各项的子集
Restricted:空 / 未定义 / nil 或仅包含 |
requiredDropCapabilities |
更改性质 & 检查性质 |
Baseline:无意见 Restricted:必须包含 |
volumes |
检查性质 |
Baseline除下列取值之外的任何值
Restricted:下列取值的子集
|
hostNetwork |
检查性质 | Baseline & Restricted:false / 未定义 / nil |
hostPorts |
检查性质 | Baseline & Restricted:未定义 / nil / 空 |
hostPID |
检查性质 | Baseline & Restricted:false / 未定义 / nil |
hostIPC |
检查性质 | Baseline & Restricted:false / 未定义 / nil |
seLinux |
更改性质 & 检查性质 |
Baseline & Restricted:
|
runAsUser |
变更性质 & 检查性质 |
Baseline:任何取值 Restricted: |
runAsGroup |
变更性质(MustRunAs)& 检查性质 | 无意见 |
supplementalGroups |
变更性质 & 检查性质 | 无意见 |
fsGroup |
变更性质 & 验证性质 | 无意见 |
readOnlyRootFilesystem |
变更性质 & 检查性质 | 无意见 |
defaultAllowPrivilegeEscalation |
变更性质 | 无意见(非变更性质) |
allowPrivilegeEscalation |
变更性质 & 检查性质 |
只有设置为 Baseline:无意见 Restricted: |
allowedHostPaths |
检查性质 | 无意见(volumes 优先) |
allowedFlexVolumes |
检查性质 | 无意见(volumes 优先) |
allowedCSIDrivers |
检查性质 | 无意见(volumes 优先) |
allowedUnsafeSysctls |
检查性质 | Baseline & Restricted:未定义 / nil / 空 |
forbiddenSysctls |
检查性质 | 无意见 |
allowedProcMountTypes(alpha feature) |
检查性质 | Baseline & Restricted:["Default"] 或者未定义 / nil / 空 |
runtimeClass .defaultRuntimeClassName |
变更性质 | 无意见 |
runtimeClass .allowedRuntimeClassNames |
检查性质 | 无意见 |
PSP 注解 |
类型 | Pod 安全性标准中对应设置 |
|---|---|---|
seccomp.security.alpha.kubernetes.io/defaultProfileName |
变更性质 | 无意见 |
seccomp.security.alpha.kubernetes.io/allowedProfileNames |
检查性质 |
Baseline: Restricted:
|
apparmor.security.beta.kubernetes.io/defaultProfileName |
变更性质 | 无意见 |
apparmor.security.beta.kubernetes.io/allowedProfileNames |
检查性质 |
Baseline: Restricted:
|