我正在将istio部署在Azure kubernetes服务(AKS)中,并且有以下问题:
是否可以使用内部负载平衡器部署istio。默认情况下,它似乎已使用公共负载平衡器部署在Azure中。我需要进行哪些更改才能使其使用内部负载平衡器?
答案 0 :(得分:0)
回答第二个问题:
可以根据AKS documentation为内部负载均衡器添加AKS注释:
要创建内部负载均衡器,请创建名为
internal-lb.yaml
的服务清单,其服务类型为 LoadBalancer 和azure-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
因此,您可以通过将helm与以下--set一起使用来设置此批注:
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
如评论中所述,您应按照here的建议坚持每个帖子一个问题。因此,我建议创建其他问题的第二篇文章。
希望有帮助。
更新:
对于istioctl,您可以执行以下操作:
istioctl manifest generate --set profile=demo > istio.yaml
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:
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"
希望有帮助。