[zh] Sync Ambient new gat stard traffic manage and clean into Chinese (#15221)

* Sync Ambient new gat stard traffic manage and clean into Chinese

* restore en context
This commit is contained in:
Wilson Wu 2024-06-04 10:23:05 +08:00 committed by GitHub
parent 7ffc0031cf
commit a72815513e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 101 additions and 0 deletions

View File

@ -0,0 +1,47 @@
---
title: 清理
description: 删除 Istio 和相关资源。
weight: 6
owner: istio/wg-networking-maintainers
test: yes
---
如果您不再需要 Istio 和相关资源,可以按照本节中的步骤删除它们。
## 删除 Ambient 和 waypoint 标签 {#remove-the-ambient-and-waypoint-labels}
指示 Istio 自动将 `default` 命名空间中的应用程序包含到 Ambient
网格的标签默认情况下不会被删除。如果不再需要,请使用以下命令将其删除:
{{< text bash >}}
$ kubectl label namespace default istio.io/dataplane-mode-
$ kubectl label namespace default istio.io/use-waypoint-
{{< /text >}}
## 删除 waypoint 代理并卸载 Istio {#remove-waypoint-proxies-and-uninstall-istio}
要删除 waypoint 代理、已安装的策略并卸载 Istio请运行以下命令
{{< text bash >}}
$ istioctl x waypoint delete --all
$ istioctl uninstall -y --purge
$ kubectl delete namespace istio-system
{{< /text >}}
## 删除示例应用程序 {#remove-the-sample-application}
要删除 Bookinfo 示例应用程序和 `sleep` 部署,请运行以下命令:
{{< text bash >}}
$ kubectl delete -f {{< github_file >}}/samples/bookinfo/platform/kube/bookinfo.yaml
$ kubectl delete -f {{< github_file >}}/samples/bookinfo/platform/kube/bookinfo-versions.yaml
$ kubectl delete -f {{< github_file >}}/samples/sleep/sleep.yaml
{{< /text >}}
## 删除 Kubernetes Gateway API CRD {#remove-the-kubernetes-gateway-api-crds}
如果您安装了 Gateway API CRD请将其删除
{{< text bash >}}
$ kubectl kustomize "github.com/kubernetes-sigs/gateway-api/config/crd/experimental?ref={{< k8s_gateway_api_version >}}" | kubectl delete -f -
{{< /text >}}

View File

@ -0,0 +1,54 @@
---
title: 管理流量
description: 在 Ambient 模式下管理服务之间的流量。
weight: 5
owner: istio/wg-networking-maintainers
test: yes
---
现在我们已经安装了 waypoint 代理,我们将学习如何在服务之间分割流量。
## 在服务之间分割流量 {#split-traffic-between-services}
Bookinfo 应用程序有三个版本的 `reviews` 服务。
您可以在这些版本之间分配流量以测试新功能或执行 A/B 测试。
让我们配置流量路由,将 90% 的请求发送到 `reviews` v1将 10% 的请求发送到 `reviews` v2
{{< text syntax=bash snip_id=deploy_httproute >}}
$ kubectl apply -f - <<EOF
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: reviews
spec:
parentRefs:
- group: ""
kind: Service
name: reviews
port: 9080
rules:
- backendRefs:
- name: reviews-v1
port: 9080
weight: 90
- name: reviews-v2
port: 9080
weight: 10
EOF
{{< /text >}}
为了确认 100 个请求的流量中大约 10% 流向 `reviews-v2`,您可以运行以下命令:
{{< text syntax=bash snip_id=test_traffic_split >}}
$ kubectl exec deploy/sleep -- sh -c "for i in \$(seq 1 100); do curl -s http://productpage:9080/productpage | grep reviews-v.-; done"
{{< /text >}}
您会注意到大多数请求都发往 `reviews-v1`。如果您在浏览器中打开 Bookinfo 应用程序并多次刷新页面,
则可以确认这一点。请注意,来自 `reviews-v1` 的请求没有任何评星,而来自 `reviews-v2` 的请求有黑色评星。
## 下一步 {#next-steps}
本节总结了 Ambient 模式的入门指南。
您可以继续前往[清理](/zh/docs/ambient/getting-started/cleanup)部分以删除 Istio
或继续探索 [Ambient 模式用户指南](/zh/docs/ambient/usage/)以了解有关 Istio 特性和功能的更多信息。