如何使用IstioOperator将外部IP分配给Istio Ingress网关? [GKE]

时间:2020-06-18 17:13:18

标签: istio

我想为Istio的Ingress网关分配一个外部IP。

我想使用Istio操作员规范。 到目前为止,我明白了:

apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
metadata:
  namespace: istio-system
  name: istiocontrolplane
spec:
  profile: demo
  components:
    ingressGateways:
    - name: istio-ingressgateway
      enabled: true
      loadBalancerIP: 1.2.3.4
  addonComponents:
    grafana:
      enabled: false
    prometheus:
      enabled: true

正在为服务自动分配IP:

kubectl get svc -n istio-system

未显示1.2.3.4。用于EXTERNAL-IP

只有在我真正拥有基于GCP的IP的情况下,这才可能吗?

1 个答案:

答案 0 :(得分:2)

首先,您必须在GCP中创建IP资源,然后在下面的Yaml中提供该IP。

apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
spec:
  components:
    ingressGateways:
      - enabled: true
        k8s:
          overlays:
            - api_version: autoscaling/v1
              kind: HorizontalPodAutoscaler
              name: istio-ingressgateway
              patches:
                - path: spec.minReplicas
                  value: 3
                - path: spec.maxReplicas
                  value: 5
                - path: spec.metrics[0].resource.targetAverageUtilization
                  value: 60
          service:
            loadBalancerIP: XXX.XXX.XXX.XXX
            loadBalancerSourceRanges: []
            ports:
              - name: status-port
                port: 15020
                targetPort: 15020
              - name: http2
                port: 80
                targetPort: 80
              - name: https
                port: 443
              - name: tcp
                port: 31400
                targetPort: 31400
              - name: tls
                port: 15443
                targetPort: 15443
        label:
          app: istio-ingressgateway
          istio: ingressgateway
        name: istio-ingressgateway