EndpointSlice
apiVersion: discovery.k8s.io/v1
import "k8s.io/api/discovery/v1"
EndpointSlice
EndpointSlice 表示一组服务端点。大多数 EndpointSlice 由 EndpointSlice 控制器创建,以表示被 Service 对象选中的 Pod。对于一个给定的服务,可能会有多个 EndpointSlice 对象,这些对象必须组合在一起才能生成完整的端点集;你可以通过列出服务命名空间中 kubernetes.io/service-name
标签包含服务名称的 EndpointSlice 来找到给定服务的所有切片。
apiVersion: discovery.k8s.io/v1
kind: EndpointSlice
metadata (ObjectMeta)
标准对象的元数据。
addressType (string),必填
addressType 指定此 EndpointSlice 所携带的地址类型。此切片中的所有地址必须是相同类型。此字段在创建后不可变。目前支持以下地址类型:* IPv4:表示 IPv4 地址。* IPv6:表示 IPv6 地址。* FQDN:表示完全限定域名。(已弃用) EndpointSlice 控制器只生成,并且 kube-proxy 只处理地址类型为“IPv4”和“IPv6”的切片。“FQDN”类型没有定义任何语义。
endpoints ([]Endpoint),必填
原子性:在合并期间将被替换
endpoints 是此切片中唯一端点的列表。每个切片最多可包含 1000 个端点。
endpoints.addresses ([]string),必填
集合:合并时将保留唯一值
此端点的地址。对于 addressType 为“IPv4”或“IPv6”的 EndpointSlice,值是规范形式的 IP 地址。其他 addressType 值的语法和语义未定义。此字段必须包含至少一个地址,但不能超过 100 个。EndpointSlice 控制器生成的 EndpointSlice 始终只有一个地址。对于第一个地址之外的附加地址未定义任何语义,并且 kube-proxy 不会查看它们。
endpoints.conditions (EndpointConditions)
conditions 包含有关端点当前状态的信息。
endpoints.conditions.ready (boolean)
ready 表示此端点已准备好接收流量,具体取决于管理此端点的系统。nil 值应解释为“true”。通常,如果端点正在提供服务且未终止,则应将其标记为就绪,尽管在某些情况下可以覆盖此行为,例如当关联的服务设置了 publishNotReadyAddresses 标志时。
endpoints.conditions.serving (boolean)
serving 表示此端点能够接收流量,具体取决于管理此端点的系统。对于由 Pod 支持的端点,如果 Pod 的 Ready 状况为 True,EndpointSlice 控制器将把该端点标记为 serving。nil 值应解释为“true”。
endpoints.conditions.terminating (boolean)
terminating 表示此端点正在终止。nil 值应解释为“false”。
endpoints.deprecatedTopology (map[string]string)
deprecatedTopology 包含 v1beta1 API 中的拓扑信息。此字段已弃用,并将在 v1beta1 API 删除时(不早于 kubernetes v1.24)删除。虽然此字段可以保存值,但无法通过 v1 API 写入,并且任何写入尝试都将被静默忽略。拓扑信息可以在 zone 和 nodeName 字段中找到。
endpoints.hints (EndpointHints)
hints 包含与端点应如何使用相关的信息。
endpoints.hints.forNodes ([]ForNode)
原子性:在合并期间将被替换
forNodes 指示在使用拓扑感知路由时应由哪些节点使用此端点。最多可包含 8 个条目。这是一个 Alpha 功能,仅在启用 PreferSameTrafficDistribution 功能门时使用。
endpoints.hints.forNodes.name (string),必填
name 表示节点的名称。
endpoints.hints.forZones ([]ForZone)
原子性:在合并期间将被替换
forZones 指示在使用拓扑感知路由时应由哪些区域使用此端点。最多可包含 8 个条目。
endpoints.hints.forZones.name (string),必填
name 表示区域的名称。
endpoints.hostname (string)
此端点的主机名。端点使用者可以使用此字段来区分端点(例如在 DNS 名称中)。使用相同主机名的多个端点应被视为可互换(例如 DNS 中的多个 A 记录)。必须是小写并符合 DNS Label (RFC 1123) 验证。
endpoints.nodeName (string)
nodeName 表示托管此端点的节点的名称。这可用于确定节点本地的端点。
endpoints.targetRef (ObjectReference)
targetRef 是对此端点所代表的 Kubernetes 对象的引用。
endpoints.zone (string)
zone 是此端点所在的区域名称。
ports ([]EndpointPort)
原子性:在合并期间将被替换
ports 指定此切片中每个端点暴露的网络端口列表。每个端口必须具有唯一名称。每个切片最多可包含 100 个端口。服务始终至少有 1 个端口,因此由 EndpointSlice 控制器生成的 EndpointSlice 也始终至少有 1 个端口。用于其他目的的 EndpointSlice 可以有一个空的端口列表。
EndpointPort 表示由 EndpointSlice 使用的端口。
ports.port (int32)
port 表示端点的端口号。如果 EndpointSlice 派生自 Kubernetes 服务,则此值必须设置为服务的 target port。用于其他目的的 EndpointSlice 可以有一个 nil 端口。
ports.protocol (string)
protocol 表示此端口的 IP 协议。必须是 UDP、TCP 或 SCTP。默认为 TCP。
ports.name (string)
name 表示此端口的名称。EndpointSlice 中的所有端口必须具有唯一名称。如果 EndpointSlice 派生自 Kubernetes 服务,则此名称对应于 Service.ports[].name。名称必须为空字符串或通过 DNS_LABEL 验证:* 最多 63 个字符。* 必须由小写字母数字字符或“-”组成。* 必须以字母数字字符开头和结尾。默认为空字符串。
ports.appProtocol (string)
此端口的应用协议。这用作实现的提示,以便为它们理解的协议提供更丰富的行为。此字段遵循标准 Kubernetes 标签语法。有效值可以是
无前缀协议名称 - 保留用于 IANA 标准服务名称(根据 RFC-6335 和 https://www.iana.org/assignments/service-names))。
Kubernetes 定义的带前缀名称
- 'kubernetes.io/h2c' - 根据 https://www.rfc-editor.org/rfc/rfc9113.html#name-starting-http-2-with-prior- 所述,通过明文进行的 HTTP/2 预知。
- 'kubernetes.io/ws' - 根据 https://www.rfc-editor.org/rfc/rfc6455 所述,通过明文进行的 WebSocket。
- 'kubernetes.io/wss' - 根据 https://www.rfc-editor.org/rfc/rfc6455 所述,通过 TLS 进行的 WebSocket。
其他协议应使用实现定义的带前缀名称,例如 mycompany.com/my-custom-protocol。
EndpointSliceList
EndpointSliceList 表示端点切片列表
apiVersion: discovery.k8s.io/v1
kind: EndpointSliceList
metadata (ListMeta)
标准列表元数据。
items ([]EndpointSlice),必填
items 是端点切片列表
操作
get
读取指定的 EndpointSlice
HTTP 请求
GET /apis/discovery.k8s.io/v1/namespaces/{namespace}/endpointslices/{name}
参数
响应
200 (EndpointSlice): OK
401: 未授权
list
列出或监视 EndpointSlice 类型的对象
HTTP 请求
GET /apis/discovery.k8s.io/v1/namespaces/{namespace}/endpointslices
参数
namespace (在路径中): string,必填
allowWatchBookmarks (在查询中): boolean
continue (在查询中): string
fieldSelector (在查询中): string
labelSelector (在查询中): string
limit (在查询中): integer
pretty (在查询中): string
resourceVersion (在查询中): string
resourceVersionMatch (在查询中): string
sendInitialEvents (在查询中): boolean
timeoutSeconds (在查询中): integer
watch (在查询中): boolean
响应
200 (EndpointSliceList): OK
401: 未授权
list
列出或监视 EndpointSlice 类型的对象
HTTP 请求
GET /apis/discovery.k8s.io/v1/endpointslices
参数
allowWatchBookmarks (在查询中): boolean
continue (在查询中): string
fieldSelector (在查询中): string
labelSelector (在查询中): string
limit (在查询中): integer
pretty (在查询中): string
resourceVersion (在查询中): string
resourceVersionMatch (在查询中): string
sendInitialEvents (在查询中): boolean
timeoutSeconds (在查询中): integer
watch (在查询中): boolean
响应
200 (EndpointSliceList): OK
401: 未授权
create
创建一个 EndpointSlice
HTTP 请求
POST /apis/discovery.k8s.io/v1/namespaces/{namespace}/endpointslices
参数
namespace (在路径中): string,必填
body: EndpointSlice,必填
dryRun (在查询中): string
fieldManager (在查询中): string
fieldValidation (在查询中): string
pretty (在查询中): string
响应
200 (EndpointSlice): OK
201 (EndpointSlice): 已创建
202 (EndpointSlice): 已接受
401: 未授权
update
替换指定的 EndpointSlice
HTTP 请求
PUT /apis/discovery.k8s.io/v1/namespaces/{namespace}/endpointslices/{name}
参数
name (在路径中): string,必填
EndpointSlice 的名称
namespace (在路径中): string,必填
body: EndpointSlice,必填
dryRun (在查询中): string
fieldManager (在查询中): string
fieldValidation (在查询中): string
pretty (在查询中): string
响应
200 (EndpointSlice): OK
201 (EndpointSlice): 已创建
401: 未授权
patch
部分更新指定的 EndpointSlice
HTTP 请求
PATCH /apis/discovery.k8s.io/v1/namespaces/{namespace}/endpointslices/{name}
参数
name (在路径中): string,必填
EndpointSlice 的名称
namespace (在路径中): string,必填
body: Patch,必需
dryRun (在查询中): string
fieldManager (在查询中): string
fieldValidation (在查询中): string
force (在查询中): boolean
pretty (在查询中): string
响应
200 (EndpointSlice): OK
201 (EndpointSlice): 已创建
401: 未授权
delete
删除一个 EndpointSlice
HTTP 请求
DELETE /apis/discovery.k8s.io/v1/namespaces/{namespace}/endpointslices/{name}
参数
name (在路径中): string,必填
EndpointSlice 的名称
namespace (在路径中): string,必填
body: DeleteOptions
dryRun (在查询中): string
gracePeriodSeconds (在查询中): integer
ignoreStoreReadErrorWithClusterBreakingPotential (在查询中): boolean
pretty (在查询中): string
propagationPolicy (在查询中): string
响应
200 (Status): OK
202 (Status): 已接受
401: 未授权
deletecollection
删除 EndpointSlice 集合
HTTP 请求
DELETE /apis/discovery.k8s.io/v1/namespaces/{namespace}/endpointslices
参数
namespace (在路径中): string,必填
body: DeleteOptions
continue (在查询中): string
dryRun (在查询中): string
fieldSelector (在查询中): string
gracePeriodSeconds (在查询中): integer
ignoreStoreReadErrorWithClusterBreakingPotential (在查询中): boolean
labelSelector (在查询中): string
limit (在查询中): integer
pretty (在查询中): string
propagationPolicy (在查询中): string
resourceVersion (在查询中): string
resourceVersionMatch (在查询中): string
sendInitialEvents (在查询中): boolean
timeoutSeconds (在查询中): integer
响应
200 (Status): OK
401: 未授权
本页面是自动生成的。
如果你打算报告此页面存在的问题,请在问题描述中提及此页面是自动生成的。修复可能需要在 Kubernetes 项目的其他地方进行。