Azure
跟随以下操作说明来为 Istio 准备一个 Azure 集群。
Azure 为 Azure Kubernetes Service (AKS) 提供了 managed control plane(托管控制面)加载项, 您可以用其代替 Istio 的手动安装。有关细节和教程请参阅 为 Azure Kubernetes Service 部署基于 Istio 的服务网格加载项。
您可以通过完全支持 Istio 的 AKS 或者 AKS-Engine,部署一个 Kubernetes 集群到 Azure 上。
AKS
您可以通过 Azure CLI 或者 Azure 门户创建一个 AKS 集群。
对于 az
cli 的选项,完成 az login
认证,或者使用 cloud shell 运行下面的命令。
确定支持 AKS 的目标 region 名称。
$ az provider list --query "[?namespace=='Microsoft.ContainerService'].resourceTypes[] | [?resourceType=='managedClusters'].locations[]" -o tsv
验证目标 region 所支持的 Kubernetes 版本。
使用上一步中的目标 region 值替换
my location
,然后执行:$ az aks get-versions --location "my location" --query "orchestrators[].orchestratorVersion"
在更新本文档之时,支持的 AKS Kubernetes 最低版本为 1.24.9
创建资源组并部署 AKS 集群。
使用第 1 步中得到的
mylocation
名称替换myResourceGroup
和myAKSCluster
; 如果该 region 不支持Kubernetes 1.10.5
,则执行:$ az group create --name myResourceGroup --location "my location"
$ az aks create --resource-group myResourceGroup --name myAKSCluster --node-count 3 --kubernetes-version 1.10.5 --generate-ssh-keys
取得 AKS
kubeconfig
证书。使用从之前步骤中获得的名称替换
myResourceGroup
和myAKSCluster
后执行:$ az aks get-credentials --resource-group myResourceGroup --name myAKSCluster
AKS-Engine
针对 Azure 公有云客户的 AKS Engine 项目已被弃用。 对于托管的 Kubernetes,请考虑使用附带 Istio 加载项的 Azure Kubernetes Service (AKS); 对于自我管理的 Kubernetes,请考虑使用 Cluster API Provider Azure。
跟随这些操作说明来获取并安装
aks-engine
的二进制版本。下载支持部署 Istio 的
aks-engine
API 模型定义:$ wget https://raw.githubusercontent.com/Azure/aks-engine/master/examples/service-mesh/istio.json
注意:可以使用其他将与 Istio 一起工作的 API 模型定义。默认情况下,
MutatingAdmissionWebhook
和ValidatingAdmissionWebhook
准入控制标识和 RBAC 会被启用。 参阅 aks-engine api 模型默认值获取更多信息。使用
istio.json
模板来部署您的集群。 您能在官方文档中找到有关参数的参考。参数 期望值 subscription_id
Azure 订阅 ID dns_prefix
集群 DNS 前缀 location
集群位置 $ aks-engine deploy --subscription-id <subscription_id> \
--dns-prefix <dns_prefix> --location <location> --auto-suffix \
--api-model istio.json
几分钟之后,您能在名为
<dns_prefix>-<id>
的 Azure subscription 的资源组中找到您的集群。 假设dns_prefix
有这样的值myclustername
,一个有效的资源组具有唯一集群 ID 为mycluster-5adfba82
。aks-engine
在_output
文件夹中生成您的kubeconfig
文件。使用
<dns_prefix>-<id>
集群 ID,将kubeconfig
从_output
文件夹复制到您的机器:$ cp \_output/<dns_prefix>-<id>/kubeconfig/kubeconfig.<location>.json \
~/.kube/config
比如:
$ cp \_output/mycluster-5adfba82/kubeconfig/kubeconfig.westus2.json \
~/.kube/config