mirror of https://github.com/istio/istio.io.git
dual-stack blog for Chinese (#12449)
* re-submit pr#10873 * dual-stack blog for Chinese * sync old file * remove CLA failed submit log * fix lint and update dictionary * fix lint error at Line#18 * fix lint * fix MD002 and github_tree lint errors * fix lint errors * fix lint error * fixed github tree lint error according to comments * lint error fixing and update from en blog PR * remove the empty line * fix Trailing spaces error * adjustment for blog * update with the change for PR#12253 * fix lint * sync with the English version PR * update the blog based on the announcement. * sync with the English version blog * sync with the Englisth version * sync with the English version blog for dual stack support * fix based on comment * remove unnessary dict and fix lint error * keep the same format by using the original english version
This commit is contained in:
parent
f7f71bbcca
commit
604109a282
|
@ -0,0 +1,175 @@
|
|||
---
|
||||
title: "支持双栈 Kubernetes 集群"
|
||||
description: "对双栈 Kubernetes 集群的实验性支持。"
|
||||
publishdate: 2023-03-10
|
||||
attribution: "张怀龙 (Intel), 徐贺杰 (Intel), 丁少君 (Intel), Jacob Delgado (F5), 蔡迎春 (前 F5)"
|
||||
keywords: [双栈]
|
||||
---
|
||||
|
||||
在过去的一年里,英特尔和 F5 在为 Istio 提供 [Kubernetes 双栈网络](https://kubernetes.io/docs/concepts/services-networking/dual-stack/)的支持中通力合作。
|
||||
|
||||
## 背景
|
||||
|
||||
对于 Istio 双栈特性支持的工作花费了比预期更长的时间,而我们也还有很多关于双栈的工作需要继续。最初这项工作基于 F5 的设计实现展开,由此我们创建了 [RFC](https://docs.google.com/document/d/1oT6pmRhOw7AtsldU0-HbfA0zA26j9LYiBD_eepeErsQ/edit?usp=sharing) ,值得注意的是,在与社区基于此设计文档展开的讨论中,社区表示对此方案在内存和性能方面存在顾虑,并且希望这些问题能够在 Istio 双栈实现之前解决掉,这也引起了我们对最初设计方案的反思。最初的设计为了支持双栈特性不得不为 listeners, clusters, routes 和 endpoints 增加重复的 Envoy 配置。鉴于许多人已经遇到 Envoy 内存和 CPU 消耗问题,社区早期反馈希望我们完全重新评估我们的方案。而且许多代理透明地处理出站双栈流量,而不管流量是如何产生的,因此许多社区早期的反馈建议是在 Istio 和 Envoy 中实现相同的行为。
|
||||
|
||||
## 重新定义双栈特性的支持
|
||||
|
||||
社区为原始 RFC 提供的大部分反馈是更改 Envoy 以更好地支持双栈用例,在 Envoy 内部而不仅仅是在 Istio 中修改。 我们吸取了经验教训和反馈并将它们应用到简化的设计中,由此我们创建了一个新的 [RFC](https://docs.google.com/document/d/15LP2XHpQ71ODkjCVItGacPgzcn19fsVhyE7ruMGXDyU/edit?usp=sharing)。
|
||||
|
||||
## 双栈特性在 Istio 1.17中的支持
|
||||
|
||||
我们与 Envoy 社区合作解决了众多问题,这也是对 Istio 双栈特性的支持花费了一些时间的原因。 这些问题有: [matched IP Family for outbound listener](https://github.com/envoyproxy/envoy/issues/16804) 和 [supported multiple addresses per listener](https://github.com/envoyproxy/envoy/issues/11184). 其中徐贺杰也一直在积极的帮助解决一些悬而未解的问题,此后 Envoy 就可以以一种更聪明的方式选择 endpoints(参考Issue:[smarter way to pick endpoints for dual-stack](https://github.com/envoyproxy/envoy/issues/21640))。 Envoy 的这些改进,比如 [enable socket options on multiple addresses](https://github.com/envoyproxy/envoy/pull/23496),使得即将到来的 Istio 1.17 中对双栈特性的支持能够落地(Istio 中对应的修改比如: [extra source addresses on inbound clusters](https://github.com/istio/istio/pull/41618))。
|
||||
|
||||
团队所做的关于 Envoy 接口定义更改如下:
|
||||
|
||||
1. [Listener addresses](https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/listener/v3/listener.proto.html?highlight=additional_addresses)
|
||||
1. [bind config](https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/core/v3/address.proto#config-core-v3-bindconfig).
|
||||
|
||||
对于 Istio 双栈特性支持的实现,这些修改是很重要的,它确保我们能够在 Envoy 的下游和上游连接上得到适当的支持。
|
||||
|
||||
团队总共向 Envoy 提交了十多个 PR,其中有多半数的 PR 的目的是使 Envoy 采用双栈时对 Istio 来说更加容易。
|
||||
|
||||
同时,在 Istio 方面,也可以在 [Issue #40394](https://github.com/istio/istio/issues/40394) 中跟踪进度。因为我们在与 Envoy 社区解决各种双栈支持遇到的问题,所以 Istio 社区方面的进展有所放缓。尽管如此,我们很高兴的宣布 Istio 1.17 中实现了对双栈特性的实验性支持!
|
||||
|
||||
## 使用双栈的快速实验
|
||||
|
||||
1. 通过以下方式对 Istio 1.17.0+ 启用双栈实验性支持:
|
||||
|
||||
{{< text bash >}}
|
||||
$ istioctl install -f - <<EOF
|
||||
apiVersion: install.istio.io/v1alpha1
|
||||
kind: IstioOperator
|
||||
spec:
|
||||
meshConfig:
|
||||
defaultConfig:
|
||||
proxyMetadata:
|
||||
ISTIO_AGENT_DUAL_STACK: "true"
|
||||
values:
|
||||
pilot:
|
||||
env:
|
||||
ISTIO_DUAL_STACK: "true"
|
||||
EOF
|
||||
{{< /text >}}
|
||||
|
||||
1. 创建3个命名空间:
|
||||
|
||||
* `dual-stack`: `tcp-echo` will listen on both an IPv4 and IPv6 address.
|
||||
* `ipv4`: `tcp-echo` will listen on only an IPv4 address.
|
||||
* `ipv6`: `tcp-echo` will listen on only an IPv6 address.
|
||||
|
||||
{{< text bash >}}
|
||||
$ kubectl create namespace dual-stack
|
||||
$ kubectl create namespace ipv4
|
||||
$ kubectl create namespace ipv6
|
||||
{{< /text >}}
|
||||
|
||||
1. 在所有这些命名空间以及默认命名空间上启用 sidecar 注入:
|
||||
|
||||
{{< text bash >}}
|
||||
$ kubectl label --overwrite namespace default istio-injection=enabled
|
||||
$ kubectl label --overwrite namespace dual-stack istio-injection=enabled
|
||||
$ kubectl label --overwrite namespace ipv4 istio-injection=enabled
|
||||
$ kubectl label --overwrite namespace ipv6 istio-injection=enabled
|
||||
{{< /text >}}
|
||||
|
||||
1. 在命名空间中创建 `tcp-echo` 部署:
|
||||
|
||||
{{< text bash >}}
|
||||
$ kubectl apply --namespace dual-stack -f {{< github_file >}}/samples/tcp-echo/tcp-echo-dual-stack.yaml
|
||||
$ kubectl apply --namespace ipv4 -f {{< github_file >}}/samples/tcp-echo/tcp-echo-ipv4.yaml
|
||||
$ kubectl apply --namespace ipv6 -f {{< github_file >}}/samples/tcp-echo/tcp-echo-ipv6.yaml
|
||||
{{< /text >}}
|
||||
|
||||
1. 在默认命名空间中创建 `sleep` 部署:
|
||||
|
||||
{{< text bash >}}
|
||||
$ kubectl apply -f {{< github_file >}}/master/samples/sleep/sleep.yaml
|
||||
{{< /text >}}
|
||||
|
||||
1. 流量校验:
|
||||
|
||||
{{< text bash >}}
|
||||
$ kubectl exec -it "$(kubectl get pod -l app=sleep -o jsonpath='{.items[0].metadata.name}')" -- sh -c "echo dualstack | nc tcp-echo 9000"
|
||||
hello dualstack
|
||||
$ kubectl exec -it "$(kubectl get pod -l app=sleep -o jsonpath='{.items[0].metadata.name}')" -- sh -c "echo ipv4 | nc tcp-echo.ipv4 9000"
|
||||
hello ipv4
|
||||
$ kubectl exec -it "$(kubectl get pod -l app=sleep -o jsonpath='{.items[0].metadata.name}')" -- sh -c "echo ipv6 | nc tcp-echo.ipv6 9000"
|
||||
hello ipv6
|
||||
{{< /text >}}
|
||||
|
||||
现在您可以在您的环境中试验双栈服务!
|
||||
|
||||
## 监听器和端点的重要变化
|
||||
|
||||
对于上述实验,您会注意到监听器和路由发生了变化:
|
||||
|
||||
{{< text bash >}}
|
||||
$ istioctl proxy-config listeners "$(kubectl get pod -n dual-stack -l app=tcp-echo -o jsonpath='{.items[0].metadata.name}')" -n dual-stack --port 9000
|
||||
{{< /text >}}
|
||||
|
||||
您会看到侦听器现在绑定到多个地址,但仅限于双栈服务。其他服务只会监听单个 IP 地址。
|
||||
|
||||
{{< text json >}}
|
||||
"name": "fd00:10:96::f9fc_9000",
|
||||
"address": {
|
||||
"socketAddress": {
|
||||
"address": "fd00:10:96::f9fc",
|
||||
"portValue": 9000
|
||||
}
|
||||
},
|
||||
"additionalAddresses": [
|
||||
{
|
||||
"address": {
|
||||
"socketAddress": {
|
||||
"address": "10.96.106.11",
|
||||
"portValue": 9000
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
{{< /text >}}
|
||||
|
||||
虚拟入站地址现在也被配置为侦听 `0.0.0.0` 和 `[::]`。
|
||||
|
||||
{{< text json >}}
|
||||
"name": "virtualInbound",
|
||||
"address": {
|
||||
"socketAddress": {
|
||||
"address": "0.0.0.0",
|
||||
"portValue": 15006
|
||||
}
|
||||
},
|
||||
"additionalAddresses": [
|
||||
{
|
||||
"address": {
|
||||
"socketAddress": {
|
||||
"address": "::",
|
||||
"portValue": 15006
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
{{< /text >}}
|
||||
|
||||
Envoy 的 endpoints 现在配置为路由到 IPv4 和 IPv6:
|
||||
|
||||
{{< text bash >}}
|
||||
$ istioctl proxy-config endpoints "$(kubectl get pod -n sleep -l app=tcp-echo -o jsonpath='{.items[0].metadata.name}')" --port 9000
|
||||
ENDPOINT STATUS OUTLIER CHECK CLUSTER
|
||||
10.244.0.19:9000 HEALTHY OK outbound|9000||tcp-echo.ipv4.svc.cluster.local
|
||||
10.244.0.26:9000 HEALTHY OK outbound|9000||tcp-echo.dual-stack.svc.cluster.local
|
||||
fd00:10:244::1a:9000 HEALTHY OK outbound|9000||tcp-echo.dual-stack.svc.cluster.local
|
||||
fd00:10:244::18:9000 HEALTHY OK outbound|9000||tcp-echo.ipv6.svc.cluster.local
|
||||
{{< /text >}}
|
||||
|
||||
## 参与其中
|
||||
|
||||
还有很多工作要做,欢迎各位与我们一起完成双栈特性到达 Alpha 状态所需的其他任务。 [详情请看这里](https://github.com/istio/enhancements/pull/141)
|
||||
比如,来自英特尔的丁少君和李纯已经就 ambient 的网络流量重定向功能与社区一起展开工作。我们希望在后面的 Istio 1.18 alpha 双栈特性的版本中,ambient 也能够支持双栈特性。
|
||||
|
||||
我们非常乐意你提出宝贵意见,如果你期待与我们合作请访问我们在 [Istio Slack](https://slack.istio.io/) 中的 Slack 频道 **#dual-stack-support**。
|
||||
|
||||
_感谢为 Istio 双栈特性工作的团队!_
|
||||
* 英特尔: [张怀龙](https://github.com/zhlsunshine), [徐贺杰](https://github.com/soulxu), [丁少君](https://github.com/irisdingbj)
|
||||
* F5: [Jacob Delgado](https://github.com/jacob-delgado)
|
||||
* [蔡迎春](https://github.com/ycai-aspen) (前 F5 员工)
|
Loading…
Reference in New Issue