1 - EndpointSlice
apiVersion: discovery.k8s.io/v1
import "k8s.io/api/discovery/v1"
EndpointSlice
EndpointSlice 是实现某 Service 的端点的子集。一个 Service 可以有多个 EndpointSlice 对象与之对应, 必须将所有的 EndpointSlice 拼接起来才能形成一套完整的端点集合。Service 通过标签来选择 EndpointSlice。
-
apiVersion: discovery.k8s.io/v1
-
kind: EndpointSlice
-
metadata (ObjectMeta)
标准的对象元数据。
-
addressType (string), 必需
addressType 指定当前 EndpointSlice 携带的地址类型。一个 EndpointSlice 只能携带同一类型的地址。 EndpointSlice 对象创建完成后不可以再更改 addressType 字段。
目前支持的地址类型为:
- IPv4:表示 IPv4 地址。
- IPv6:表示 IPv6 地址。
- FQDN:表示完全限定域名。
-
endpoints ([]Endpoint), 必需
原子性:合并期间将被替换
endpoints 是当前 EndpointSlice 中一组唯一的端点。每个 EndpointSlice 最多可以包含 1000 个端点。
端点是实现某 Service 的一个逻辑“后端”。
-
endpoints.addresses ([]string), 必需
集合:不重复的值在合并期间会被保留
本端点的地址。此字段的内容会根据对应的 EndpointSlice addressType 字段的值进行解释。 消费者必须根据自身能力处理不同类型的地址。此字段必须至少包含 1 个地址,最多不超过 100 个地址。 假定这些地址都是可替换的,而且客户端也可能选择只用第一个元素。参阅: https://issue.k8s.io/106267
-
endpoints.conditions (EndpointConditions)
conditions 包含和本端点当前状态有关的信息。
EndpointConditions 是端点的当前状况。
-
endpoints.conditions.ready (boolean)
ready 说明此端点已经准备好根据相关的系统映射接收流量。nil 值表示状态未知。 在大多数情况下,消费者应将这种未知状态视为就绪(ready)。 考虑到兼容性,对于正在结束状态下的端点,永远不能将 ready 设置为“true”。
-
endpoints.conditions.serving (boolean)
serving 和 ready 非常相似。唯一的不同在于, 即便某端点的状态为 Terminating 也可以设置 serving。 对于处在终止过程中的就绪端点,此状况应被设置为 “true”。 如果设置为 nil,则消费者应该以 ready 值为准。 可以在 EndpointSliceTerminatingCondition 特性开关中启用此字段。
-
endpoints.conditions.terminating (boolean)
terminating 说明当前端点正在终止过程中。nil 值表示状态未知。 消费者应将这种未知状态视为端点并不处于终止过程中。 可以通过 EndpointSliceTerminatingCondition 特性门控启用此字段。
-
-
endpoints.deprecatedTopology (map[string]string)
deprecatedTopology 包含 v1beta1 API 的拓扑信息部分。目前已经弃用了此字段, 移除 v1beta1 API 时(不早于 Kubernetes v1.24)会一起移除此字段。 此字段目前仍然可以存储值,但是不能通过 v1 API 写入数据。 向此字段写入数据的任何尝试都会被忽略,并且不会通知用户。 移除此字段后,可以在 zone 和 nodeName 字段中查看拓扑信息。
-
endpoints.hints (EndpointHints)
hints 是关于应该如何使用某端点的提示信息。
EndpointHints 提供应该如何使用某端点的提示信息。
-
endpoints.hostname (string)
此端点的主机名称。端点的使用者可以通过此字段区分各个端点(例如,通过 DNS 域名)。 使用同一主机名称的多个端点应被视为可替换(例如,DNS 中的多个 A 记录)。 必须为小写字母,并且需要通过 DNS Label (RFC 1123) 验证。
-
endpoints.nodeName (string)
nodeName 是托管此端点的 Node 的名称,使用 nodeName 可以决定 Node 本地有哪些端点。 可以通过 EndpointSliceNodeName 特性门控启用此字段。
-
endpoints.targetRef (ObjectReference)
targetRef 是对代表此端点的 Kubernetes 对象的引用。
-
endpoints.zone (string)
zone 是此端点所在的可用区(Zone)的名称。
-
-
ports ([]EndpointPort)
原子性:合并期间会被替代
ports 列出了当前 EndpointSlice 中各个端点所暴露的网络端口。每个端口的名称不得重复。 当 ports 列表为空时,表示没有已经指定暴露哪些端口。如果端口值被定义为 nil,表示暴露“所有端口”。 每个 EndpointSlice 最多可以包含 100 个端口。
EndpointPort 是 EndpointSlice 使用的端口。
-
ports.port (int32)
端点的端口号。如果未指定,就不限制端口,且必须根据消费者的具体环境进行解释。
-
ports.protocol (string)
此端口的 IP 协议。必须为 UDP、TCP 或 SCTP。默认为 TCP。
-
ports.name (string)
此端口的名称。EndpointSlice 中所有端口的名称都不得重复。 如果 EndpointSlice 是基于 Kubernetes Service 创建的, 那么此端口的名称和 Service.ports[].name 字段的值一致。默认为空字符串。 名称必须是空字符串,或者必须通过 DNS_LABEL 验证:
- 最多包含 63 个字符。
- 必须包含英文小写字母或'-'。
- 必须以字母开头并以字母结尾。
-
ports.appProtocol (string)
此端口的应用层协议。此字段遵循标准的 Kubernetes Label 句法。 不带前缀的名称是 IANA 标准服务的保留名称(参见 RFC-6335 和 https://www.iana.org/assignments/service-names)。 非标准协议应该使用带前缀的名称,例如 mycompany.com/my-custom-protocol。
-
EndpointSliceList
EndpointSliceList 是 EndpointSlice 的列表。
-
apiVersion: discovery.k8s.io/v1
-
kind: EndpointSliceList
-
metadata (ListMeta)
标准的列表元数据
-
items ([]EndpointSlice), 必需
EndpointSlice 列表
操作
get
读取指定的 EndpointSlice
HTTP 请求
GET /apis/discovery.k8s.io/v1/namespaces/{namespace}/endpointslices/{name}
参数
-
name (路径参数): string, 必需
EndpointSlice 的名称
-
namespace (路径参数): string, 必需
-
pretty (查询参数): string
响应
200 (EndpointSlice): OK
401: Unauthorized
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
-
timeoutSeconds (查询参数): integer
-
watch (查询参数): boolean
响应
200 (EndpointSliceList): OK
401: Unauthorized
list
列举或监测 EndpointSlice 类别的对象
HTTP 请求
GET /apis/discovery.k8s.io/v1/endpointslices
参数
-
allowWatchBookmarks (查询参数): boolean
-
continue (查询参数): string
-
fieldSelector (查询参数): string
-
labelSelector (查询参数): string
- limit (查询参数): integer limit
- pretty (查询参数): string pretty
-
resourceVersion (查询参数): string
-
resourceVersionMatch (查询参数): string
-
timeoutSeconds (查询参数): integer
-
watch (查询参数): boolean
响应
200 (EndpointSliceList): OK
401: Unauthorized
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): Created
202 (EndpointSlice): Accepted
401: Unauthorized
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): Created
401: Unauthorized
patch
部分更新指定的 EndpointSlice
HTTP 请求
PATCH /apis/discovery.k8s.io/v1/namespaces/{namespace}/endpointslices/{name}
参数
-
name (路径参数): string, 必需
EndpointSlice 的名称
-
dryRun (查询参数): string
-
fieldManager (查询参数): string
-
fieldValidation (查询参数): string
-
force (查询参数): boolean
-
pretty (查询参数): string
响应
200 (EndpointSlice): OK
201 (EndpointSlice): Created
401: Unauthorized
delete
删除 EndpointSlice
HTTP 请求
DELETE /apis/discovery.k8s.io/v1/namespaces/{namespace}/endpointslices/{name}
参数
-
name (路径参数): string, 必需
EndpointSlice 的名称
-
namespace (路径参数): string, 必需
-
body: DeleteOptions
-
dryRun (查询参数): string
-
gracePeriodSeconds (查询参数): integer
-
pretty (查询参数): string
-
propagationPolicy (查询参数): string
响应
200 (Status): OK
202 (Status): Accepted
401: Unauthorized
deletecollection
删除 EndpointSlice 的集合
HTTP 请求
DELETE /apis/discovery.k8s.io/v1/namespaces/{namespace}/endpointslices
参数
-
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 - IngressClass
apiVersion: networking.k8s.io/v1
import "k8s.io/api/networking/v1"
IngressClass
IngressClass 代表 Ingress 的类, 被 Ingress 的规约引用。
ingressclass.kubernetes.io/is-default-class
注解可以用来标明一个 IngressClass 应该被视为默认的 Ingress 类。
当某个 IngressClass 资源将此注解设置为 true 时,
没有指定类的新 Ingress 资源将被分配到此默认类。
-
apiVersion: networking.k8s.io/v1
-
kind: IngressClass
-
metadata (ObjectMeta)
标准的列表元数据。 更多信息:https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
-
spec (IngressClassSpec)
spec 是 IngressClass 的期望状态。更多信息:https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
IngressClassSpec
IngressClassSpec 提供有关 Ingress 类的信息。
-
controller (string)
controller 是指应该处理此类的控制器名称。 这允许由同一控制器控制不同“口味”。例如,对于同一个实现的控制器你可能有不同的参数。 此字段应该指定为长度不超过 250 个字符的域前缀路径,例如 “acme.io/ingress-controller”。 该字段是不可变的。
-
parameters (IngressClassParametersReference)
parameters 是指向控制器中包含额外配置的自定义资源的链接。 如果控制器不需要额外的属性,这是可选的。
IngressClassParametersReference 标识一个 API 对象。这可以用来指定一个集群或者命名空间范围的资源
-
parameters.kind (string),必需
kind 是被引用资源的类型。
-
parameters.name (string),必需
name 是被引用资源的名称。
-
parameters.apiGroup (string)
apiGroup 是被引用资源的组。 如果未指定 apiGroup,则被指定的 kind 必须在核心 API 组中。 对于任何其他第三方类型, APIGroup 是必需的。
-
parameters.namespace (string)
namespace 是被引用资源的命名空间。当范围被设置为 “namespace” 时,此字段是必需的,当范围被设置为 “Cluster”,此字段必须取消设置。
-
parameters.scope (string)
scope 表示是否引用集群或者命名空间范围的资源。 这可以设置为“集群”(默认)或者“命名空间”。
-
IngressClassList
IngressClassList 是 IngressClasses 的集合。
-
apiVersion: networking.k8s.io/v1
-
kind: IngressClassList
-
metadata (ListMeta)
标准的列表元数据。
-
items ([]IngressClass),必需
items 是 IngressClasses 的列表
操作
get
读取指定的 IngressClass
HTTP 请求
GET /apis/networking.k8s.io/v1/ingressclasses/{name}
参数
-
name (路径参数):string,必需
IngressClass 的名称
-
pretty (查询参数):string
响应
200 (IngressClass): OK
401: Unauthorized
list
列出或监视 IngressClass 类型的对象
HTTP 请求
GET /apis/networking.k8s.io/v1/ingressclasses
参数
-
allowWatchBookmarks (查询参数):boolean
-
continue (查询参数):string
-
fieldSelector (查询参数):string
-
labelSelector (查询参数):string
-
limit (查询参数):integer
-
pretty (查询参数):string
-
resourceVersion (查询参数):string
-
resourceVersionMatch (查询参数):string
-
timeoutSeconds (查询参数):integer
-
watch (查询参数):boolean
响应
200 (IngressClassList): OK
401: Unauthorized
create
创建一个 IngressClass
HTTP 请求
POST /apis/networking.k8s.io/v1/ingressclasses
参数
- body: IngressClass,必需
-
dryRun (查询参数):string
-
fieldManager (查询参数):string
-
fieldValidation (查询参数):string
-
pretty (查询参数):string
响应
200 (IngressClass): OK
201 (IngressClass): Created
202 (IngressClass): Accepted
401: Unauthorized
update
替换指定的 IngressClass
HTTP 请求
PUT /apis/networking.k8s.io/v1/ingressclasses/{name}
参数
-
name (路径参数):string,必需
IngressClass 的名称
- body: IngressClass,必需
-
dryRun (查询参数):string
-
fieldManager (查询参数):string
-
fieldValidation (查询参数):string
-
pretty (查询参数):string
响应
200 (IngressClass): OK
201 (IngressClass): Created
401: Unauthorized
patch
部分更新指定的 IngressClass
HTTP 请求
PATCH /apis/networking.k8s.io/v1/ingressclasses/{name}
参数
-
name (路径参数):string,必需
IngressClass 的名称
- body: Patch,必需
-
dryRun (查询参数):string
-
fieldManager (查询参数):string
-
fieldValidation (查询参数):string
-
force (查询参数):boolean
-
pretty (查询参数):string
响应
200 (IngressClass): OK
201 (IngressClass): Created
401: Unauthorized
delete
删除一个 IngressClass
HTTP 请求
DELETE /apis/networking.k8s.io/v1/ingressclasses/{name}
参数
-
name (路径参数):string,必需
IngressClass 的名称
-
body: DeleteOptions
-
dryRun (查询参数):string
-
gracePeriodSeconds (查询字符串):integer
-
pretty (查询参数):string
-
propagationPolicy (查询参数):string
响应
200 (Status): OK
202 (Status): Accepted
401: Unauthorized
deletecollection
删除 IngressClass 的集合
DELETE /apis/networking.k8s.io/v1/ingressclasses
参数
- 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