Services ZH translated. (#859)
* Services translated. Signed-off-by: Felixnoo <felixliu@yunify.com> * wording updated. Signed-off-by: Felixnoo <felixliu@yunify.com>
|
|
@ -13,7 +13,7 @@ With Kubernetes, you don't need to modify your application to use an unfamiliar
|
|||
|
||||
For more information, see the [official documentation of Kubernetes](https://kubernetes.io/docs/concepts/services-networking/service/).
|
||||
|
||||
## Access Type
|
||||
## Access Types
|
||||
|
||||
- **Virtual IP**: It is based on the unique IP generated by the cluster. A service can be accessed through this IP inside the cluster. This type is suitable for most services. Alternatively, a service can also be accessed through NodePort and LoadBalancer outside the cluster.
|
||||
|
||||
|
|
@ -29,7 +29,7 @@ In KubeSphere, stateful and stateless Services are created with a virtual IP by
|
|||
|
||||
You need to create a workspace, a project and an account (`project-regular`). The account must be invited to the project with the role of `operator`. For more information, see [Create Workspaces, Projects, Accounts and Roles](../../../quick-start/create-workspace-and-project).
|
||||
|
||||
## Service Type
|
||||
## Service Types
|
||||
|
||||
As shown in the image below, KubeSphere provides three basic methods to create a Service: **Stateless Service**, **Stateful Service**, and **External Service**. Besides, you can also customize a Service through **Specify Workloads** and **Edit by YAML** under **Custom Creation**.
|
||||
|
||||
|
|
@ -63,7 +63,7 @@ The value of `annotations:kubesphere.io/serviceType` keywords can be defined as:
|
|||
|
||||
## Create a Stateless Service
|
||||
|
||||
### Step 1: Open Dashboard
|
||||
### Step 1: Open the dashboard
|
||||
|
||||
1. Go to **Services** under **Application Workloads** of a project and click **Create**.
|
||||
|
||||
|
|
@ -79,9 +79,9 @@ The steps of creating a stateful Service and a stateless Service are basically t
|
|||
|
||||
{{</ notice >}}
|
||||
|
||||
### Step 2: Input Basic Information
|
||||
### Step 2: Input basic information
|
||||
|
||||
1. In the dialog that appears, you can see the filed **Version** prepopulated with `v1`. You need to define a name for the Service, such as `demo-service`. When you finish, click **Next** to continue.
|
||||
1. In the dialog that appears, you can see the field **Version** prepopulated with `v1`. You need to define a name for the Service, such as `demo-service`. When you finish, click **Next** to continue.
|
||||
|
||||

|
||||
|
||||
|
|
@ -126,7 +126,7 @@ The value of **Name** is used in both configurations, one for Deployment and the
|
|||
app: xxx
|
||||
```
|
||||
|
||||
### Step 3: Set Image
|
||||
### Step 3: Set an image
|
||||
|
||||
To add a container image for the Service, see [Set Image](../deployments/#step-3-set-image) for details.
|
||||
|
||||
|
|
@ -138,13 +138,13 @@ For more information about explanations of dashboard properties, see [Container
|
|||
|
||||
{{</ notice >}}
|
||||
|
||||
### Step 4: Mount Volumes
|
||||
### Step 4: Mount volumes
|
||||
|
||||
To mount a volume for the Service, see [Mount Volumes](../deployments/#step-4-mount-volumes) for details.
|
||||
|
||||

|
||||
|
||||
### Step 5: Configure Advanced Settings
|
||||
### Step 5: Configure advanced settings
|
||||
|
||||
You can set a policy for node scheduling and add metadata which is the same as explained in [Deployments](../deployments/#step-5-configure-advanced-settings). For a Service, you can see two additional options available, **Internet Access** and **Enable Sticky Session**.
|
||||
|
||||
|
|
@ -172,7 +172,7 @@ This value is specified by `.spec.type`. If you select **LoadBalancer**, you nee
|
|||
|
||||
## Check Service Details
|
||||
|
||||
### Detail Page
|
||||
### Detail page
|
||||
|
||||
1. After a Service is created, you can click the three dots on the right to further edit it, such as its metadata (excluding **Name**), YAML, port, and Internet access.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,97 +1,97 @@
|
|||
---
|
||||
title: "Services"
|
||||
keywords: 'KubeSphere, Kubernetes, services, workloads'
|
||||
description: 'Create a KubeSphere Service'
|
||||
linkTitle: "Services"
|
||||
title: "服务"
|
||||
keywords: 'KubeSphere, Kubernetes, 服务, 工作负载'
|
||||
description: '创建 KubeSphere 服务'
|
||||
linkTitle: "服务"
|
||||
|
||||
weight: 10240
|
||||
---
|
||||
|
||||
A Service is an abstract way to expose an application running on a set of Pods as a network service. Namely, a Service groups endpoints of these Pods into a single resource, which can be accessed through different ways.
|
||||
服务是一种抽象方法,它将运行在一组 Pod 上的应用程序暴露为网络服务。也就是说,服务将这些 Pod 的 Endpoint 组成一个单一资源,可以通过不同的方式访问该资源。
|
||||
|
||||
With Kubernetes, you don't need to modify your application to use an unfamiliar service discovery mechanism. Kubernetes gives Pods their IP addresses and a single DNS name for a set of Pods, and can load-balance across them.
|
||||
有了 Kubernetes,您无需修改应用程序来使用不熟悉的服务发现机制。Kubernetes 为 Pod 提供 IP 地址,为一组 Pod 提供一个单一 DNS 名称,并且可以在 Pod 之间进行负载均衡。
|
||||
|
||||
For more information, see the [official documentation of Kubernetes](https://kubernetes.io/docs/concepts/services-networking/service/).
|
||||
有关更多信息,请参见 [Kubernetes 官方文档](https://kubernetes.io/zh/docs/concepts/services-networking/service/)。
|
||||
|
||||
## Access Type
|
||||
## 访问类型
|
||||
|
||||
- **Virtual IP**: It is based on the unique IP generated by the cluster. A service can be accessed through this IP inside the cluster. This type is suitable for most services. Alternatively, a service can also be accessed through NodePort and LoadBalancer outside the cluster.
|
||||
- **虚拟 IP**:虚拟 IP 基于集群生成的唯一 IP。集群内部可以通过该 IP 访问服务。此访问类型适用于大多数服务。此外,集群外部也可以通过 NodePort 和 LoadBalancer 访问服务。
|
||||
|
||||
- **Headless**: The cluster does not generate an IP address for the service, and the service is directly accessed through the backend Pod IP of the service within the cluster. This type is suitable for backend heterogeneous services, such as services that need to distinguish between master and slave.
|
||||
- **Headless**:集群不为服务生成 IP 地址,在集群内通过服务的后端 Pod IP 直接访问服务。此访问类型适用于后端异构服务,例如需要区分 master 和 slave 的服务。
|
||||
|
||||
{{< notice tip>}}
|
||||
|
||||
In KubeSphere, stateful and stateless Services are created with a virtual IP by default. If you want to create a Headless Service, use **YAML** to configure it directly.
|
||||
在 KubeSphere 中,创建有状态服务和无状态服务时会默认生成一个虚拟 IP。如果您想创建 Headless 服务,请使用 **YAML** 直接进行配置。
|
||||
|
||||
{{</ notice>}}
|
||||
|
||||
## Prerequisites
|
||||
## 准备工作
|
||||
|
||||
You need to create a workspace, a project and an account (`project-regular`). The account must be invited to the project with the role of `operator`. For more information, see [Create Workspace, Project, Account and Role](../../../quick-start/create-workspace-and-project).
|
||||
您需要创建一个企业空间、一个项目和一个帐户 (`project-regular`),务必邀请该帐户到项目中并赋予 `operator` 角色。有关更多信息,请参见[创建企业空间、项目、帐户和角色](../../../quick-start/create-workspace-and-project/)。
|
||||
|
||||
## Service Type
|
||||
## 服务类型
|
||||
|
||||
As shown in the image below, KubeSphere provides three basic methods to create a Service: **Stateless Service**, **Stateful Service**, and **External Service**. Besides, you can also customize a Service through **Specify Workloads** and **Edit by YAML** under **Custom Creation**.
|
||||
如下图所示,KubeSphere 提供三种创建服务的基本方法:**无状态服务**、**有状态服务**和**外部服务**。另外,您还可以通过**自定义创建**下面的**指定工作负载**和**编辑 YAML** 来自定义服务。
|
||||
|
||||

|
||||

|
||||
|
||||
- **Stateless Service**
|
||||
- **无状态服务**
|
||||
|
||||
Stateless Services are the most commonly used Services in container services. They define the Pod template to control the Pod status, including rolling updates and rollbacks. A **Deployment** workload is also created when you create a stateless Service. For more information about stateless Services, see [Deployments](../../application-workloads/deployments).
|
||||
无状态服务是容器服务中最常用的服务类型。无状态服务定义 Pod 模板来控制 Pod 状态,包括滚动更新和回滚。您创建无状态服务时会同时创建**部署**工作负载。有关无状态服务的更多信息,请参见[部署](../../../project-user-guide/application-workloads/deployments/)。
|
||||
|
||||
- **Stateful Service**
|
||||
- **有状态服务**
|
||||
|
||||
Stateful Services are used to manage stateful applications, ensuring ordered and graceful deployment and scaling. They also provide stable persistent storage and network identifiers. A **StatefulSet** workload is also created when you create a stateful Service. For more information about stateful Services, see [StatefulSets](../../application-workloads/statefulsets).
|
||||
有状态服务用于管理有状态应用程序,确保有序且优雅的部署和扩缩,还提供稳定的持久化存储以及网络标识符。您创建有状态服务时会同时创建**有状态副本集**工作负载。有关有状态服务的更多信息,请参见[有状态副本集](../../../project-user-guide/application-workloads/statefulsets/)。
|
||||
|
||||
- **External Service**
|
||||
- **外部服务**
|
||||
|
||||
Different from stateless and stateful Services, an ExternalName Service maps a Service to a DNS name instead of a selector. You need to specify these Services in the **ExternalName** field, indicated by `externalName` in the YAML file.
|
||||
与无状态服务和有状态服务不同,ExternalName 服务将一个服务映射到一个 DNS 名称,而不是映射到选择器。您需要在 **ExternalName** 字段中指定这些服务,该字段显示在 YAML 文件中的 `externalName`。
|
||||
|
||||
- **Specify Workloads**
|
||||
- **指定工作负载**
|
||||
|
||||
Create a Service with existing Pods.
|
||||
使用现有 Pod 创建服务。
|
||||
|
||||
- **Edit by YAML**
|
||||
- **编辑 YAML**
|
||||
|
||||
Create a Service directly with YAML. You can upload and download YAML configuration files to and from the console.
|
||||
使用 YAML 直接创建服务。您可以将 YAML 配置文件上传至控制台,也可以从控制台下载 YAML 配置文件。
|
||||
|
||||
{{< notice tip>}}
|
||||
|
||||
The value of `annotations:kubesphere.io/serviceType` keywords can be defined as: `statelessservice`, `statefulservice`, `externalservice` and `None`.
|
||||
关键字 `annotations:kubesphere.io/serviceType` 的值可以定义为 `statelessservice`、`statefulservice`、`externalservice` 和 `None`。
|
||||
|
||||
{{</ notice>}}
|
||||
|
||||
## Create a Stateless Service
|
||||
## 创建无状态服务
|
||||
|
||||
### Step 1: Open Dashboard
|
||||
### 步骤 1:打开仪表板
|
||||
|
||||
1. Go to **Services** under **Application Workloads** of a project and click **Create**.
|
||||
1. 在项目页面转到**应用负载**下的**服务**,点击**创建**。
|
||||
|
||||

|
||||

|
||||
|
||||
2. Click **Stateless Service**.
|
||||
2. 点击**无状态服务**。
|
||||
|
||||

|
||||

|
||||
|
||||
{{< notice note >}}
|
||||
|
||||
The steps of creating a stateful Service and a stateless Service are basically the same. This example only goes through the process of creating a stateless Service for demonstration purpose.
|
||||
创建有状态服务的步骤和创建无状态服务的步骤基本相同。本示例仅使用创建无状态服务的过程来进行演示。
|
||||
|
||||
{{</ notice >}}
|
||||
|
||||
### Step 2: Input Basic Information
|
||||
### 步骤 2:输入基本信息
|
||||
|
||||
1. In the dialogue that appears, you can see the filed **Version** prepopulated with `v1`. You need to define a name for the Service, such as `demo-service`. When you finish, click **Next** to continue.
|
||||
1. 在弹出的对话框中,您可以看到字段**版本**已经预先填写了 `v1`。您需要输入服务的名称,例如 `demo-service`。完成后,点击**下一步**继续。
|
||||
|
||||

|
||||

|
||||
|
||||
- **Name**: The name of the Service and Deployment, which is also the unique identifier.
|
||||
- **Alias**: The alias name of the Service, making resources easier to identify.
|
||||
- **Version**: It can only contain lowercase letters and numbers. The maximum length of characters is set to 16.
|
||||
- **名称**:服务和部署的名称,也是唯一标识符。
|
||||
- **别名**:服务的别名,使资源更容易识别。
|
||||
- **版本**:只能包含小写字母和数字,最长 16 个字符。
|
||||
|
||||
{{< notice tip >}}
|
||||
|
||||
The value of **Name** is used in both configurations, one for Deployment and the other for Service. You can see the manifest file of the Deployment and the Service by enabling **Edit Mode** in the top right corner. Below is an example file for your reference.
|
||||
**名称**的值用于两个配置中,一个是部署,另一个是服务。您可以启用右上角的**编辑模式**查看部署的清单文件以及服务的清单文件。下方是一个示例文件,供您参考。
|
||||
|
||||
{{</ notice>}}
|
||||
|
||||
|
|
@ -126,70 +126,70 @@ The value of **Name** is used in both configurations, one for Deployment and the
|
|||
app: xxx
|
||||
```
|
||||
|
||||
### Step 3: Set Image
|
||||
### 步骤 3:设置镜像
|
||||
|
||||
To add a container image for the Service, see [Set Image](../deployments/#step-3-set-image) for details.
|
||||
为服务添加容器镜像,详情请参见[设置镜像](../../../project-user-guide/application-workloads/deployments/#步骤-3设置镜像)。
|
||||
|
||||

|
||||

|
||||
|
||||
{{< notice tip >}}
|
||||
|
||||
For more information about explanations of dashboard properties, see [Container Image Settings](../container-image-settings/) directly.
|
||||
有关仪表板上各项属性的详细说明,请直接参见[容器镜像设置](../../../project-user-guide/application-workloads/container-image-settings/)。
|
||||
|
||||
{{</ notice >}}
|
||||
|
||||
### Step 4: Mount Volumes
|
||||
### 步骤 4:挂载存储卷
|
||||
|
||||
To mount a volume for the Service, see [Mount Volumes](../deployments/#step-4-mount-volumes) for details.
|
||||
要为服务挂载存储卷,详情请参见[挂载存储卷](../../../project-user-guide/application-workloads/deployments/#步骤-4挂载存储卷)。
|
||||
|
||||

|
||||

|
||||
|
||||
### Step 5: Configure Advanced Settings
|
||||
### 步骤 5:配置高级设置
|
||||
|
||||
You can set a policy for node scheduling and add metadata which is the same as explained in [Deployments](../deployments/#step-5-configure-advanced-settings). For a Service, you can see two additional options available, **Internet Access** and **Enable Sticky Session**.
|
||||
您可以设置节点调度策略并添加元数据,具体操作与[部署](../../../project-user-guide/application-workloads/deployments/#步骤-5配置高级设置)中的说明相同。对于服务,您可以看到两个额外选项可用,即**外网访问**和**开启会话保持**。
|
||||
|
||||

|
||||

|
||||
|
||||
- Internet Access
|
||||
- 外网访问
|
||||
|
||||
You can expose a Service externally through two methods, NodePort and LoadBalancer.
|
||||
您可以通过两种方法向外暴露服务,即 NodePort 和 LoadBalancer。
|
||||
|
||||
- **NodePort**: A Service is exposed on each node's IP address at a static port.
|
||||
- **NodePort**:在每个节点的 IP 地址上通过静态端口暴露服务。
|
||||
|
||||
- **LoadBalancer**: Clients send requests to the IP address of a load balancer.
|
||||
- **LoadBalancer**:客户端向负载均衡器的 IP 地址发送请求。
|
||||
|
||||
{{< notice note >}}
|
||||
|
||||
This value is specified by `.spec.type`. If you select **LoadBalancer**, you need to add annotations for it at the same time.
|
||||
该值由 `.spec.type` 字段指定。如果您选择 **LoadBalancer**,则需要同时为它添加注解。
|
||||
|
||||
{{</ notice >}}
|
||||
|
||||
- Enable Sticky Session
|
||||
- 开启会话保持
|
||||
|
||||
You may want to route all traffic sent from a single client session to the same instance of an app which runs across multiple replicas. This makes better use of caches as it reduces latency. This behavior of load balancing is called Sticky Sessions.
|
||||
您可能想把从单个客户端会话发送的所有流量都路由到跨多个副本运行的应用的同一实例。这种做法降低了延迟,因此能更好地利用缓存。负载均衡的这种行为称为“会话保持 (Sticky Session)”。
|
||||
|
||||
You can set the maximum session sticky time in this field, specified by `.spec.sessionAffinityConfig.clientIP.timeoutSeconds` in the manifest file, which defaults to 10800.
|
||||
您可以在该字段设置最大会话保持时间,由清单文件中的 `.spec.sessionAffinityConfig.clientIP.timeoutSeconds` 指定,默认为 10800。
|
||||
|
||||
## Check Service Details
|
||||
## 查看服务详情
|
||||
|
||||
### Detail Page
|
||||
### 详情页面
|
||||
|
||||
1. After a Service is created, you can click the three dots on the right to further edit it, such as its metadata (excluding **Name**), YAML, port, and Internet access.
|
||||
1. 创建服务后,您可以点击右侧的三个点进一步编辑它,例如元数据(**名称**无法编辑)、配置文件、端口以及外网访问。
|
||||
|
||||

|
||||

|
||||
|
||||
- **Edit**: View and edit the basic information.
|
||||
- **Edit YAML**: View, upload, download, or update the YAML file.
|
||||
- **Edit Service**: View the access type and set selectors and ports.
|
||||
- **Edit Internet Access**: Edit the service Internet access method.
|
||||
- **Delete**: When you delete a Service, associated resources will be displayed. If you check them, they will be deleted together with the Service.
|
||||
- **编辑**:查看和编辑基本信息。
|
||||
- **编辑配置文件**:查看、上传、下载或者更新 YAML 文件。
|
||||
- **编辑服务**:查看访问类型并设置选择器和端口。
|
||||
- **编辑外网访问**:编辑服务的外网访问方法。
|
||||
- **删除**:当您删除服务时,会在弹出对话框中显示关联资源。如果您勾选这些关联资源,则会与服务一同删除。
|
||||
|
||||
2. Click the name of the Service and you can go to its detail page.
|
||||
2. 点击服务名称可以转到它的详情页面。
|
||||
|
||||

|
||||

|
||||
|
||||
- Click **More** to expand the drop-down menu which is the same as the one in the Service list.
|
||||
- The Pod list provides detailed information of the Pod (status, node, Pod IP and resource usage).
|
||||
- You can view the container information by clicking a Pod item.
|
||||
- Click the container log icon to view output logs of the container.
|
||||
- You can view the Pod detail page by clicking the Pod name.
|
||||
- 点击**更多操作**展开下拉菜单,菜单内容与服务列表中的下拉菜单相同。
|
||||
- Pod 列表提供 Pod 的详细信息(运行状态、节点、Pod IP 以及资源使用情况)。
|
||||
- 您可以点击 Pod 条目查看容器信息。
|
||||
- 点击容器日志图标查看容器的输出日志。
|
||||
- 您可以点击 Pod 名称查看 Pod 详情页面。
|
||||
|
|
|
|||
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 85 KiB |
|
After Width: | Height: | Size: 92 KiB |
|
After Width: | Height: | Size: 96 KiB |
|
After Width: | Height: | Size: 92 KiB |
|
After Width: | Height: | Size: 96 KiB |
|
After Width: | Height: | Size: 85 KiB |
|
After Width: | Height: | Size: 94 KiB |
|
After Width: | Height: | Size: 55 KiB |