首页 > 解决方案 > 使用 AzureAD 和 istio 内部负载均衡器进行 Grafana、Prometheus、Kiali 身份验证

问题描述

我在 azure kubernetes 服务 (AKS) 中部署 istio,我有以下问题:

是否可以使用内部负载均衡器部署 istio。看起来它默认部署在 Azure 中并带有公共负载均衡器。我需要进行哪些更改才能使其使用内部负载均衡器?

标签: azureprometheusgrafanaistio

解决方案


回答第二个问题:

可以根据 AKS文档为内部负载均衡器添加 AKS 注释:

要创建内部负载均衡器,请创建一个以internal-lb.yaml服务类型LoadBalancerazure-load-balancer-internal注解命名的服务清单,如以下示例所示:

apiVersion: v1
kind: Service
metadata:
  name: internal-app
  annotations:
    service.beta.kubernetes.io/azure-load-balancer-internal: "true"
spec:
  type: LoadBalancer
  ports:
  - port: 80
  selector:
    app: internal-app

因此,您可以通过使用带有以下 --set 的 helm 来设置此注释:

helm template install/kubernetes/helm/istio --name istio --namespace istio-system --set gateways.istio-ingressgateway.serviceAnnotations.'service\.beta\.kubernetes\.io/azure-load-balancer-internal'="true" > aks-istio.yaml

如评论中所述,您应该按照此处的建议坚持每个帖子一个问题。所以我建议用其他问题创建第二个帖子。

希望能帮助到你。


更新:

对于 istioctl 您可以执行以下操作:

  1. 为您的 istio 部署生成清单文件,我使用了演示配置文件。
istioctl manifest generate --set profile=demo > istio.yaml
  1. 修改istio.yaml并搜索文本type: LoadBalancer
---


apiVersion: v1
kind: Service
metadata:
  name: istio-ingressgateway
  namespace: istio-system
  annotations:
  labels:
    app: istio-ingressgateway
    release: istio
    istio: ingressgateway
spec:
  type: LoadBalancer
  selector:
    app: istio-ingressgateway
  ports:

像这样为内部负载均衡器添加注释:

---


apiVersion: v1
kind: Service
metadata:
  name: istio-ingressgateway
  namespace: istio-system
  annotations:
    service.beta.kubernetes.io/azure-load-balancer-internal: "true"
  labels:
    app: istio-ingressgateway
    release: istio
    istio: ingressgateway
spec:
  type: LoadBalancer
  selector:
    app: istio-ingressgateway
  ports:
  1. 保存更改后,使用以下命令将修改后的部署istio.yaml到您的 K8s 集群:
kubectl apply -f istio.yaml

之后,您可以验证注释是否存在于istio-ingressgateway service.

$ kubectl get svc istio-ingressgateway -n istio-system -o yaml
apiVersion: v1
kind: Service
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"v1","kind":"Service","metadata":{"annotations":{"service.beta.kubernetes.io/azure-load-balancer-internal":"true"},"labels":{"app":"istio-ingressgateway","istio":"ingressgateway","release":"istio"},"name":"istio-ingressgateway","namespace":"istio-system"},"spec":{"ports":[{"name":"status-port","port":15020,"targetPort":15020},{"name":"http2","port":80,"targetPort":80},{"name":"https","port":443},{"name":"kiali","port":15029,"targetPort":15029},{"name":"prometheus","port":15030,"targetPort":15030},{"name":"grafana","port":15031,"targetPort":15031},{"name":"tracing","port":15032,"targetPort":15032},{"name":"tls","port":15443,"targetPort":15443}],"selector":{"app":"istio-ingressgateway"},"type":"LoadBalancer"}}
    service.beta.kubernetes.io/azure-load-balancer-internal: "true"
  creationTimestamp: "2020-01-27T13:51:07Z"

希望能帮助到你。


推荐阅读