Merge pull request #48301 from windsonsea/serv1
[zh] update service-resources/service-v1.mdpull/48302/head
commit
f39d8cad93
|
@ -8,7 +8,6 @@ description: "Service 是软件服务(例如 mysql)的命名抽象,包含
|
|||
title: Service
|
||||
weight: 1
|
||||
---
|
||||
|
||||
<!--
|
||||
api_metadata:
|
||||
apiVersion: "v1"
|
||||
|
@ -26,10 +25,10 @@ auto_generated: true
|
|||
`import "k8s.io/api/core/v1”`
|
||||
|
||||
## Service {#Service}
|
||||
|
||||
<!--
|
||||
Service is a named abstraction of software service (for example, mysql) consisting of local port (for example 3306) that the proxy listens on, and the selector that determines which pods will answer requests sent through the proxy.
|
||||
-->
|
||||
|
||||
Service 是软件服务(例如 mysql)的命名抽象,包含代理要侦听的本地端口(例如 3306)和一个选择算符,
|
||||
选择算符用来确定哪些 Pod 将响应通过代理发送的请求。
|
||||
|
||||
|
@ -45,8 +44,8 @@ Service 是软件服务(例如 mysql)的命名抽象,包含代理要侦听
|
|||
Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
-->
|
||||
|
||||
标准的对象元数据。
|
||||
更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
标准的对象元数据。更多信息:
|
||||
https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
|
||||
- **spec** (<a href="{{< ref "../service-resources/service-v1#ServiceSpec" >}}">ServiceSpec</a>)
|
||||
|
||||
|
@ -63,8 +62,8 @@ Service 是软件服务(例如 mysql)的命名抽象,包含代理要侦听
|
|||
Most recently observed status of the service. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||
-->
|
||||
|
||||
最近观察到的 Service 状态。由系统填充。只读。
|
||||
更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||
最近观察到的 Service 状态。由系统填充。只读。更多信息:
|
||||
https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||
|
||||
## ServiceSpec {#ServiceSpec}
|
||||
|
||||
|
@ -83,8 +82,8 @@ ServiceSpec 描述用户在服务上创建的属性。
|
|||
|
||||
将 Service 流量路由到具有与此 selector 匹配的标签键值对的 Pod。
|
||||
如果为空或不存在,则假定该服务有一个外部进程管理其端点,Kubernetes 不会修改该端点。
|
||||
仅适用于 ClusterIP、NodePort 和 LoadBalancer 类型。如果类型为 ExternalName,则忽略。
|
||||
更多信息: https://kubernetes.io/docs/concepts/services-networking/service/
|
||||
仅适用于 ClusterIP、NodePort 和 LoadBalancer 类型。如果类型为 ExternalName,则忽略。更多信息:
|
||||
https://kubernetes.io/zh-cn/docs/concepts/services-networking/service/
|
||||
|
||||
- **ports** ([]ServicePort)
|
||||
|
||||
|
@ -99,12 +98,12 @@ ServiceSpec 描述用户在服务上创建的属性。
|
|||
*ServicePort contains information on service's port.*
|
||||
-->
|
||||
|
||||
**Patch strategy:基于键 `type` 合并**
|
||||
**补丁策略:基于键 `type` 合并**
|
||||
|
||||
**Map:合并时将保留 type 键的唯一值**
|
||||
|
||||
此 Service 公开的端口列表。
|
||||
更多信息: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies
|
||||
此 Service 公开的端口列表。更多信息:
|
||||
https://kubernetes.io/zh-cn/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies
|
||||
|
||||
<a name="ServicePort"></a>
|
||||
**ServicePort 包含有关 ServicePort 的信息。**
|
||||
|
@ -135,8 +134,8 @@ ServiceSpec 描述用户在服务上创建的属性。
|
|||
如果此值是一个字符串,将在目标 Pod 的容器端口中作为命名端口进行查找。
|
||||
如果未指定字段,则使用 `port` 字段的值(直接映射)。
|
||||
对于 clusterIP 为 None 的服务,此字段将被忽略,
|
||||
应忽略不设或设置为 `port` 字段的取值。
|
||||
更多信息: https://kubernetes.io/docs/concepts/services-networking/service/#defining-a-service
|
||||
应忽略不设或设置为 `port` 字段的取值。更多信息:
|
||||
https://kubernetes.io/zh-cn/docs/concepts/services-networking/service/#defining-a-service
|
||||
|
||||
<a name="IntOrString"></a>
|
||||
**IntOrString 是一种可以保存 int32 或字符串的类型。
|
||||
|
@ -172,8 +171,8 @@ ServiceSpec 描述用户在服务上创建的属性。
|
|||
通常由系统分配。如果指定了一个在范围内且未使用的值,则将使用该值,否则操作将失败。
|
||||
如果在创建的 Service 需要该端口时未指定该字段,则会分配端口。
|
||||
如果在创建不需要该端口的 Service时指定了该字段,则会创建失败。
|
||||
当更新 Service 时,如果不再需要此字段(例如,将类型从 NodePort 更改为 ClusterIP),这个字段将被擦除。
|
||||
更多信息: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport
|
||||
当更新 Service 时,如果不再需要此字段(例如,将类型从 NodePort 更改为 ClusterIP),这个字段将被擦除。更多信息:
|
||||
https://kubernetes.io/zh-cn/docs/concepts/services-networking/service/#type-nodeport
|
||||
|
||||
- **ports.appProtocol** (string)
|
||||
|
||||
|
@ -182,6 +181,7 @@ ServiceSpec 描述用户在服务上创建的属性。
|
|||
richer behavior for protocols that they understand. This field follows standard Kubernetes label syntax.
|
||||
Valid values are either:
|
||||
-->
|
||||
|
||||
此端口的应用协议,用作实现的提示,为他们理解的协议提供更丰富的行为。此字段遵循标准
|
||||
Kubernetes 标签语法,有效值包括:
|
||||
|
||||
|
@ -219,8 +219,8 @@ ServiceSpec 描述用户在服务上创建的属性。
|
|||
如果 clusterIP 为 `None`,则不分配虚拟 IP,并且 Endpoints 作为一组端点而不是虚拟 IP 发布。
|
||||
`NodePort` 建立在 ClusterIP 之上,并在每个节点上分配一个端口,该端口路由到与 clusterIP 相同的 Endpoints。
|
||||
`LoadBalancer` 基于 NodePort 构建并创建一个外部负载均衡器(如果当前云支持),该负载均衡器路由到与 clusterIP 相同的 Endpoints。
|
||||
`externalName` 将此 Service 别名为指定的 externalName。其他几个字段不适用于 ExternalName Service。
|
||||
更多信息: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types
|
||||
`externalName` 将此 Service 别名为指定的 externalName。其他几个字段不适用于 ExternalName Service。更多信息:
|
||||
https://kubernetes.io/zh-cn/docs/concepts/services-networking/service/#publishing-services-service-types
|
||||
|
||||
- **ipFamilies** ([]string)
|
||||
|
||||
|
@ -278,14 +278,15 @@ ServiceSpec 描述用户在服务上创建的属性。
|
|||
clusterIP 为 “None” 时会生成“无头服务”(无虚拟 IP),这在首选直接 Endpoint 连接且不需要代理时很有用。
|
||||
仅适用于 ClusterIP、NodePort、和 LoadBalancer 类型的服务。
|
||||
如果在创建 ExternalName 类型的 Service 时指定了 clusterIP,则创建将失败。
|
||||
更新 Service type 为 ExternalName 时,clusterIP 会被移除。
|
||||
更多信息: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies
|
||||
更新 Service type 为 ExternalName 时,clusterIP 会被移除。更多信息:
|
||||
https://kubernetes.io/zh-cn/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies
|
||||
|
||||
- **clusterIPs** ([]string)
|
||||
|
||||
<!--
|
||||
*Atomic: will be replaced during a merge*
|
||||
-->
|
||||
|
||||
**原子: 将在合并期间被替换**
|
||||
|
||||
<!--
|
||||
|
@ -309,8 +310,8 @@ ServiceSpec 描述用户在服务上创建的属性。
|
|||
|
||||
clusterIPs 最多可包含两个条目(双栈系列,按任意顺序)。
|
||||
这些 IP 必须与 ipFamilies 的值相对应。
|
||||
clusterIP 和 ipFamilies 都由 ipFamilyPolicy 管理。
|
||||
更多信息: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies
|
||||
clusterIP 和 ipFamilies 都由 ipFamilyPolicy 管理。更多信息:
|
||||
https://kubernetes.io/zh-cn/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies
|
||||
|
||||
- **externalIPs** ([]string)
|
||||
|
||||
|
@ -333,14 +334,15 @@ ServiceSpec 描述用户在服务上创建的属性。
|
|||
-->
|
||||
|
||||
支持 “ClientIP” 和 “None”。用于维护会话亲和性。
|
||||
启用基于客户端 IP 的会话亲和性。必须是 ClientIP 或 None。默认为 None。
|
||||
更多信息: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies
|
||||
启用基于客户端 IP 的会话亲和性。必须是 ClientIP 或 None。默认为 None。更多信息:
|
||||
https://kubernetes.io/zh-cn/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies
|
||||
|
||||
- **loadBalancerIP** (string)
|
||||
|
||||
<!--
|
||||
Only applies to Service Type: LoadBalancer. This feature depends on whether the underlying cloud-provider supports specifying the loadBalancerIP when a load balancer is created. This field will be ignored if the cloud-provider does not support the feature. Deprecated: This field was under-specified and its meaning varies across implementations. Using it is non-portable and it may not support dual-stack. Users are encouraged to use implementation-specific annotations when available.
|
||||
-->
|
||||
|
||||
仅适用于服务类型:LoadBalancer。此功能取决于底层云提供商是否支持负载均衡器。
|
||||
如果云提供商不支持该功能,该字段将被忽略。
|
||||
已弃用:该字段信息不足,且其含义因实现而异。此字段是不可移植的,并且可能不支持双栈。。
|
||||
|
@ -357,8 +359,8 @@ ServiceSpec 描述用户在服务上创建的属性。
|
|||
**原子:将在合并期间被替换**
|
||||
|
||||
如果设置了此字段并且被平台支持,将限制通过云厂商的负载均衡器的流量到指定的客户端 IP。
|
||||
如果云提供商不支持该功能,该字段将被忽略。
|
||||
更多信息: https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/
|
||||
如果云提供商不支持该功能,该字段将被忽略。更多信息:
|
||||
https://kubernetes.io/zh-cn/docs/tasks/access-application-cluster/create-external-load-balancer/
|
||||
|
||||
- **loadBalancerClass** (string)
|
||||
|
||||
|
@ -390,6 +392,7 @@ ServiceSpec 描述用户在服务上创建的属性。
|
|||
<!--
|
||||
externalTrafficPolicy describes how nodes distribute service traffic they receive on one of the Service's "externally-facing" addresses (NodePorts, ExternalIPs, and LoadBalancer IPs). If set to "Local", the proxy will configure the service in a way that assumes that external load balancers will take care of balancing the service traffic between nodes, and so each node will deliver traffic only to the node-local endpoints of the service, without masquerading the client source IP. (Traffic mistakenly sent to a node with no endpoints will be dropped.) The default value, "Cluster", uses the standard behavior of routing to all endpoints evenly (possibly modified by topology and other features). Note that traffic sent to an External IP or LoadBalancer IP from within the cluster will always get "Cluster" semantics, but clients sending to a NodePort from within the cluster may need to take traffic policy into account when picking a node.
|
||||
-->
|
||||
|
||||
externalTrafficPolicy 描述了节点如何分发它们在 Service 的“外部访问”地址
|
||||
(NodePort、ExternalIP 和 LoadBalancer IP)接收到的服务流量。
|
||||
如果设置为 “Local”,代理将以一种假设外部负载均衡器将负责在节点之间服务流量负载均衡,
|
||||
|
@ -404,7 +407,8 @@ ServiceSpec 描述用户在服务上创建的属性。
|
|||
<!--
|
||||
InternalTrafficPolicy describes how nodes distribute service traffic they receive on the ClusterIP. If set to "Local", the proxy will assume that pods only want to talk to endpoints of the service on the same node as the pod, dropping the traffic if there are no local endpoints. The default value, "Cluster", uses the standard behavior of routing to all endpoints evenly (possibly modified by topology and other features).
|
||||
-->
|
||||
InternalTrafficPolicy 描述节点如何分发它们在 ClusterIP 上接收到的服务流量。
|
||||
|
||||
internalTrafficPolicy 描述节点如何分发它们在 ClusterIP 上接收到的服务流量。
|
||||
如果设置为 “Local”,代理将假定 Pod 只想与在同一节点上的服务端点通信,如果没有本地端点,它将丢弃流量。
|
||||
“Cluster” 默认将流量路由到所有端点(可能会根据拓扑和其他特性进行修改)。
|
||||
|
||||
|
@ -413,6 +417,7 @@ ServiceSpec 描述用户在服务上创建的属性。
|
|||
<!--
|
||||
healthCheckNodePort specifies the healthcheck nodePort for the service. This only applies when type is set to LoadBalancer and externalTrafficPolicy is set to Local. If a value is specified, is in-range, and is not in use, it will be used. If not specified, a value will be automatically allocated. External systems (e.g. load-balancers) can use this port to determine if a given node holds endpoints for this service or not. If this field is specified when creating a Service which does not need it, creation will fail. This field will be wiped when updating a Service to no longer need it (e.g. changing type). This field cannot be updated once set.
|
||||
-->
|
||||
|
||||
healthCheckNodePort 指定 Service 的健康检查节点端口。
|
||||
仅适用于 type 为 LoadBalancer 且 externalTrafficPolicy 设置为 Local 的情况。
|
||||
如果为此字段设定了一个值,该值在合法范围内且没有被使用,则使用所指定的值。
|
||||
|
@ -442,6 +447,7 @@ ServiceSpec 描述用户在服务上创建的属性。
|
|||
<a name="SessionAffinityConfig"></a>
|
||||
*SessionAffinityConfig represents the configurations of session affinity.*
|
||||
-->
|
||||
|
||||
sessionAffinityConfig 包含会话亲和性的配置。
|
||||
|
||||
<a name="SessionAffinityConfig"></a>
|
||||
|
@ -591,7 +597,7 @@ ServiceStatus 表示 Service 的当前状态。
|
|||
type of condition in CamelCase or in foo.example.com/CamelCase.
|
||||
-->
|
||||
|
||||
CamelCase 或 foo.example.com/CamelCase 中的条件类型。
|
||||
condition 的类型,格式为 CamelCase 或 foo.example.com/CamelCase。
|
||||
|
||||
- **conditions.observedGeneration** (int64)
|
||||
|
||||
|
@ -659,6 +665,7 @@ ServiceStatus 表示 Service 的当前状态。
|
|||
Setting this to "Proxy" indicates that traffic is delivered to the node or pod with the destination set to the node's IP and node
|
||||
port or the pod's IP and port. Service implementations may use this information to adjust traffic routing.
|
||||
-->
|
||||
|
||||
ipMode 指定负载平衡器 IP 的行为方式,并且只能在设置了 ip 字段时指定。
|
||||
将其设置为 `VIP` 表示流量将传送到节点,并将目标设置为负载均衡器的 IP 和端口。
|
||||
将其设置为 `Proxy` 表示将流量传送到节点或 Pod,并将目标设置为节点的 IP 和节点端口或 Pod 的 IP 和端口。
|
||||
|
@ -670,10 +677,11 @@ ServiceStatus 表示 Service 的当前状态。
|
|||
*Atomic: will be replaced during a merge*
|
||||
-->
|
||||
|
||||
**Atomic:将在合并期间被替换**
|
||||
**原子:将在合并期间被替换**
|
||||
|
||||
<!--
|
||||
Ports is a list of records of service ports If used, every port defined in the service should have an entry in it -->
|
||||
Ports is a list of records of service ports If used, every port defined in the service should have an entry in it
|
||||
-->
|
||||
|
||||
ports 是 Service 的端口列表。如果设置了此字段,Service 中定义的每个端口都应该在此列表中。
|
||||
|
||||
|
@ -701,7 +709,7 @@ ServiceStatus 表示 Service 的当前状态。
|
|||
Protocol is the protocol of the service port of which status is recorded here The supported values are: "TCP", "UDP", "SCTP"
|
||||
-->
|
||||
|
||||
protocol 是所记录的服务端口状态的协议。支持的值为:`TCP`、`UDP`、`SCTP`。
|
||||
protocol 是所记录的服务端口状态的协议。支持的值为:“TCP”、“UDP”、“SCTP”。
|
||||
|
||||
- **loadBalancer.ingress.ports.error** (string)
|
||||
|
||||
|
@ -762,7 +770,6 @@ ServiceList 包含一个 Service 列表。
|
|||
|
||||
#### HTTP Request
|
||||
-->
|
||||
|
||||
### `get` 读取指定的 Service
|
||||
|
||||
#### HTTP 请求
|
||||
|
|
Loading…
Reference in New Issue