Merge pull request #812 from Patrick-LuoYu/project-gateway-zh

Translated project-gateway.md.
This commit is contained in:
KubeSphere CI Bot 2020-12-29 13:12:53 +08:00 committed by GitHub
commit dfe95aafe1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 28 additions and 28 deletions

View File

@ -1,72 +1,72 @@
---
title: "Project Gateway"
keywords: 'KubeSphere, Kubernetes, project, gateway, NodePort, LoadBalancer'
description: 'How to set a project gateway in KubeSphere.'
linkTitle: "Project Gateway"
title: "项目网关"
keywords: 'KubeSphere, Kubernetes, 项目, 网关, NodePort, LoadBalancer'
description: '如何在 KubeSphere 中设置项目网关。'
linkTitle: "项目网关"
weight: 13500
---
A gateway in a KubeSphere project is an [NGINX Ingress controller](https://www.nginx.com/products/nginx/kubernetes-ingress-controller). KubeSphere has a builtin configuration for HTTP load balancing, called [Routes](../../project-user-guide/application-workloads/ingress/). A Route defines rules for external connections to Services within a cluster. Users who need to provide external access to their Services create a Route resource that defines rules, including the URI path, backing service name, and other information.
KubeSphere 项目中的网关是一个[ NGINX Ingress 控制器](https://www.nginx.com/products/nginx/kubernetes-ingres-controller)。KubeSphere 内置的用于 HTTP 负载均衡的机制称为[路由](../../project-user-guide/application-workloads/ingress/),它定义了从外部到集群服务的连接规则。如需允许从外部访问服务,用户可创建路由资源来定义 URI 路径、后端服务名称等信息。
In KubeSphere 3.0, a project gateway works independently for itself. In other words, every project has its own Ingress controller. In the next release, KubeSphere will provide a cluster-scope gateway in addition to the project-scope gateway, allowing all projects to share the same gateway.
在 KubeSphere 3.0,项目网关单独运行,即每个项目都有自己的 Ingress 控制器。在下一个发布版本中KubeSphere 除了提供项目范围的网关外,还将提供集群范围的网关,使得所有项目都能共享相同的网关。
This tutorial demonstrates how to set a gateway in KubeSphere for the external access to Services and Routes.
本教程演示如何在 KubeSphere 中设置网关以从外部访问服务和路由。
## Prerequisites
## 准备工作
You need to create a workspace, a project and an account (`project-admin`). The account must be invited to the project with the role of `admin` at the project level. For more information, see [Create Workspace, Project, Account and Role](../../../docs/quick-start/create-workspace-and-project).
您需要创建一个企业空间、一个项目和一个帐户 (`project-admin`)。该帐户必须被邀请至项目,并且在项目中的角色为 `admin`。有关更多信息,请参见[创建企业空间、项目、帐户和角色](../../../docs/quick-start/create-workspace-and-project)。
## Set a Gateway
## 设置网关
1. Log in the KubeSphere web console as `project-admin` and go to your project. In **Project Settings** from the navigation bar, select **Advanced Settings** and click **Set Gateway**.
1. `project-admin` 用户登录 KubeSphere Web 控制台,进入您的项目,从左侧导航栏进入**项目设置**下的**高级设置**页面,然后点击**设置网关**。
![set-project-gateway](/images/docs/project-administration/project-gateway/set-project-gateway.jpg)
![set-project-gateway](/images/docs/zh-cn/project-administration/project-gateway/set-project-gateway.jpg)
2. In the pop-up window, you can select two access modes for the gateway.
2. 在弹出的对话框中选择网关的访问方式。
![access-method](/images/docs/project-administration/project-gateway/access-method.png)
![access-method](/images/docs/zh-cn/project-administration/project-gateway/access-method.png)
**NodePort**: You can access Services with corresponding node ports through the gateway.
**NodePort**:通过网关访问服务对应的节点端口。
**LoadBalancer**: You can access Services with a single IP address through the gateway.
**LoadBalancer**:通过网关访问服务的单独 IP 地址。
3. You can also enable **Application Governance** on the **Set Gateway** page. You need to enable **Application Governance** so that you can use the Tracing feature and use [different grayscale release strategies](../../project-user-guide/grayscale-release/overview/). Once it is enabled, check whether an annotation (e.g. `nginx.ingress.kubernetes.io/service-upstream: true`) is added for your route (Ingress) if the route is inaccessible.
3. 在**设置网关**对话框,您可以启用**应用治理**以使用 Tracing 功能和[不同的灰度发布策略](../../project-user-guide/grayscale-release/overview/)。如果启用**应用治理**后无法访问路由,请在路由 (Ingress) 中添加注解(例如 `nginx.ingress.kubernetes.io/service-upstream: true`)。
4. After you select an access method, click **Save**.
4. 选择访问方式后点击**保存**。
## NodePort
If you select **NodePort**, KubeSphere will set a port for http and https requests respectively. You can access your Service at `EIP:NodePort` or `Hostname:NodePort`.
如果您选择 **NodePort**KubeSphere 将为 HTTP 请求和 HTTPS 请求分别设置一个端口。您可以用 `EIP:NodePort``Hostname:NodePort` 地址访问服务。
![nodeport](/images/docs/project-administration/project-gateway/nodeport.jpg)
![nodeport](/images/docs/zh-cn/project-administration/project-gateway/nodeport.jpg)
For example, to access your Service with an elastic IP address (EIP), visit:
例如,如果您的服务配置了的弹性 IP 地址 (EIP),请访问:
- `http://EIP:32734`
- `https://EIP:32471`
When you create a [Route](../../project-user-guide/application-workloads/ingress/) (Ingress), you can customize a host name to access your Service. For example, to access your Service with the host name set in your Route, visit:
当创建[路由](../../project-user-guide/application-workloads/ingress/) (Ingress) 时,您可以自定义主机名用于访问服务。例如,如果您的路由中配置了服务的主机名,请访问:
- `http://demo.kubesphere.io:32734`
- `https://demo.kubesphere.io:32471`
{{< notice note >}}
- You may need to open ports in your security groups and configure relevant port forwarding rules depending on your environment.
- 取决于您的环境,您可能需要在安全组中放行端口并配置相关的端口转发规则 。
- If you access your Service using the host name, make sure the domain name you set can be resolved to the IP address.
- **NodePort** is not recommended for a production environment. You can use **LoadBalancer** instead.
- 如果使用主机名访问服务,请确保您设置的域名可以解析为对应的 IP 地址。
- 在生产环境中不建议使用 **NodePort**,请使用 **LoadBalancer**
{{</ notice >}}
## LoadBalancer
You must configure a load balancer in advance before you select **LoadBalancer**. The IP address of the load balancer will be bound to the gateway to provide access to internal Services and Routes.
在选择 **LoadBalancer** 前,您必须先配置负载均衡器。负载均衡器的 IP 地址将与网关绑定以便内部的服务和路由可以访问。
![lb](/images/docs/project-administration/project-gateway/lb.png)
![lb](/images/docs/zh-cn/project-administration/project-gateway/lb.png)
{{< notice note >}}
Cloud providers often support load balancer plugins. If you install KubeSphere on major Kubernetes engines on their platforms, you may notice a load balancer is already available in the environment for you to use. If you install KubeSphere in a bare metal environment, you can use [Porter](https://github.com/kubesphere/porter) for load balancing.
云厂商通常支持负载均衡器插件。如果在主流的 Kubernetes Engine 上安装 KubeSphere您可能会发现环境中已有可用的负载均衡器。如果在裸金属环境中安装 KubeSphere您可以使用 [Porter](https://github.com/kubesphere/porter) 作为负载均衡器。
{{</ notice >}}

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 KiB