mirror of https://github.com/istio/istio.io.git
* Sync 1.17.6 change notes and #13899 into Chinese * fix format * fix lint * Update content/zh/boilerplates/gateway-api-gamma-support.md Co-authored-by: Michael <haifeng.yao@daocloud.io> * Update content/zh/boilerplates/gateway-api-gamma-support.md Co-authored-by: Michael <haifeng.yao@daocloud.io> * Update content/zh/boilerplates/gateway-api-gamma-support.md Co-authored-by: Michael <haifeng.yao@daocloud.io> * split 1.17.6 release notes --------- Co-authored-by: Michael <haifeng.yao@daocloud.io>
This commit is contained in:
parent
eae4f8948f
commit
d5009facef
|
@ -1,21 +0,0 @@
|
|||
---
|
||||
---
|
||||
{{< warning >}}
|
||||
|
||||
本文使用 Kubernetes Gateway API 的[实验性功能](https://gateway-api.sigs.k8s.io/concepts/versioning/#release-channels-eg-experimental-standard)。
|
||||
需要使用 Alpha 版本的 CRD。在继续执行此任务之前,请确保:
|
||||
|
||||
1) 安装 Gateway API CRD 的 Alpha 版本:
|
||||
|
||||
{{< text syntax=bash snip_id=install_experimental_crds >}}
|
||||
$ kubectl kustomize "github.com/kubernetes-sigs/gateway-api/config/crd/experimental?ref={{< k8s_gateway_api_version >}}" | kubectl apply -f -
|
||||
{{< /text >}}
|
||||
|
||||
2) 安装 Istio 时,通过将 `PILOT_ENABLE_ALPHA_GATEWAY_API`
|
||||
环境变量设置为 `true` 使 Istio 读取 Alpha 版本的资源:
|
||||
|
||||
{{< text syntax=bash snip_id=enable_alpha_crds >}}
|
||||
$ istioctl install --set values.pilot.env.PILOT_ENABLE_ALPHA_GATEWAY_API=true --set profile=minimal -y
|
||||
{{< /text >}}
|
||||
|
||||
{{< /warning >}}
|
|
@ -1,8 +1,26 @@
|
|||
---
|
||||
---
|
||||
{{< boilerplate gateway-api-support >}}
|
||||
{{< tip >}}
|
||||
{{< boilerplate gateway-api-future >}}
|
||||
{{< boilerplate gateway-api-choose >}}
|
||||
{{< /tip >}}
|
||||
|
||||
{{< warning >}}
|
||||
请注意,本文使用 Gateway API 配置内部网格(东西)流量,即不仅是 Ingress(南北)流量。
|
||||
使用 Gateway API 配置内部网格流量目前是一个还在开发的[实验性特性](https://gateway-api.sigs.k8s.io/geps/overview/#status)。
|
||||
若使用 Gateway API 指令,请先确保:
|
||||
|
||||
1) 安装 **实验版本** 的 Gateway API CRD:
|
||||
|
||||
{{< text syntax=bash snip_id=install_experimental_crds >}}
|
||||
$ kubectl kustomize "github.com/kubernetes-sigs/gateway-api/config/crd/experimental?ref={{< k8s_gateway_api_version >}}" | kubectl apply -f -
|
||||
{{< /text >}}
|
||||
|
||||
2) 安装 Istio 时,通过将 `PILOT_ENABLE_ALPHA_GATEWAY_API`
|
||||
环境变量设置为 `true` 使 Istio 读取 Alpha 版本的 Gateway API 资源:
|
||||
|
||||
{{< text syntax=bash snip_id=enable_alpha_crds >}}
|
||||
$ istioctl install --set values.pilot.env.PILOT_ENABLE_ALPHA_GATEWAY_API=true --set profile=minimal -y
|
||||
{{< /text >}}
|
||||
|
||||
{{< /warning >}}
|
||||
|
|
|
@ -9,11 +9,12 @@ test: yes
|
|||
|
||||
本任务展示如何为连接、请求以及异常检测配置熔断。
|
||||
|
||||
熔断,是创建弹性微服务应用程序的重要模式。熔断能够使您的应用程序具备应对来自故障、潜在峰值和其他未知网络因素影响的能力。
|
||||
熔断,是创建弹性微服务应用程序的重要模式。
|
||||
熔断能够使您的应用程序具备应对来自故障、潜在峰值和其他未知网络因素影响的能力。
|
||||
|
||||
这个任务中,您将配置熔断规则,然后通过有意的使熔断器“跳闸”来测试配置。
|
||||
|
||||
## 开始之前{#before-you-begin}
|
||||
## 开始之前 {#before-you-begin}
|
||||
|
||||
* 跟随[安装指南](/zh/docs/setup/)安装 Istio。
|
||||
|
||||
|
@ -21,12 +22,15 @@ test: yes
|
|||
|
||||
应用程序 `httpbin` 作为此任务的后端服务。
|
||||
|
||||
## 配置熔断器{#configuring-the-circuit-breaker}
|
||||
## 配置熔断器 {#configuring-the-circuit-breaker}
|
||||
|
||||
1. 创建一个[目标规则](/zh/docs/reference/config/networking/destination-rule/),在调用 `httpbin` 服务时应用熔断设置:
|
||||
1. 创建一个[目标规则](/zh/docs/reference/config/networking/destination-rule/),
|
||||
在调用 `httpbin` 服务时应用熔断设置:
|
||||
|
||||
{{< warning >}}
|
||||
如果您的 Istio 启用了双向 TLS 身份验证,则必须在应用目标规则之前将 TLS 流量策略 `mode:ISTIO_MUTUAL` 添加到 `DestinationRule`。否则请求将产生 503 错误,如[这里](/zh/docs/ops/common-problems/network-issues/#service-unavailable-errors-after-setting-destination-rule)所述。
|
||||
如果您的 Istio 启用了双向 TLS 身份验证,则必须在应用目标规则之前将 TLS 流量策略
|
||||
`mode:ISTIO_MUTUAL` 添加到 `DestinationRule`。否则请求将产生 503 错误,
|
||||
如[这里](/zh/docs/ops/common-problems/network-issues/#service-unavailable-errors-after-setting-destination-rule)所述。
|
||||
{{< /warning >}}
|
||||
|
||||
{{< text bash >}}
|
||||
|
@ -75,13 +79,17 @@ test: yes
|
|||
maxEjectionPercent: 100
|
||||
{{< /text >}}
|
||||
|
||||
## 增加一个客户端{#adding-a-client}
|
||||
## 增加一个客户端 {#adding-a-client}
|
||||
|
||||
创建客户端程序以发送流量到 `httpbin` 服务。这是一个名为 [Fortio](https://github.com/istio/fortio) 的负载测试客户端,它可以控制连接数、并发数及发送 HTTP 请求的延迟。通过 Fortio 能够有效的触发前面在 `DestinationRule` 中设置的熔断策略。
|
||||
创建客户端程序以发送流量到 `httpbin` 服务。这是一个名为
|
||||
[Fortio](https://github.com/istio/fortio) 的负载测试客户端,
|
||||
它可以控制连接数、并发数及发送 HTTP 请求的延迟。
|
||||
通过 Fortio 能够有效的触发前面在 `DestinationRule` 中设置的熔断策略。
|
||||
|
||||
1. 向客户端注入 Istio Sidecar 代理,以便 Istio 对其网络交互进行管理:
|
||||
|
||||
如果您启用了[自动注入 Sidecar](/zh/docs/setup/additional-setup/sidecar-injection/#automatic-sidecar-injection),可以直接部署 `fortio` 应用:
|
||||
如果您启用了[自动注入 Sidecar](/zh/docs/setup/additional-setup/sidecar-injection/#automatic-sidecar-injection),
|
||||
可以直接部署 `fortio` 应用:
|
||||
|
||||
{{< text bash >}}
|
||||
$ kubectl apply -f @samples/httpbin/sample-client/fortio-deploy.yaml@
|
||||
|
@ -126,9 +134,10 @@ test: yes
|
|||
|
||||
可以看到调用后端服务的请求已经成功!接下来,可以测试熔断。
|
||||
|
||||
## 触发熔断器{#tripping-the-circuit-breaker}
|
||||
## 触发熔断器 {#tripping-the-circuit-breaker}
|
||||
|
||||
在 `DestinationRule` 配置中,您定义了 `maxConnections: 1` 和 `http1MaxPendingRequests: 1`。这些规则意味着,如果并发的连接和请求数超过一个,在 `istio-proxy` 进行进一步的请求和连接时,后续请求或连接将被阻止。
|
||||
在 `DestinationRule` 配置中,您定义了 `maxConnections: 1` 和 `http1MaxPendingRequests: 1`。
|
||||
这些规则意味着,如果并发的连接和请求数超过一个,在 `istio-proxy` 进行进一步的请求和连接时,后续请求或连接将被阻止。
|
||||
|
||||
1. 发送并发数为 2 的连接(`-c 2`),请求 20 次(`-n 20`):
|
||||
|
||||
|
@ -249,7 +258,7 @@ test: yes
|
|||
|
||||
可以看到 `upstream_rq_pending_overflow` 值 `21`,这意味着,目前为止已有 21 个调用被标记为熔断。
|
||||
|
||||
## 清理{#cleaning-up}
|
||||
## 清理 {#cleaning-up}
|
||||
|
||||
1. 清理规则:
|
||||
|
||||
|
|
|
@ -9,19 +9,22 @@ owner: istio/wg-networking-maintainers
|
|||
test: yes
|
||||
---
|
||||
|
||||
[安全网关](/zh/docs/tasks/traffic-management/ingress/secure-ingress/)说明了如何为 HTTP 服务配置 HTTPS 访问入口。而本示例将说明如何为 HTTPS 服务配置 HTTPS 访问入口,即配置 Ingress Gateway 以执行 SNI 透传,而不是对传入请求进行 TLS 终止。
|
||||
[安全网关](/zh/docs/tasks/traffic-management/ingress/secure-ingress/)说明了如何为 HTTP 服务配置 HTTPS 访问入口。
|
||||
而本示例将说明如何为 HTTPS 服务配置 HTTPS 访问入口,
|
||||
即配置 Ingress Gateway 以执行 SNI 透传,而不是对传入请求进行 TLS 终止。
|
||||
|
||||
本任务中的 HTTPS 示例服务是一个简单的 [NGINX](https://www.nginx.com) 服务。在接下来的步骤中,您首先在 Kubernetes 集群中创建一个 NGINX 服务。接着,通过网关给这个服务配置一个域名是 `nginx.example.com` 的访问入口。
|
||||
本任务中的 HTTPS 示例服务是一个简单的
|
||||
[NGINX](https://www.nginx.com) 服务。在接下来的步骤中,
|
||||
您首先在 Kubernetes 集群中创建一个 NGINX 服务。接着,
|
||||
通过网关给这个服务配置一个域名是 `nginx.example.com` 的访问入口。
|
||||
|
||||
{{< boilerplate gateway-api-support >}}
|
||||
|
||||
{{< boilerplate gateway-api-experimental >}}
|
||||
{{< boilerplate gateway-api-gamma-support >}}
|
||||
|
||||
## 准备工作 {#before-you-begin}
|
||||
|
||||
按照[安装指南](/zh/docs/setup/)部署 Istio。
|
||||
|
||||
## 生成客户端和服务端的证书和密钥{#generate-client-and-server-certificates-and-keys}
|
||||
## 生成客户端和服务端的证书和密钥 {#generate-client-and-server-certificates-and-keys}
|
||||
|
||||
对于此任务,您可以使用自己喜欢的工具来生成证书和密钥。以下命令使用
|
||||
[openssl](https://man.openbsd.org/openssl.1):
|
||||
|
@ -39,9 +42,11 @@ test: yes
|
|||
$ openssl x509 -req -sha256 -days 365 -CA example.com.crt -CAkey example.com.key -set_serial 0 -in nginx.example.com.csr -out nginx.example.com.crt
|
||||
{{< /text >}}
|
||||
|
||||
## 部署一个 NGINX 服务{#deploy-an-nginx-server}
|
||||
## 部署一个 NGINX 服务 {#deploy-an-nginx-server}
|
||||
|
||||
1. 创建一个 Kubernetes 的 [Secret](https://kubernetes.io/zh-cn/docs/concepts/configuration/secret/) 资源来保存服务的证书:
|
||||
1. 创建一个 Kubernetes 的
|
||||
[Secret](https://kubernetes.io/zh-cn/docs/concepts/configuration/secret/)
|
||||
资源来保存服务的证书:
|
||||
|
||||
{{< text bash >}}
|
||||
$ kubectl create secret tls nginx-server-certs --key nginx.example.com.key --cert nginx.example.com.crt
|
||||
|
@ -75,7 +80,9 @@ test: yes
|
|||
EOF
|
||||
{{< /text >}}
|
||||
|
||||
1. 创建一个 Kubernetes 的 [ConfigMap](https://kubernetes.io/zh-cn/docs/tasks/configure-pod-container/configure-pod-configmap/) 资源来保存 NGINX 服务的配置:
|
||||
1. 创建一个 Kubernetes 的
|
||||
[ConfigMap](https://kubernetes.io/zh-cn/docs/tasks/configure-pod-container/configure-pod-configmap/)
|
||||
资源来保存 NGINX 服务的配置:
|
||||
|
||||
{{< text bash >}}
|
||||
$ kubectl create configmap nginx-configmap --from-file=nginx.conf=./nginx.conf
|
||||
|
@ -134,7 +141,9 @@ test: yes
|
|||
EOF
|
||||
{{< /text >}}
|
||||
|
||||
1. 要测试 NGINX 服务是否已成功部署,需要从其 Sidecar 代理发送请求,并忽略检查服务端的证书(使用 `curl` 的 `-k` 选项)。确保正确打印服务端的证书,即 `common name (CN)` 等于 `nginx.example.com`。
|
||||
1. 要测试 NGINX 服务是否已成功部署,需要从其 Sidecar 代理发送请求,
|
||||
并忽略检查服务端的证书(使用 `curl` 的 `-k` 选项)。
|
||||
确保正确打印服务端的证书,即 `common name (CN)` 等于 `nginx.example.com`。
|
||||
|
||||
{{< text bash >}}
|
||||
$ kubectl exec "$(kubectl get pod -l run=my-nginx -o jsonpath={.items..metadata.name})" -c istio-proxy -- curl -sS -v -k --resolve nginx.example.com:443:127.0.0.1 https://nginx.example.com
|
||||
|
@ -163,9 +172,11 @@ test: yes
|
|||
...
|
||||
{{< /text >}}
|
||||
|
||||
## 配置 Ingress Gateway{#configure-an-ingress-gateway}
|
||||
## 配置 Ingress Gateway {#configure-an-ingress-gateway}
|
||||
|
||||
1. 定义一个 `server` 部分的端口为 443 的 `Gateway`。注意,`PASSTHROUGH tls` TLS 模式,该模式指示 Gateway 以 AS IS 方式传递入口流量,而不终止 TLS。
|
||||
1. 定义一个 `server` 部分的端口为 443 的 `Gateway`。
|
||||
注意,`PASSTHROUGH tls` TLS 模式,
|
||||
该模式指示 Gateway 以 AS IS 方式传递入口流量,而不终止 TLS。
|
||||
|
||||
{{< text bash >}}
|
||||
$ kubectl apply -f - <<EOF
|
||||
|
@ -214,9 +225,11 @@ test: yes
|
|||
EOF
|
||||
{{< /text >}}
|
||||
|
||||
1. 根据[确定 Ingress IP 和端口](/zh/docs/tasks/traffic-management/ingress/ingress-control/#determining-the-ingress-i-p-and-ports)中的指令来定义环境变量 `SECURE_INGRESS_PORT` 和 `INGRESS_HOST`。
|
||||
1. 根据[确定 Ingress IP 和端口](/zh/docs/tasks/traffic-management/ingress/ingress-control/#determining-the-ingress-i-p-and-ports)中的指令来定义环境变量
|
||||
`SECURE_INGRESS_PORT` 和 `INGRESS_HOST`。
|
||||
|
||||
1. 从集群外访问 NGINX 服务。注意,服务端返回了正确的证书,并且该证书已成功验证(输出了 _SSL certificate verify ok_)。
|
||||
1. 从集群外访问 NGINX 服务。注意,服务端返回了正确的证书,
|
||||
并且该证书已成功验证(输出了 _SSL certificate verify ok_)。
|
||||
|
||||
{{< text bash >}}
|
||||
$ curl -v --resolve "nginx.example.com:$SECURE_INGRESS_PORT:$INGRESS_HOST" --cacert example.com.crt "https://nginx.example.com:$SECURE_INGRESS_PORT"
|
||||
|
@ -235,7 +248,7 @@ test: yes
|
|||
<title>Welcome to nginx!</title>
|
||||
{{< /text >}}
|
||||
|
||||
## 清除{#cleanup}
|
||||
## 清除 {#cleanup}
|
||||
|
||||
1. 删除已创建的 Kubernetes 资源:
|
||||
|
||||
|
|
|
@ -18,9 +18,7 @@ test: yes
|
|||
在此任务中,您将会把 100% 的 TCP 流量分配到 `tcp-echo:v1`。
|
||||
接着,再通过配置 Istio 路由权重把 20% 的 TCP 流量分配到 `tcp-echo:v2`。
|
||||
|
||||
{{< boilerplate gateway-api-support >}}
|
||||
|
||||
{{< boilerplate gateway-api-experimental >}}
|
||||
{{< boilerplate gateway-api-gamma-support >}}
|
||||
|
||||
## 开始之前 {#before-you-begin}
|
||||
|
||||
|
|
Loading…
Reference in New Issue