Azure

跟随这些指令来为 Istio 准备一个 Azure 集群。

您可以通过完全支持 Istio 的 AKS 或者 AKS-Engine,部署一个 Kubernetes 集群到 Azure 上。

AKS

您可以通过 the az cli 或者 the Azure portal 创建一个 AKS 集群。

对于 az cli 的选项,完成 az login 认证或者使用 cloud shell,然后运行下面的命令。

  1. 确定支持 AKS 的期望 region 名

    1. $ az provider list --query "[?namespace=='Microsoft.ContainerService'].resourceTypes[] | [?resourceType=='managedClusters'].locations[]" -o tsv
  2. 验证期望的 region 支持的 Kubernetes 版本

    使用从上面步骤中期望的 region 值替换 my location,然后执行:

    1. $ az aks get-versions --location "my location" --query "orchestrators[].orchestratorVersion"

    确保最小值 1.10.5 被列出。

  3. 创建 resource group 和部署 AKS 集群

    使用期望的名字替换 myResourceGroupmyAKSCluster,使用第一步中的名字替换 mylocation,替换 1.10.5 如果其在 region 中不被支持,然后执行:

    1. $ az group create --name myResourceGroup --location "my location"
    2. $ az aks create --resource-group myResourceGroup --name myAKSCluster --node-count 3 --kubernetes-version 1.10.5 --generate-ssh-keys
  4. 取得 AKS kubeconfig 证书

    使用从之前步骤中获得的名字替换 myResourceGroupmyAKSCluster 并且执行:

    1. $ az aks get-credentials --resource-group myResourceGroup --name myAKSCluster

AKS-Engine

  1. 跟随这些命令来获取和安装 aks-engine 的二进制版本。

  2. 下载支持部署 Istio 的 aks-engine API 模型定义:

    1. $ wget https://raw.githubusercontent.com/Azure/aks-engine/master/examples/service-mesh/istio.json

    注意:可以使用其他将与 Istio 一起工作的 api 模型定义。默认情况下,MutatingAdmissionWebhook 和 ValidatingAdmissionWebhook 准入控制标识和 RBAC 会被启用。参阅 aks-engine api 模型默认值获取更多信息。

  3. 使用 istio.json 模板来部署您的集群。您能在官方文档中找到对参数的参考。

    参数期望值
    subscription_idAzure Subscription Id
    dns_prefix集群 DNS 前缀
    location集群位置
    1. $ aks-engine deploy --subscription-id <subscription_id> \
    2. --dns-prefix <dns_prefix> --location <location> --auto-suffix \
    3. --api-model istio.json

    几分钟之后,您能在名为 <dns_prefix>-<id>的 Azure subscription 的资源组中找到您的集群。 假设 dns_prefix 有这样的值 myclustername,一个有效的资源组具有唯一集群 ID 为 mycluster-5adfba82aks-engine_output 文件夹中生成您的 kubeconfig 文件。

  4. 使用 <dns_prefix>-<id> 集群 ID,将 kubeconfig_output 文件夹复制到您的机器:

    1. $ cp _output/<dns_prefix>-<id>/kubeconfig/kubeconfig.<location>.json \
    2. ~/.kube/config

    比如:

    1. $ cp _output/mycluster-5adfba82/kubeconfig/kubeconfig.westus2.json \
    2. ~/.kube/config