Information in this document may be out of date
This document has an older update date than the original, so the information it contains may be out of date. If you're able to read English, see the English version for the most up-to-date information: Endpoints
Endpoints
apiVersion: v1
import "k8s.io/api/core/v1"
Endpoints
Endpoints 是实现实际服务的端点的集合。举例:
Name: "mysvc",
Subsets: [
{
Addresses: [{"ip": "10.10.1.1"}, {"ip": "10.10.2.2"}],
Ports: [{"name": "a", "port": 8675}, {"name": "b", "port": 309}]
},
{
Addresses: [{"ip": "10.10.3.3"}],
Ports: [{"name": "a", "port": 93}, {"name": "b", "port": 76}]
},
]
-
apiVersion: v1
-
kind: Endpoints
-
metadata (ObjectMeta)
标准的对象元数据。更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
-
subsets ([]EndpointSubset)
所有端点的集合是所有 subsets 的并集。不同地址会根据其 IP 地址被放入不同子集。 对于具有多个端口的单个地址,如果其中一些端口已就绪,而另一些端口未就绪(因为它们来自不同的容器), 将导致地址显示在不同端口的不同子集中。 任何地址都不可以同时出现在 addresses 和 notReadyAddress 中的相同子集内。
EndpointSubset 是一组具有公共端口集的地址。扩展的端点集是 addresses 和 ports 的笛卡尔乘积。例如假设:
{ Addresses: [{"ip": "10.10.1.1"}, {"ip": "10.10.2.2"}], Ports: [{"name": "a", "port": 8675}, {"name": "b", "port": 309}] }
则最终的端点集可以看作:
a: [ 10.10.1.1:8675, 10.10.2.2:8675 ], b: [ 10.10.1.1:309, 10.10.2.2:309 ]*
-
subsets.addresses ([]EndpointAddress)
提供标记为就绪的相关端口的 IP 地址。 这些端点应该被认为是负载均衡器和客户端可以安全使用的。
EndpointAddress 是描述单个 IP 地址的元组。
-
subsets.addresses.ip (string), 必需
端点的 IP。不可以是本地回路(127.0.0.0/8 或 ::1)、 链路本地(169.254.0.0/16 或 fe80::/10)或链路本地多播(224.0.0.0/24 或 ff02::/16))地址。
-
subsets.addresses.hostname (string)
端点主机名称。
-
subsets.addresses.nodeName (string)
可选:承载此端点的节点。此字段可用于确定一个节点的本地端点。
-
subsets.addresses.targetRef (ObjectReference)
对提供端点的对象的引用。
-
-
subsets.notReadyAddresses ([]EndpointAddress)
提供相关端口但由于尚未完成启动、最近未通过就绪态检查或最近未通过活跃性检查而被标记为当前未就绪的 IP 地址。 EndpointAddress 是描述单个 IP 地址的元组。
-
subsets.notReadyAddresses.ip (string), 必需
端点的 IP。不可以是本地环路(127.0.0.0/8 或 ::1)、 链路本地(169.254.0.0/16 或 fe80::/10)或链路本地多播(224.0.0.0/24 或 ff02::/16)地址。
-
subsets.notReadyAddresses.hostname (string)
端点主机名称。
-
subsets.notReadyAddresses.nodeName (string)
可选:承载此端点的节点。此字段可用于确定节点的本地端点。
-
subsets.notReadyAddresses.targetRef (ObjectReference)
对提供端点的对象的引用。
-
-
subsets.ports ([]EndpointPort)
相关 IP 地址上可用的端口号。
-
subsets.ports.port (int32), 必需
端点的端口号。
-
subsets.ports.protocol (string)
此端口的 IP 协议。必须是 UDP、TCP 或 SCTP。默认值为 TCP。
-
subsets.ports.name (string)
端口的名称。此字段必须与相应 ServicePort 中的
name
字段匹配。必须是 DNS_LABEL。 仅当定义了一个端口时才可选。 -
subsets.ports.appProtocol (string)
端口的应用程序协议。这被用作实现的提示,为他们理解的协议提供更丰富的行为。 此字段遵循标准的 Kubernetes 标签语法。有效值为:
-
未加前缀的名称保留给 IANA 标准服务名称(遵循 RFC-6335 和 https://www.iana.org/assignments/service-names)。
-
Kubernetes 定义的前缀名称
- 'kubernetes.io/h2c' - HTTP/2 明文,如 https://www.rfc-editor.org/rfc/rfc7540 中所述
-
其他协议应使用实现定义的前缀名称,如 mycompany.com/my-custom-protocol。
-
-
-
EndpointsList
EndpointsList 是端点列表。
-
apiVersion: v1
-
kind: EndpointsList
-
metadata (ListMeta)
标准的列表元数据。更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
-
items ([]Endpoints), 必需
端点列表。
操作
get
读取指定的 Endpoints
HTTP 请求
GET /api/v1/namespaces/{namespace}/endpoints/{name}
参数
-
name (路径参数):string,必需
Endpoints 的名称。
-
namespace (路径参数):string,必需
-
pretty (查询参数):string
响应
200 (Endpoints): OK
401: Unauthorized
list
列出或监测 Endpoints 类型的对象
HTTP 请求
GET /api/v1/namespaces/{namespace}/endpoints
参数
-
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 (EndpointsList): OK
401: Unauthorized
list
列出或监测 Endpoints 类型的对象
HTTP 请求
GET /api/v1/endpoints
参数
-
allowWatchBookmarks (查询参数):boolean
-
continue (查询参数):string
-
fieldSelector (查询参数):string
-
labelSelector (查询参数):string
-
resourceVersion (查询参数):string
-
resourceVersionMatch (查询参数):string
-
sendInitialEvents (查询参数): boolean
-
timeoutSeconds (查询参数):integer
-
watch (查询参数):boolean
响应
200 (EndpointsList): OK
401: Unauthorized
create
创建 Endpoints
HTTP 请求
POST /api/v1/namespaces/{namespace}/endpoints
参数
-
dryRun (查询参数):string
-
fieldManager (查询参数):string
-
fieldValidation (查询参数):string
-
pretty (查询参数):string
响应
200 (Endpoints): OK
201 (Endpoints): Created
202 (Endpoints): Accepted
401: Unauthorized
update
替换指定的 Endpoints
HTTP 请求
PUT /api/v1/namespaces/{namespace}/endpoints/{name}
参数
-
name (路径参数):string,必需
Endpoints 名称
-
dryRun (查询参数):string
-
fieldManager (查询参数):string
-
fieldValidation (查询参数):string
-
pretty (查询参数):string
响应
200 (Endpoints): OK
201 (Endpoints): Created
401: Unauthorized
patch
部分更新指定的 Endpoints
HTTP 请求
PATCH /api/v1/namespaces/{namespace}/endpoints/{name}
参数
-
name (路径参数):string,必需
Endpoints 名称
-
dryRun (查询参数):string
-
fieldManager (查询参数):string
-
fieldValidation (查询参数):string
-
force (查询参数):boolean
-
pretty (查询参数):string
响应
200 (Endpoints): OK
201 (Endpoints): Created
401: Unauthorized
delete
删除 Endpoints
HTTP 请求
DELETE /api/v1/namespaces/{namespace}/endpoints/{name}
参数
-
name (路径参数):string,必需
Endpoints 名称
-
namespace (路径参数):string,必需
-
body: DeleteOptions
-
dryRun (查询参数):string
-
gracePeriodSeconds (查询参数):integer
-
pretty (查询参数):string
-
propagationPolicy (查询参数):string
响应
200 (Status): OK
202 (Status): Accepted
401: Unauthorized
deletecollection
删除 Endpoints 组
HTTP 请求
DELETE /api/v1/namespaces/{namespace}/endpoints
参数
-
namespace (路径参数):string,必需
-
body: DeleteOptions
-
continue (查询参数):string
-
dryRun (查询参数):string
-
fieldSelector (查询参数):string
-
gracePeriodSeconds (查询参数):integer
-
labelSelector (查询参数):string
-
limit (查询参数):integer
-
pretty (查询参数):string
-
propagationPolicy (查询参数):string
-
resourceVersion (查询参数):string
-
resourceVersionMatch (查询参数):string
-
sendInitialEvents (查询参数): boolean
-
timeoutSeconds (查询参数):integer
响应
200 (Status): OK
401: Unauthorized