策略资源
1 - LimitRange
apiVersion: v1
import "k8s.io/api/core/v1"
LimitRange
LimitRange 设置名字空间中每个资源类别的资源用量限制。
-
apiVersion: v1
-
kind: LimitRange
-
metadata (ObjectMeta)
标准的对象元数据。更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
-
spec (LimitRangeSpec)
spec 定义强制执行的限制。更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
LimitRangeSpec
LimitRangeSpec 定义与类别匹配的资源的最小/最大使用限制。
-
limits ([]LimitRangeItem),必需
limits 是强制执行的 LimitRangeItem 对象的列表。
LimitRangeItem 定义与类别匹配的任意资源的最小/最大使用限制。
-
limits.type (string),必需
此限制应用到的资源的类型。
-
LimitRangeList
LimitRangeList 是 LimitRange 项的列表。
-
apiVersion: v1
-
kind: LimitRangeList
-
metadata (ListMeta)
标准的列表元数据。更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
-
items ([]LimitRange),必需
items 是 LimitRange 对象的列表。更多信息: https://kubernetes.io/zh-cn/docs/concepts/configuration/manage-resources-containers/
操作
get
读取指定的 LimitRange
HTTP 请求
GET /api/v1/namespaces/{namespace}/limitranges/{name}
参数
-
name (路径参数): string,必需
LimitRange 的名称
-
namespace (路径参数): string,必需
-
pretty (查询参数): string
响应
200 (LimitRange): OK
401: Unauthorized
list
列出或监视 LimitRange 类别的对象
HTTP 请求
GET /api/v1/namespaces/{namespace}/limitranges
参数
-
namespace (路径参数): string,必需
-
allowWatchBookmarks (查询参数): boolean
-
continue (查询参数): string
-
fieldSelector (查询参数): string
-
labelSelector (查询参数): string
-
limit (查询参数): integer
-
pretty (查询参数): string
-
resourceVersion (查询参数): string
-
resourceVersionMatch (查询参数): string
-
timeoutSeconds (查询参数): integer
-
watch (查询参数): boolean
响应
200 (LimitRangeList): OK
401: Unauthorized
list
列出或监视 LimitRange 类别的对象
HTTP 请求
GET /api/v1/limitranges
参数
-
allowWatchBookmarks (查询参数): boolean
-
continue (查询参数): string
-
fieldSelector (查询参数): string
-
labelSelector (查询参数): string
-
limit (查询参数): integer
-
pretty (查询参数): string
-
resourceVersion (查询参数): string
-
resourceVersionMatch (查询参数): string
-
timeoutSeconds (查询参数): integer
-
watch (查询参数): boolean
响应
200 (LimitRangeList): OK
401: Unauthorized
create
创建 LimitRange
HTTP 请求
POST /api/v1/namespaces/{namespace}/limitranges
参数
-
namespace (路径参数): string,必需
-
body: LimitRange,必需
-
dryRun (查询参数): string
-
fieldManager (查询参数): string
-
fieldValidation (查询参数): string
-
pretty (查询参数): string
响应
200 (LimitRange): OK
201 (LimitRange): Created
202 (LimitRange): Accepted
401: Unauthorized
update
替换指定的 LimitRange
HTTP 请求
PUT /api/v1/namespaces/{namespace}/limitranges/{name}
参数
-
name (路径参数): string,必需
LimitRange 的名称
-
namespace (路径参数): string,必需
-
body: LimitRange,必需
-
dryRun (查询参数): string
-
fieldManager (查询参数): string
-
fieldValidation (查询参数): string
-
pretty (查询参数): string
响应
200 (LimitRange): OK
201 (LimitRange): Created
401: Unauthorized
patch
部分更新指定的 LimitRange
HTTP 请求
PATCH /api/v1/namespaces/{namespace}/limitranges/{name}
参数
-
name (路径参数): string,必需
LimitRange 的名称
-
namespace (路径参数): string,必需
-
body: Patch,必需
-
dryRun (查询参数): string
-
fieldManager (查询参数): string
-
fieldValidation (查询参数): string
-
force (查询参数): boolean
-
pretty (查询参数): string
响应
200 (LimitRange): OK
201 (LimitRange): Created
401: Unauthorized
delete
删除 LimitRange
HTTP 请求
DELETE /api/v1/namespaces/{namespace}/limitranges/{name}
参数
-
name (路径参数): string,必需
LimitRange 的名称
-
namespace (路径参数): string,必需
-
body: DeleteOptions
-
dryRun (查询参数): string
-
gracePeriodSeconds (查询参数): integer
-
pretty (查询参数): string
-
propagationPolicy (查询参数): string
响应
200 (Status): OK
202 (Status): Accepted
401: Unauthorized
deletecollection
删除 LimitRange 的集合
HTTP 请求
DELETE /api/v1/namespaces/{namespace}/limitranges
参数
-
namespace (路径参数): string,必需
-
body: DeleteOptions
-
continue (查询参数): string
-
dryRun (查询参数): string
-
fieldSelector (查询参数): string
-
gracePeriodSeconds (查询参数): integer
-
labelSelector (查询参数): string
-
limit (查询参数): integer
-
pretty (查询参数): string
-
propagationPolicy (查询参数): string
-
resourceVersion (查询参数): string
-
resourceVersionMatch (查询参数): string
-
timeoutSeconds (查询参数): integer
响应
200 (Status): OK
401: Unauthorized
2 - PodDisruptionBudget
apiVersion: policy/v1
import "k8s.io/api/policy/v1"
PodDisruptionBudget
PodDisruptionBudget 是一个对象,用于定义可能对一组 Pod 造成的最大干扰。
-
apiVersion: policy/v1
-
kind: PodDisruptionBudget
-
metadata (ObjectMeta)
标准的对象元数据。 更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata。
-
spec (PodDisruptionBudgetSpec)
PodDisruptionBudget 预期行为的规约。
-
status (PodDisruptionBudgetStatus)
此 PodDisruptionBudget 的最近观测状态。
PodDisruptionBudgetSpec
PodDisruptionBudgetSpec 是对 PodDisruptionBudget 的描述。
-
maxUnavailable (IntOrString)
如果 “selector” 所选中的 Pod 中最多有 “maxUnavailable” Pod 在驱逐后不可用(即去掉被驱逐的 Pod 之后),则允许驱逐。 例如,可以通过将此字段设置为 0 来阻止所有自愿驱逐。此字段是与 “minAvailable” 互斥的设置。
IntOrString 是一种可以包含 int32 或字符串数值的类型。在 JSON 或 YAML 编组和解组时, 会生成或使用内部类型。例如,此类型允许你定义一个可以接受名称或数字的 JSON 字段。
-
minAvailable (IntOrString)
如果 “selector” 所选中的 Pod 中,至少 “minAvailable” 个 Pod 在驱逐后仍然可用(即去掉被驱逐的 Pod 之后),则允许驱逐。 因此,你可以通过将此字段设置为 “100%” 来禁止所有自愿驱逐。
IntOrString 是一种可以包含 int32 或字符串数值的类型。在 JSON 或 YAML 编组和解组时, 会生成或使用内部类型。例如,此类型允许你定义一个可以接受名称或数字的 JSON 字段。
-
selector (LabelSelector)
标签查询,用来选择其驱逐由干扰预算来管理的 Pod 集合。 选择算符为 null 时将不会匹配任何 Pod,而空 ({}) 选择算符将选中名字空间内的所有 Pod。
PodDisruptionBudgetStatus
PodDisruptionBudgetStatus 表示有关此 PodDisruptionBudget 状态的信息。状态可能会反映系统的实际状态。
-
currentHealthy (int32), 必需
当前健康 Pod 的数量。
-
desiredHealthy (int32), 必需
健康 Pod 的最小期望值。
-
disruptionsAllowed (int32), 必需
当前允许的 Pod 干扰计数。
-
conditions ([]Condition)
补丁策略:根据
type
键执行合并操作Map:键 type 的唯一值将在合并期间被保留
conditions 包含 PDB 的状况。干扰控制器会设置 DisruptionAllowed 状况。 以下是 reason 字段的已知值(将来可能会添加其他原因):
- SyncFailed:控制器遇到错误并且无法计算允许的干扰计数。因此不允许任何干扰,且状况的状态将变为 False。
- InsufficientPods:Pod 的数量只能小于或等于 PodDisruptionBudget 要求的数量。 不允许任何干扰,且状况的状态将是 False。
- SufficientPods:Pod 个数超出 PodDisruptionBudget 所要求的阈值。 此状况为 True 时,基于 disruptsAllowed 属性确定所允许的干扰数目。
Condition 包含此 API 资源当前状态的一个方面的详细信息。
-
conditions.lastTransitionTime (Time), 必需
lastTransitionTime 是状况最近一次从一种状态转换到另一种状态的时间。 这种变化通常出现在下层状况发生变化的时候。如果无法了解下层状况变化,使用 API 字段更改的时间也是可以接受的。
Time 是 time.Time 的包装器,它支持对 YAML 和 JSON 的正确编组。 time 包的许多工厂方法提供了包装器。
-
conditions.message (string), 必需
message 是一条人类可读的消息,指示有关转换的详细信息。它可能是一个空字符串。
-
conditions.reason (string), 必需
reason 包含一个程序标识符,指示状况最后一次转换的原因。 特定状况类型的生产者可以定义该字段的预期值和含义,以及这些值是否可被视为有保证的 API。 该值应该是 CamelCase 字符串。此字段不能为空。
-
conditions.status (string), 必需
状况的状态为 True、False、Unknown 之一。
-
conditions.type (string), 必需
CamelCase 或 foo.example.com/CamelCase 形式的状况类型。
-
conditions.observedGeneration (int64)
observedGeneration 表示设置状况时所基于的 .metadata.generation。 例如,如果 .metadata.generation 当前为 12,但 .status.conditions[x].observedGeneration 为 9, 则状况相对于实例的当前状态已过期。
-
disruptedPods (map[string]Time)
disruptedPods 包含有关 Pod 的一些信息,这些 Pod 的驱逐操作已由 API 服务器上的 eviction 子资源处理程序处理, 但尚未被 PodDisruptionBudget 控制器观察到。 从 API 服务器处理驱逐请求到 PDB 控制器看到该 Pod 已标记为删除(或超时后),Pod 将记录在此映射中。 映射中的键名是 Pod 的名称,键值是 API 服务器处理驱逐请求的时间。 如果删除没有发生并且 Pod 仍然存在,PodDisruptionBudget 控制器将在一段时间后自动将 Pod 从列表中删除。 如果一切顺利,此映射大部分时间应该是空的。映射中的存在大量条目可能表明 Pod 删除存在问题。
Time 是 time.Time 的包装器,它支持对 YAML 和 JSON 的正确编组。 time 包的许多工厂方法提供了包装器。
-
observedGeneration (int64)
更新此 PDB 状态时观察到的最新一代。 DisruptionsAllowed 和其他状态信息仅在 observedGeneration 等于 PDB 的对象的代数时才有效。
PodDisruptionBudgetList
PodDisruptionBudgetList 是 PodDisruptionBudget 的集合。
-
apiVersion: policy/v1
-
kind: PodDisruptionBudgetList
-
metadata (ListMeta)
标准的对象元数据。 更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata。
-
items ([]PodDisruptionBudget), 必需
items 是 PodDisruptionBudgets 的列表。
操作
get
读取指定的 PodDisruptionBudget
HTTP 请求
GET /apis/policy/v1/namespaces/{namespace}/poddisruptionbudgets/{name}
参数
-
name (路径参数): string, 必需
PodDisruptionBudget 的名称。
-
namespace (路径参数): string, 必需
-
pretty (查询参数): string
响应
200 (PodDisruptionBudget): OK
401: Unauthorized
get
读取指定 PodDisruptionBudget 的状态
HTTP 请求
GET /apis/policy/v1/namespaces/{namespace}/poddisruptionbudgets/{name}/status
参数
-
name (路径参数): string, 必需
PodDisruptionBudget 的名称。
-
namespace (路径参数): string, 必需
-
pretty (查询参数): string
响应
200 (PodDisruptionBudget): OK
401: Unauthorized
list
列出或监视 PodDisruptionBudget 类型的对象
HTTP 请求
GET /apis/policy/v1/namespaces/{namespace}/poddisruptionbudgets
参数
-
namespace (路径参数): string, 必需
-
allowWatchBookmarks (查询参数): boolean
-
continue (查询参数): string
-
fieldSelector (查询参数): string
-
labelSelector (查询参数): string
-
limit (查询参数): integer
-
pretty (查询参数): string
-
resourceVersion (查询参数): string
-
resourceVersionMatch (查询参数): string
-
timeoutSeconds (查询参数): integer
-
watch (查询参数): boolean
响应
200 (PodDisruptionBudgetList): OK
401: Unauthorized
list
列出或监视 PodDisruptionBudget 类型的对象
HTTP 请求
GET /apis/policy/v1/poddisruptionbudgets
参数
-
allowWatchBookmarks (查询参数): boolean
-
continue (查询参数): string
-
fieldSelector (查询参数): string
-
labelSelector (查询参数): string
-
limit (查询参数): integer
-
pretty (查询参数): string
-
resourceVersion (查询参数): string
-
resourceVersionMatch (查询参数): string
-
timeoutSeconds (查询参数): integer
-
watch (查询参数): boolean
响应
200 (PodDisruptionBudgetList): OK
401: Unauthorized
create
创建一个 PodDisruptionBudget
HTTP 请求
POST /apis/policy/v1/namespaces/{namespace}/poddisruptionbudgets
参数
-
namespace (路径参数): string, 必需
- body: PodDisruptionBudget, 必需
-
dryRun (查询参数): string
-
fieldManager (查询参数): string
-
fieldValidation (查询参数): string
-
pretty (查询参数): string
响应
200 (PodDisruptionBudget): OK
201 (PodDisruptionBudget): Created
202 (PodDisruptionBudget): Accepted
401: Unauthorized
update
替换指定的 PodDisruptionBudget
HTTP 请求
PUT /apis/policy/v1/namespaces/{namespace}/poddisruptionbudgets/{name}
参数
-
name (路径参数): string, 必需
PodDisruptionBudget 的名称。
-
namespace (路径参数): string, 必需
- body: PodDisruptionBudget, 必需
-
dryRun (查询参数): string
-
fieldManager (查询参数): string
-
fieldValidation (查询参数): string
响应
200 (PodDisruptionBudget): OK
201 (PodDisruptionBudget): Created
401: Unauthorized
update
替换指定 PodDisruptionBudget 的状态
HTTP 请求
PUT /apis/policy/v1/namespaces/{namespace}/poddisruptionbudgets/{name}/status
参数
-
name (路径参数): string, 必需
PodDisruptionBudget 的名称。
-
namespace (路径参数): string, 必需
- body: PodDisruptionBudget, 必需
-
dryRun (查询参数): string
-
fieldManager (查询参数): string
-
fieldValidation (查询参数): string
响应
200 (PodDisruptionBudget): OK
201 (PodDisruptionBudget): Created
401: Unauthorized
patch
部分更新指定的 PodDisruptionBudget
HTTP 请求
PATCH /apis/policy/v1/namespaces/{namespace}/poddisruptionbudgets/{name}
参数
-
name (路径参数): string, 必需
PodDisruptionBudget 的名称
-
namespace (路径参数): string, 必需
- body: Patch, 必需
-
dryRun (查询参数): string
-
fieldManager (查询参数): string
-
fieldValidation (查询参数): string
-
force (查询参数): boolean
-
pretty (查询参数): string
响应
200 (PodDisruptionBudget): OK
201 (PodDisruptionBudget): Created
401: Unauthorized
patch
部分更新指定 PodDisruptionBudget 的状态
HTTP 请求
PATCH /apis/policy/v1/namespaces/{namespace}/poddisruptionbudgets/{name}/status
参数
-
name (路径参数): string, 必需
PodDisruptionBudget 的名称。
-
namespace (路径参数): string, 必需
- body: Patch, 必需
-
dryRun (查询参数): string
-
fieldManager (查询参数): string
-
fieldValidation (查询参数): string
-
force (查询参数): boolean
-
pretty (查询参数): string
响应
200 (PodDisruptionBudget): OK
201 (PodDisruptionBudget): Created
401: Unauthorized
delete
删除 PodDisruptionBudget
HTTP 请求
DELETE /apis/policy/v1/namespaces/{namespace}/poddisruptionbudgets/{name}
参数
-
name (路径参数): string, 必需
PodDisruptionBudget 的名称。
-
namespace (路径参数): string, 必需
-
body: DeleteOptions
-
dryRun (查询参数): string
-
gracePeriodSeconds (查询参数): integer
-
pretty (查询参数): string
-
propagationPolicy (查询参数): string
响应
200 (Status): OK
202 (Status): Accepted
401: Unauthorized
deletecollection
删除 PodDisruptionBudget 的集合
HTTP Request
DELETE /apis/policy/v1/namespaces/{namespace}/poddisruptionbudgets
参数
-
namespace (路径参数): string, 必需
-
body: DeleteOptions
-
continue (查询参数): string
-
dryRun (查询参数): string
-
fieldSelector (查询参数): string
-
gracePeriodSeconds (查询参数): integer
-
labelSelector (查询参数): string
-
limit (查询参数): integer
-
pretty (查询参数): string
-
propagationPolicy (查询参数): string
-
resourceVersion (查询参数): string
-
resourceVersionMatch (查询参数): string
-
timeoutSeconds (查询参数): integer
响应
200 (Status): OK
401: Unauthorized
3 - PodSecurityPolicy v1beta1
apiVersion: policy/v1beta1
import "k8s.io/api/policy/v1beta1"
PodSecurityPolicy
PodSecurityPolicy 对影响到安全上下文的请求能力进行治理,而安全上下文可以应用到 Pod 和容器上。 在 1.21 中已被弃用。
-
apiVersion: policy/v1beta1
-
kind: PodSecurityPolicy
-
metadata (ObjectMeta)
标准的对象元数据。更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
-
spec (PodSecurityPolicySpec)
spec 定义强制执行的策略。
PodSecurityPolicySpec
PodSecurityPolicySpec 定义强制执行的策略。
-
runAsUser (RunAsUserStrategyOptions),必需
runAsUser 是一种策略,它将规定允许为 runAsUser 设置的值。
RunAsUserStrategyOptions 定义策略类型和用于创建该策略的任意选项。
-
runAsUser.rule (string),必需
rule 是一种策略,它将规定允许为 runAsUser 设置的值。
-
runAsUser.ranges ([]IDRange)
ranges 是可以使用的 UID 的允许范围。 如果你要强制使用某个确定 UID,则应提供起点值和终点值相同的范围设定。 对于 mustRunAs 而言是必需的。
-
runAsUser.ranges.max (int64),必需
max 是范围的终点,该值包含在此范围内。
-
runAsUser.ranges.min (int64),必需
min 是范围的起点,该值包含在此范围内。
-
-
-
runAsGroup (RunAsGroupStrategyOptions)
runAsGroup 是一种策略,它将规定可以为 runAsGroup 设置的值。 如果省略此字段,则 Pod 的 runAsGroup 可以取任何值。 此字段要求启用
RunAsGroup
特性门控。RunAsGroupStrategyOptions 定义策略类型和用于创建该策略的任意选项。
-
runAsGroup.rule (string),必需
rule 是一种策略,它将规定可以为 runAsGroup 设置的值。
-
runAsGroup.ranges ([]IDRange)
ranges 是可以使用的 GID 的范围。 如果你要强制使用某个确定的 GID,则可提供起点和终点相同的范围设定。 对于 mustRunAs 而言是必需的。
-
runAsGroup.ranges.max (int64),必需
max 是范围的终点,该值包含在此范围内。
-
runAsGroup.ranges.min (int64),必需
min 是范围的起点,该值包含在此范围内。
-
-
-
fsGroup (FSGroupStrategyOptions),必需
fsGroup 是一种策略,它将规定 SecurityContext 将使用哪个 fs 组。
FSGroupStrategyOptions 定义策略类型和用于创建该策略的任意选项。
-
fsGroup.ranges ([]IDRange)
ranges 是 fs 组的允许范围。 如果你要强制使用某个确定的 fs 组,则应提供起点和终点相同的范围设定。 对于 mustRunAs 而言是必需的。
-
fsGroup.ranges.max (int64),必需
max 是范围的终点,该值包含在此范围内。
-
fsGroup.ranges.min (int64),必需
min 是范围的起点,该值包含在此范围内。
-
-
fsGroup.rule (string)
rule 是一种策略,它将规定 SecurityContext 中使用哪个 FSGroup。
-
-
supplementalGroups (SupplementalGroupsStrategyOptions),必需
supplementalGroups 是一种策略,它将规定 SecurityContext 将使用哪个补充组。
SupplementalGroupsStrategyOptions 定义策略类型和用于创建该策略的任意选项。
-
supplementalGroups.ranges ([]IDRange)
ranges 是补充组的允许范围。 如果你要强制使用固定的某个补充组,则应提供起点和终点相同的范围设定。 对于 mustRunAs 而言是必需的。
-
supplementalGroups.ranges.max (int64),必需
max 是范围的终点,该值包含在此范围内。
-
supplementalGroups.ranges.min (int64),必需
min 是范围的起点,该值包含在此范围内。
-
-
supplementalGroups.rule (string)
rule 是一种策略,它将规定 SecurityContext 中使用哪个补充组。
-
-
seLinux (SELinuxStrategyOptions),必需
seLinux 是一种策略,它将规定可以设置的标签集合。
SELinuxStrategyOptions 定义策略类型和用于创建该策略的任意选项。
-
seLinux.rule (string),必需
rule 是一种策略,它将规定可以设置的标签集合。
-
seLinux.seLinuxOptions (SELinuxOptions)
seLinuxOptions 是运行所必需的。对于 mustRunAs 而言是必需的。更多信息: https://kubernetes.io/zh-cn/docs/tasks/configure-pod-container/security-context/
-
seLinux.seLinuxOptions.level (string)
level 是应用到容器的 SELinux 级别标签。
-
seLinux.seLinuxOptions.role (string)
role 是应用到容器的 SELinux 角色标签。
-
seLinux.seLinuxOptions.type (string)
type 是应用到容器的 SELinux 类型标签。
-
seLinux.seLinuxOptions.user (string)
user 是应用到容器的 SELinux 用户标签。
-
-
-
readOnlyRootFilesystem (boolean)
readOnlyRootFilesystem 设为 true 时将强制容器使用只读根文件系统来运行。 如果容器明确请求以非只读根文件系统来运行,则 PSP 应拒绝该 Pod。 如果设置为 false,则如果愿意,容器可以以只读根文件系统来运行,但不是必须使用只读根文件系统。
-
privileged (boolean)
privileged 决定 Pod 是否可以请求以特权模式运行。
-
allowPrivilegeEscalation (boolean)
allowPrivilegeEscalation 决定 Pod 是否可以请求允许提升特权。如果未指定,则默认为 true。
-
defaultAllowPrivilegeEscalation (boolean)
defaultAllowPrivilegeEscalation 控制一个进程是否可以获得比其父进程更多权限的默认设置。
-
allowedCSIDrivers ([]AllowedCSIDriver)
allowedCSIDrivers 是允许使用的内联 CSI 驱动列表,这些驱动必须被显式嵌入到 Pod 规约中。 空值表示任何 CSI 驱动都可以用于内联临时卷。这是一个 beta 字段, 只有 API 服务器启用 CSIInlineVolume 特性门控,才会使用此字段。
AllowedCSIDriver 表示允许使用的单个内联 CSI 驱动。
-
allowedCSIDrivers.name (string),必需
name 是 CSI 驱动的注册名称。
-
-
allowedCapabilities ([]string)
allowedCapabilities 是可以请求添加到容器的权能列表。 这个字段中的权能可以由 Pod 作者自行添加。 你不得同时在 allowedCapabilities 和 requiredDropCapabilities 中列出同一个权能。
-
requiredDropCapabilities ([]string)
requiredDropCapabilities 是将从容器中丢弃的权能。这些权能需要被丢弃,且不能添加。
-
defaultAddCapabilities ([]string)
defaultAddCapabilities 是默认被添加到容器的权能集,除非 Pod 规约特意丢弃该权能。 你不可以同时在 defaultAddCapabilities 和 requiredDropCapabilities 中列出同一个权能。 此处添加的权能是被隐式允许的,不必包括在 allowedCapabilities 列表中。
-
allowedFlexVolumes ([]AllowedFlexVolume)
allowedFlexVolumes 是允许设置的 FlexVolume 卷的列表。 空或 nil 值表示可以使用所有 FlexVolume。 只有在 “volumes” 字段中允许使用 Flexvolume 卷时,此参数才有效。
AllowedFlexVolume 表示允许使用的单个 Flexvolume。
-
allowedFlexVolumes.driver (string),必需
driver 是 FlexVolume 驱动的名称。
-
-
allowedHostPaths ([]AllowedHostPath)
allowedHostPaths 是允许使用的主机路径的列表。空表示可以使用所有主机路径。
allowedHostPath 定义将按 Pod 使用的策略启用的主机卷条件。它要求定义路径前缀。
-
allowedHostPaths.pathPrefix (string)
pathPrefix 是主机卷必须匹配的路径前缀。 此字段不支持
*
。使用主机路径检验路径前缀时,会裁剪掉尾部的斜线。例如:
/foo
将允许/foo
、/foo/
和/foo/bar
。/foo
将不允许/food
或/etc/foo
。
-
allowedHostPaths.readOnly (boolean)
当设置为 true 时,仅当所有与 pathPrefix 匹配的主机卷的卷挂载均为 readOnly 时,才允许使用。
-
-
allowedProcMountTypes ([]string)
AllowedProcMountTypes 是允许使用的 ProcMountType 的列表。 空表或 nil 表示仅可以使用 DefaultProcMountType。 此字段要求启用 ProcMountType 特性门控。
-
allowedUnsafeSysctls ([]string)
allowedUnsafeSysctls 是明确允许的不安全 sysctl 的列表,默认为空。 每个条目要么是一个普通的 sysctl 名称,要么以 “*” 结尾, 在后面这种情况下字符串值被视为所允许的 sysctl 的前缀。 单个
*
意味着允许所有不安全的 sysctl。 Kubelet 必须显式列出所有被允许的、不安全的 sysctl,以防被拒绝。例如
foo/*
允许foo/bar
、foo/baz
等。 例如foo.*
允许foo.bar
、foo.baz
等。
-
forbiddenSysctls ([]string)
forbiddenSysctls 是被明确禁止的 sysctl 的列表,默认为空。 每个条目要么是一个普通的 sysctl 名称,要么以
*
结尾, 以*
结尾的字符串值表示被禁止的 sysctl 的前缀。 单个*
意味着禁止所有 sysctl。例如
foo/*
禁止foo/bar
、foo/baz
等。 例如foo.*
禁止foo.bar
、foo.baz
等。
-
hostIPC (boolean)
hostIPC 决定此策略是否允许在 Pod 规约中使用 hostIPC。
-
hostNetwork (boolean)
hostNetwork 决定此策略是否允许在 Pod 规约中使用 hostNetwork。
-
hostPID (boolean)
hostPID 决定此策略是否允许在 Pod 规约中使用 hostPID。
-
hostPorts ([]HostPortRange)
hostPorts 决定允许暴露哪些主机端口范围。
HostPortRange 定义将按 Pod 使用的策略启用的主机端口范围。它要求同时定义起点和终点。
-
hostPorts.max (int32),必需
max 是范围的终点,该值包含在此范围内。
-
hostPorts.min (int32),必需
min 是范围的起点,该值包含在此范围内。
-
-
runtimeClass (RuntimeClassStrategyOptions)
runtimeClass 是一种策略,它将规定 Pod 所被允许的 RuntimeClass。 如果省略此字段,则 Pod 的 runtimeClassName 将不受限制。 该字段的实施取决于被启用的 RuntimeClass 特性门控。
RuntimeClassStrategyOptions 定义一种策略,它将规定 Pod 所被允许的 RuntimeClass。
-
runtimeClass.allowedRuntimeClassNames ([]string),必需
allowedRuntimeClassNames 是可以在 Pod 中指定的 runtimeClass 名称的列表。
*
值意味着允许任何 runtimeClass 值,并且如果设置了*
,则它必须是唯一的列表项。 空列表要求不能设置 runtimeClassName 字段。 -
runtimeClass.defaultRuntimeClassName (string)
defaultRuntimeClassName 是要在 Pod 中设置的默认 runtimeClassName。 该默认值必须被 allowedRuntimeClassNames 列表所允许。nil 值不会改变 Pod 设置。
-
-
volumes ([]string)
volumes 是所允许的卷插件的列表。空的列表意味着不可以使用卷。要允许所有卷,你可以使用
*
。
PodSecurityPolicyList
PodSecurityPolicyList 是 PodSecurityPolicy 对象的列表。
-
apiVersion: policy/v1beta1
-
kind: PodSecurityPolicyList
-
metadata (ListMeta)
标准的列表元数据。更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
-
items ([]PodSecurityPolicy),必需
items 是 PodSecurityPolicy 对象的列表。
操作
get
读取指定的 PodSecurityPolicy
HTTP 请求
GET /apis/policy/v1beta1/podsecuritypolicies/{name}
参数
-
name (路径参数): string,必需
PodSecurityPolicy 的名称
-
pretty (查询参数): string
响应
200 (PodSecurityPolicy): OK
401: Unauthorized
list
列出或监视 PodSecurityPolicy 类别的对象
HTTP 请求
GET /apis/policy/v1beta1/podsecuritypolicies
参数
-
allowWatchBookmarks (查询参数): boolean
-
continue (查询参数): string
-
fieldSelector (查询参数): string
-
labelSelector (查询参数): string
-
limit (查询参数): integer
-
pretty (查询参数): string
-
resourceVersion (查询参数): string
-
resourceVersionMatch (查询参数): string
-
timeoutSeconds (查询参数): integer
-
watch (查询参数): boolean
响应
200 (PodSecurityPolicyList): OK
401: Unauthorized
create
创建 PodSecurityPolicy
HTTP 请求
POST /apis/policy/v1beta1/podsecuritypolicies
参数
-
body: PodSecurityPolicy,必需
-
dryRun (查询参数): string
-
fieldManager (查询参数): string
-
fieldValidation (查询参数): string
-
pretty (查询参数): string
响应
200 (PodSecurityPolicy): OK
201 (PodSecurityPolicy): Created
202 (PodSecurityPolicy): Accepted
401: Unauthorized
update
替换指定的 PodSecurityPolicy
HTTP 请求
PUT /apis/policy/v1beta1/podsecuritypolicies/{name}
参数
-
name (路径参数): string,必需
PodSecurityPolicy 的名称
-
body: PodSecurityPolicy,必需
-
dryRun (查询参数): string
-
fieldManager (查询参数): string
-
fieldValidation (查询参数): string
-
pretty (查询参数): string
响应
200 (PodSecurityPolicy): OK
201 (PodSecurityPolicy): Created
401: Unauthorized
patch
部分更新指定的 PodSecurityPolicy
HTTP 请求
PATCH /apis/policy/v1beta1/podsecuritypolicies/{name}
参数
-
name (路径参数): string,必需
PodSecurityPolicy 的名称
-
body: Patch,必需
-
dryRun (查询参数): string
-
fieldManager (查询参数): string
-
fieldValidation (查询参数): string
-
force (查询参数): boolean
-
pretty (查询参数): string
响应
200 (PodSecurityPolicy): OK
201 (PodSecurityPolicy): Created
401: Unauthorized
delete
删除 PodSecurityPolicy
HTTP 请求
DELETE /apis/policy/v1beta1/podsecuritypolicies/{name}
参数
-
name (路径参数): string,必需
PodSecurityPolicy 的名称
-
body: DeleteOptions
-
dryRun (查询参数): string
-
gracePeriodSeconds (查询参数): integer
-
pretty (查询参数): string
-
propagationPolicy (查询参数): string
响应
200 (PodSecurityPolicy): OK
202 (PodSecurityPolicy): Accepted
401: Unauthorized
deletecollection
删除 PodSecurityPolicy 的集合
HTTP 请求
DELETE /apis/policy/v1beta1/podsecuritypolicies
参数
-
body: DeleteOptions
-
continue (查询参数): string
-
dryRun (查询参数): string
-
fieldSelector (查询参数): string
-
gracePeriodSeconds (查询参数): integer
-
labelSelector (查询参数): string
-
limit (查询参数): integer
-
pretty (查询参数): string
-
propagationPolicy (查询参数): string
-
resourceVersion (查询参数): string
-
resourceVersionMatch (查询参数): string
-
timeoutSeconds (查询参数): integer
响应
200 (Status): OK
401: Unauthorized