[zh] sync platform-setup/azure and openshift (#13147)

* [zh] sync /setup/platform-setup/azure/

* apply suggestion from wilsonwu
This commit is contained in:
Michael 2023-05-05 16:39:12 +08:00 committed by GitHub
parent 4f89936282
commit d6ebfab9dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 52 additions and 49 deletions

View File

@ -1,11 +1,11 @@
---
title: Azure
description: 为 Istio 设置一个 Azure 集群的操作说明。
weight: 9
weight: 10
skip_seealso: true
aliases:
- /zh/docs/setup/kubernetes/prepare/platform-setup/azure/
- /zh/docs/setup/kubernetes/platform-setup/azure/
- /zh/docs/setup/kubernetes/prepare/platform-setup/azure/
- /zh/docs/setup/kubernetes/platform-setup/azure/
keywords: [platform-setup,azure]
owner: istio/wg-environments-maintainers
test: no
@ -13,13 +13,22 @@ test: no
跟随以下操作说明来为 Istio 准备一个 Azure 集群。
您可以通过完全支持 Istio 的 [AKS](https://azure.microsoft.com/zh-cn/services/kubernetes-service/) 或者 [AKS-Engine](https://github.com/azure/aks-engine),部署一个 Kubernetes 集群到 Azure 上。
{{< tip >}}
Azure 为 Azure Kubernetes Service (AKS) 提供了
{{< gloss >}}managed control plane{{< /gloss >}}(托管控制面)加载项,
您可以用其代替 Istio 的手动安装。有关细节和教程请参阅
[为 Azure Kubernetes Service 部署基于 Istio 的服务网格加载项](https://learn.microsoft.com/zh-cn/azure/aks/istio-deploy-addon)。
{{< /tip >}}
您可以通过完全支持 Istio 的 [AKS](https://azure.microsoft.com/zh-cn/services/kubernetes-service/)
或者 [AKS-Engine](https://github.com/azure/aks-engine),部署一个 Kubernetes 集群到 Azure 上。
## AKS
您可以通过 [Azure CLI](https://docs.microsoft.com/zh-cn/azure/aks/learn/quick-kubernetes-deploy-cli) 或者 [Azure 门户](https://docs.microsoft.com/zh-cn/azure/aks/learn/quick-kubernetes-deploy-portal)创建一个 AKS 集群。
您可以通过 [Azure CLI](https://learn.microsoft.com/zh-cn/azure/aks/learn/quick-kubernetes-deploy-cli)
或者 [Azure 门户](https://docs.microsoft.com/zh-cn/azure/aks/learn/quick-kubernetes-deploy-portal)创建一个 AKS 集群。
对于 `az` cli 的选项,完成 `az login` 认证或者使用 cloud shell然后运行下面的命令。
对于 `az` cli 的选项,完成 `az login` 认证,或者使用 cloud shell 运行下面的命令。
1. 确定支持 AKS 的目标 region 名称。
@ -35,11 +44,14 @@ test: no
$ az aks get-versions --location "my location" --query "orchestrators[].orchestratorVersion"
{{< /text >}}
确保最小值 `1.10.5` 被列出。
{{< warning >}}
在更新本文档之时,支持的 AKS Kubernetes 最低版本为 1.24.9
{{< /warning >}}
1. 创建资源组并部署 AKS 集群。
使用第 1 步中得到的 `mylocation` 名称替换 `myResourceGroup``myAKSCluster`;如果该 region 不支持 `Kubernetes 1.10.5`,则执行:
使用第 1 步中得到的 `mylocation` 名称替换 `myResourceGroup``myAKSCluster`
如果该 region 不支持 `Kubernetes 1.10.5`,则执行:
{{< text bash >}}
$ az group create --name myResourceGroup --location "my location"
@ -48,7 +60,7 @@ test: no
1. 取得 AKS `kubeconfig` 证书。
使用从之前步骤中获得的名称替换 `myResourceGroup``myAKSCluster` 并且执行:
使用从之前步骤中获得的名称替换 `myResourceGroup``myAKSCluster` 执行:
{{< text bash >}}
$ az aks get-credentials --resource-group myResourceGroup --name myAKSCluster
@ -56,6 +68,12 @@ test: no
## AKS-Engine
{{< warning >}}
针对 Azure 公有云客户的 AKS Engine 项目已被弃用。
对于托管的 Kubernetes请考虑使用[附带 Istio 加载项的 Azure Kubernetes Service (AKS)](https://learn.microsoft.com/zh-cn/azure/aks/istio-about)
对于自我管理的 Kubernetes请考虑使用 [Cluster API Provider Azure](https://github.com/kubernetes-sigs/cluster-api-provider-azure)。
{{< /warning >}}
1. [跟随这些操作说明](https://github.com/Azure/aks-engine/blob/master/docs/tutorials/quickstart.md#install-aks-engine)来获取并安装 `aks-engine` 的二进制版本。
1. 下载支持部署 Istio 的 `aks-engine` API 模型定义:
@ -64,13 +82,16 @@ test: no
$ wget https://raw.githubusercontent.com/Azure/aks-engine/master/examples/service-mesh/istio.json
{{< /text >}}
注意:可以使用其他将与 Istio 一起工作的 API 模型定义。默认情况下MutatingAdmissionWebhook 和 ValidatingAdmissionWebhook 准入控制标识和 RBAC 会被启用。参阅 [aks-engine api 模型默认值](https://github.com/Azure/aks-engine/blob/master/docs/topics/clusterdefinitions.md)获取更多信息。
注意:可以使用其他将与 Istio 一起工作的 API 模型定义。默认情况下,
`MutatingAdmissionWebhook``ValidatingAdmissionWebhook` 准入控制标识和 RBAC 会被启用。
参阅 [aks-engine api 模型默认值](https://github.com/Azure/aks-engine/blob/master/docs/topics/clusterdefinitions.md)获取更多信息。
1. 使用 `istio.json` 模板来部署您的集群。您能在[官方文档](https://github.com/Azure/aks-engine/blob/master/docs/topics/creating_new_clusters.md#deploy)中找到有关参数的参考。
1. 使用 `istio.json` 模板来部署您的集群。
您能在[官方文档](https://github.com/Azure/aks-engine/blob/master/docs/topics/creating_new_clusters.md#deploy)中找到有关参数的参考。
| 参数 | 期望值 |
|---------------------------------------|----------------------------|
| `subscription_id` | Azure Subscription Id |
| `subscription_id` | Azure 订阅 ID |
| `dns_prefix` | 集群 DNS 前缀 |
| `location` | 集群位置 |
@ -81,21 +102,21 @@ test: no
{{< /text >}}
{{< tip >}}
几分钟之后,您能在名为 `<dns_prefix>-<id>`的 Azure subscription 的资源组中找到您的集群。
假设 `dns_prefix` 有这样的值 `myclustername`,一个有效的资源组具有唯一集群 ID 为 `mycluster-5adfba82` `aks-engine` 在 `_output` 文件夹中生成您的 `kubeconfig`
文件。
几分钟之后,您能在名为 `<dns_prefix>-<id>` 的 Azure subscription 的资源组中找到您的集群。
假设 `dns_prefix` 有这样的值 `myclustername`,一个有效的资源组具有唯一集群 ID 为 `mycluster-5adfba82`
`aks-engine``_output` 文件夹中生成您的 `kubeconfig` 文件。
{{< /tip >}}
1. 使用 `<dns_prefix>-<id>` 集群 ID`kubeconfig``_output` 文件夹复制到您的机器:
{{< text bash >}}
$ cp _output/<dns_prefix>-<id>/kubeconfig/kubeconfig.<location>.json \
~/.kube/config
$ cp \_output/<dns_prefix>-<id>/kubeconfig/kubeconfig.<location>.json \
~/.kube/config
{{< /text >}}
比如:
{{< text bash >}}
$ cp _output/mycluster-5adfba82/kubeconfig/kubeconfig.westus2.json \
~/.kube/config
$ cp \_output/mycluster-5adfba82/kubeconfig/kubeconfig.westus2.json \
~/.kube/config
{{< /text >}}

View File

@ -1,7 +1,7 @@
---
title: kind
description: 为 Istio 设置 kind 的说明。
weight: 17
weight: 30
skip_seealso: true
keywords: [platform-setup,kubernetes,kind]
owner: istio/wg-environments-maintainers
@ -50,8 +50,8 @@ kind 主要是为了测试 Kubernetes 自身而设计的,但它也可用于本
{{< /tip >}}
1. 如果运行了多套集群,还需要选择 `kubectl` 将要操作哪一套。
可以在 [Kubernetes kubeconfig](https://kubernetes.io/zh-cn/docs/concepts/configuration/organize-cluster-access-kubeconfig/) 文件中设置当前环境来指定一个默认集群。
另外,还可以运行下列命令来为 `kubectl` 设置当前环境:
可以在 [Kubernetes kubeconfig](https://kubernetes.io/zh-cn/docs/concepts/configuration/organize-cluster-access-kubeconfig/)
文件中设置当前环境来指定一个默认集群。另外,还可以运行下列命令来为 `kubectl` 设置当前环境:
{{< text bash >}}
$ kubectl config use-context kind-istio-testing
@ -113,7 +113,7 @@ kind 不像 minikube 一样内置了操作界面。但仍然可以设置一个
Starting to serve on 127.0.0.1:8001
{{< /text >}}
点击 [Kubernetes Dashboard](http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/) 来查看部署和服务
点击 [Kubernetes Dashboard](http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/) 来查看您的 Deployment 和 Service
{{< warning >}}
最好将 token 保存起来,不然每次登录到操作界面需要 token 时都得重新运行上述步骤 4.

View File

@ -4,8 +4,8 @@ description: 在 OpenShift 集群上快速搭建 Istio 服务。
weight: 55
skip_seealso: true
aliases:
- /zh/docs/setup/kubernetes/prepare/platform-setup/openshift/
- /zh/docs/setup/kubernetes/platform-setup/openshift/
- /zh/docs/setup/kubernetes/prepare/platform-setup/openshift/
- /zh/docs/setup/kubernetes/platform-setup/openshift/
keywords: [platform-setup,openshift]
owner: istio/wg-environments-maintainers
test: no
@ -13,7 +13,9 @@ test: no
根据以下操作指南 为 Istio 准备一个 OpenShift 集群。
默认情况下OpenShift 不允许容器使用 User IDUID1337 来运行。通过以下命令可以让 Istio 的服务账户Service Accounts以 UID 1337 来运行容器(如果您将 Istio 部署到其它 Namespace请注意替换 `istio-system`
默认情况下OpenShift 不允许容器使用 User IDUID1337 来运行。通过以下命令可以让 Istio
的服务账户Service Account以 UID 1337 来运行容器(如果您将 Istio 部署到其它 Namespace
请注意替换 `istio-system`
{{< text bash >}}
$ oc adm policy add-scc-to-group anyuid system:serviceaccounts:istio-system
@ -31,37 +33,17 @@ $ istioctl install --set profile=openshift
$ oc -n istio-system expose svc/istio-ingressgateway --port=http2
{{< /text >}}
## Sidecar 应用的专用安全上下文约束SCC{#privileged-security-context-constraints-for-application-sidecars}
## Sidecar 应用的安全上下文约束SCC{#security-context-constraints-for-application-sidecars}
OpenShift 默认是不允许 Istio Sidecar 注入到每个应用 Pod 中以用户 ID 为 1377 来运行的。要允许使用该 UID 运行,需要执行以下命令(注意替换 `<target-namespace>` 为适当的 Namespace
OpenShift 默认是不允许 Istio Sidecar 注入到每个应用 Pod 中以用户 ID 为 1377 来运行的。
要允许使用该 UID 运行,需要执行以下命令(注意替换 `<target-namespace>` 为适当的 Namespace
{{< text bash >}}
$ oc adm policy add-scc-to-group privileged system:serviceaccounts:<target-namespace>
$ oc adm policy add-scc-to-group anyuid system:serviceaccounts:<target-namespace>
{{< /text >}}
当需要移除应用时,请按以下操作移除权限:
{{< text bash >}}
$ oc adm policy remove-scc-from-group privileged system:serviceaccounts:<target-namespace>
$ oc adm policy remove-scc-from-group anyuid system:serviceaccounts:<target-namespace>
{{< /text >}}
## 应用 Namespace 的其他要求{#additional-requirements-for-the-application-namespace}
OpenShift 上的 CNI 由 `Multus` 管理,如要使用 `istio-cni`,需要应用 Namespace 中配置 `NetworkAttachmentDefinition`。执行以下命令,将 `<target-namespace>` 替换为相应的 Namespace
{{< text bash >}}
$ cat <<EOF | oc -n <target-namespace> create -f -
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: istio-cni
EOF
{{< /text >}}
当需要移除应用时,请按以下操作移除 `NetworkAttachmentDefinition`
{{< text bash >}}
$ oc -n <target-namespace> delete network-attachment-definition istio-cni
{{< /text >}}