mirror of https://github.com/istio/istio.io.git
zh translation: docs/tasks/traffic management/ingress/ingress sni passthrough/index.md (#9442)
* zh-translation: docs/tasks/traffic-management/ingress/ingress-sni-passthrough/index.md * modify
This commit is contained in:
parent
a6fedc82b5
commit
ac7517badb
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: 无 TLS 终止的 Ingress Gateway
|
||||
description: 说明了如何为一个 ingress gateway 配置 SNI 透传。
|
||||
description: 如何为一个 Ingress Gateway 配置 SNI 透传。
|
||||
weight: 30
|
||||
keywords: [traffic-management,ingress,https]
|
||||
aliases:
|
||||
|
@ -9,12 +9,9 @@ owner: istio/wg-networking-maintainers
|
|||
test: yes
|
||||
---
|
||||
|
||||
[安全网关](/zh/docs/tasks/traffic-management/ingress/secure-ingress-mount/)说明了如何为 HTTP 服务配置 HTTPS 访问入口。
|
||||
而本示例将说明如何为 HTTPS 服务配置 HTTPS 访问入口,即配置 Ingress Gateway 以执行 SNI 透传,而不是对传入请求进行 TLS 终止。
|
||||
[安全网关](/zh/docs/tasks/traffic-management/ingress/secure-ingress-mount/)说明了如何为 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` 的访问入口。
|
||||
|
||||
## 生成客户端和服务端的证书和密钥{#generate-client-and-server-certificates-and-keys}
|
||||
|
||||
|
@ -45,7 +42,7 @@ test: yes
|
|||
1. 为 NGINX 服务创建一个配置文件:
|
||||
|
||||
{{< text bash >}}
|
||||
$ cat <<EOF > ./nginx.conf
|
||||
$ cat <<\EOF > ./nginx.conf
|
||||
events {
|
||||
}
|
||||
|
||||
|
@ -129,31 +126,27 @@ test: yes
|
|||
EOF
|
||||
{{< /text >}}
|
||||
|
||||
1. 要测试 NGINX 服务是否已成功部署,需要从其 sidecar 代理发送请求,并忽略检查服务端的证书(使用 curl 的 -k 选项)。确保正确打印服务端的证书,即 `common name` 等于 `nginx.example.com`。
|
||||
1. 要测试 NGINX 服务是否已成功部署,需要从其 Sidecar 代理发送请求,并忽略检查服务端的证书(使用 `curl` 的 `-k` 选项)。确保正确打印服务端的证书,即 `common name (CN)` 等于 `nginx.example.com`。
|
||||
|
||||
{{< text bash >}}
|
||||
$ kubectl exec -it $(kubectl get pod -l run=my-nginx -o jsonpath={.items..metadata.name}) -c istio-proxy -- curl -v -k --resolve nginx.example.com:443:127.0.0.1 https://nginx.example.com
|
||||
$ 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
|
||||
...
|
||||
SSL connection using TLS1.2 / ECDHE_RSA_AES_128_GCM_SHA256
|
||||
server certificate verification SKIPPED
|
||||
server certificate status verification SKIPPED
|
||||
common name: nginx.example.com (matched)
|
||||
server certificate expiration date OK
|
||||
server certificate activation date OK
|
||||
certificate public key: RSA
|
||||
certificate version: #3
|
||||
SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
|
||||
ALPN, server accepted to use http/1.1
|
||||
Server certificate:
|
||||
subject: CN=nginx.example.com; O=some organization
|
||||
start date: Wed, 15 Aug 2018 07:29:07 GMT
|
||||
expire date: Sun, 25 Aug 2019 07:29:07 GMT
|
||||
start date: May 27 14:18:47 2020 GMT
|
||||
expire date: May 27 14:18:47 2021 GMT
|
||||
issuer: O=example Inc.; CN=example.com
|
||||
SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
|
||||
|
||||
> GET / HTTP/1.1
|
||||
> User-Agent: curl/7.35.0
|
||||
> User-Agent: curl/7.58.0
|
||||
> Host: nginx.example.com
|
||||
...
|
||||
< HTTP/1.1 200 OK
|
||||
|
||||
< Server: nginx/1.15.2
|
||||
< Server: nginx/1.17.10
|
||||
...
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
@ -162,9 +155,9 @@ test: yes
|
|||
...
|
||||
{{< /text >}}
|
||||
|
||||
## 配置 ingress gateway{#configure-an-ingress-gateway}
|
||||
## 配置 Ingress Gateway{#configure-an-ingress-gateway}
|
||||
|
||||
1. 定义一个 `server` 部分的端口为 443 的 `Gateway`。注意,`PASSTHROUGH tls mode` 指示 gateway 按原样通过入口流量,而不终止 TLS。
|
||||
1. 定义一个 `server` 部分的端口为 443 的 `Gateway`。注意,`PASSTHROUGH tls` TLS 模式,该模式指示 Gateway 以 AS IS 方式传递入口流量,而不终止 TLS。
|
||||
|
||||
{{< text bash >}}
|
||||
$ kubectl apply -f - <<EOF
|
||||
|
@ -187,7 +180,7 @@ test: yes
|
|||
EOF
|
||||
{{< /text >}}
|
||||
|
||||
1. 配置通过 `Gateway` 进入的流量的路由:
|
||||
1. 为通过 `Gateway` 进入的流量配置路由:
|
||||
|
||||
{{< text bash >}}
|
||||
$ kubectl apply -f - <<EOF
|
||||
|
@ -203,7 +196,7 @@ test: yes
|
|||
tls:
|
||||
- match:
|
||||
- port: 443
|
||||
sni_hosts:
|
||||
sniHosts:
|
||||
- nginx.example.com
|
||||
route:
|
||||
- destination:
|
||||
|
@ -213,12 +206,12 @@ 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
|
||||
$ curl -v --resolve "nginx.example.com:$SECURE_INGRESS_PORT:$INGRESS_HOST" --cacert example.com.crt "https://nginx.example.com:$SECURE_INGRESS_PORT"
|
||||
Server certificate:
|
||||
subject: CN=nginx.example.com; O=some organization
|
||||
start date: Wed, 15 Aug 2018 07:29:07 GMT
|
||||
|
|
Loading…
Reference in New Issue