Azure
跟随以下操作说明来为 Istio 准备一个 Azure 集群。
您可以通过完全支持 Istio 的 AKS 或者自托管 Kubernetes 或 AKS 所用的 Azure 集群 API 提供程序(CAPZ)部署一个 Kubernetes 集群到 Azure 上。
AKS
您可以通过多种方式创建 AKS 群集,例如 az cli、 Azure 门户、 az cli with Bicep 或 Terraform。
对于 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 集群。
使用第 1 步中得到的
mylocation
名称替换myResourceGroup
和myAKSCluster
; 如果该 region 不支持Kubernetes 1.28.3
,则执行:$ az group create --name myResourceGroup --location "my location" $ az aks create --resource-group myResourceGroup --name myAKSCluster --node-count 3 --kubernetes-version 1.28.3 --generate-ssh-keys
取得 AKS
kubeconfig
证书。使用从之前步骤中获得的名称替换
myResourceGroup
和myAKSCluster
后执行:$ az aks get-credentials --resource-group myResourceGroup --name myAKSCluster
在 Azure 中使用 Gateway API
如果您将 Gateway API 与 AKS 一起使用,则可能还需要将以下配置添加到 Gateway
资源:
infrastructure:
annotations:
service.beta.kubernetes.io/port_<http[s] port>_health-probe_protocol: tcp
其中,<http[s] port>
是 HTTP(S) 侦听器的端口号。如果您有多个 HTTP(S) 侦听器,
则需要为每个侦听器添加注解。当 /
路径未响应 200 时,此注解是 Azure 负载均衡器运行状况检查正常运行所必需的。
例如,如果您按照 Ingress Gateway
示例使用 Gateway API,则需要部署以下 Gateway
:
$ kubectl apply -f - <<EOF
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: httpbin-gateway
spec:
infrastructure:
annotations:
service.beta.kubernetes.io/port_80_health-probe_protocol: tcp
gatewayClassName: istio
listeners:
- name: http
hostname: "httpbin.example.com"
port: 80
protocol: HTTP
allowedRoutes:
namespaces:
from: Same
EOF