首页 > 解决方案 > Istio 在端口 80 上没有响应

问题描述

我们最近在我们的集群上设置了 Istio,并且在我们的测试过程中一切正常。我们现在已经使用 Istio,但现在我们的服务没有连接到端口 80;HTTPS 有效,但我们需要将 HTTP 重定向到 HTTPS。

这是我们的 Istio 安装配置:

apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
spec:
  profile: default
  components:
    ingressGateways:
      - enabled: true
        k8s:
          env:
            - name: ISTIO_META_ROUTER_MODE
              value: sni-dnat
          hpaSpec:
            maxReplicas: 5
            metrics:
              - resource:
                  name: cpu
                  targetAverageUtilization: 80
                type: Resource
            minReplicas: 1
            scaleTargetRef:
              apiVersion: apps/v1
              kind: Deployment
              name: istio-ingressgateway
          resources:
            limits:
              cpu: 2000m
              memory: 1024Mi
            requests:
              cpu: 100m
              memory: 128Mi
          service:
            type: LoadBalancer
            externalTrafficPolicy: Local
            ports:
              - name: status-port
                port: 15021
                targetPort: 15021
              - name: http2
                port: 80
                targetPort: 8080
              - name: https
                port: 443
                targetPort: 8443
              - name: tls
                port: 15443
                targetPort: 15443
          strategy:
            rollingUpdate:
              maxSurge: 100%
              maxUnavailable: 25%
        name: istio-ingressgateway

标签: httpkuberneteshttpsistiohsts

解决方案


Service由您的IstioOperatorCR创建的支票怎么样istio-ingressgateway?您创建了Ingress GatewaywithLoadBalancer类型服务。然后你应该为你在yaml中指定的http和https端口配置LB路由规则。

例如,如果您的服务配置了如下所有端口,那么您最好验证 http 端口是否在您的 LB 层侦听或打开。在我的示例中,该LoadBalancer类型与 AWS 集成,并且还使用我指定的所有端口创建了 ELB。逻辑上和其他平台是一样的,只是LB配置是自动化还是需要手动配置。

NAME                          TYPE           CLUSTER-IP       EXTERNAL-IP                          PORT(S)
loadbalancer-ingressgateway   LoadBalancer   172.30.68.12     xxxxxx.ap-northeast-1.elb.amazonaws.com   15021:30053/TCP,80:31829/TCP,443:32661/TCP,15443:30937/TCP

推荐阅读