IstIO egress gateway gives HTTP 503 error

后端 未结 1 1882
情歌与酒
情歌与酒 2021-01-16 09:44

I have the following manifest for deploying a IstIO egress gateway routing:

---
apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
  name:         


        
相关标签:
1条回答
  • 2021-01-16 10:05

    There were few errors in Your deployment manifest like DestinationRule was not pointing at Your ServiceEntry.

    You can try to match Yours with these manifest files:

    apiVersion: networking.istio.io/v1alpha3
    kind: ServiceEntry
    metadata:
      name: etth
    spec:
      hosts:
      - etth.pl
      ports:
      - number: 8080
        name: http-port
        protocol: HTTP
      resolution: DNS
    
    apiVersion: networking.istio.io/v1alpha3
    kind: Gateway
    metadata:
      name: istio-egressgateway
    spec:
      selector:
        istio: egressgateway
      servers:
      - port:
          number: 80
          name: http
          protocol: HTTP
        hosts:
        - etth.pl
    ---
    apiVersion: networking.istio.io/v1alpha3
    kind: DestinationRule
    metadata:
      name: egressgateway-for-cnn
    spec:
      host: istio-egressgateway.istio-system.svc.cluster.local
      subsets:
      - name: etth
    
    apiVersion: networking.istio.io/v1alpha3
    kind: VirtualService
    metadata:
      name: direct-cnn-through-egress-gateway
    spec:
      hosts:
      - etth.pl
      gateways:
      - istio-egressgateway
      - mesh
      http:
      - match:
        - gateways:
          - mesh
          port: 80
        route:
        - destination:
            host: istio-egressgateway.istio-system.svc.cluster.local
            subset: etth
            port:
              number: 80
          weight: 100
      - match:
        - gateways:
          - istio-egressgateway
          port: 80
        route:
        - destination:
            host: etth.pl
            port:
              number: 8080
          weight: 100
    

    You can check if routes are present in: istioctl pc routes $(kubectl get pods -l istio=egressgateway -o jsonpath='{.items[0].metadata.name}' -n istio-system).istio-system -o json

    $ istioctl pc routes $(kubectl get pods -l istio=egressgateway -o jsonpath='{.items[0].metadata.name}' -n istio-system).istio-system -o json
    [
        {
            "name": "http.80",
            "virtualHosts": [
                {
                    "name": "etth.pl:80",
                    "domains": [
                        "etth.pl",
                        "etth.pl:80"
                    ],
                    "routes": [
                        {
                            "match": {
                                "prefix": "/",
                                "caseSensitive": true
                            },
                            "route": {
                                "cluster": "outbound|8080||etth.pl",
                                "timeout": "0s",
                                "retryPolicy": {
                                    "retryOn": "connect-failure,refused-stream,unavailable,cancelled,resource-exhausted,retriable-status-codes",
                                    "numRetries": 2,
                                    "retryHostPredicate": [
                                        {
                                            "name": "envoy.retry_host_predicates.previous_hosts"
                                        }
                                    ],
                                    "hostSelectionRetryMaxAttempts": "5",
                                    "retriableStatusCodes": [
                                        503
                                    ]
                                },
                                "maxGrpcTimeout": "0s"
                            },
                            "metadata": {
                                "filterMetadata": {
                                    "istio": {
                                        "config": "/apis/networking/v1alpha3/namespaces/default/virtual-service/direct-cnn-through-egress-gateway"
                                    }
                                }
                            },
                            "decorator": {
                                "operation": "etth.pl:8080/*"
                            },
                            "typedPerFilterConfig": {
                                "mixer": {
                                    "@type": "type.googleapis.com/istio.mixer.v1.config.client.ServiceConfig",
                                    "disableCheckCalls": true,
                                    "mixerAttributes": {
                                        "attributes": {
                                            "destination.service.host": {
                                                "stringValue": "etth.pl"
                                            },
                                            "destination.service.name": {
                                                "stringValue": "etth.pl"
                                            },
                                            "destination.service.namespace": {
                                                "stringValue": "default"
                                            }
                                        }
                                    },
                                    "forwardAttributes": {
                                        "attributes": {
                                            "destination.service.host": {
                                                "stringValue": "etth.pl"
                                            },
                                            "destination.service.name": {
                                                "stringValue": "etth.pl"
                                            },
                                            "destination.service.namespace": {
                                                "stringValue": "default"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    ]
                }
            ],
            "validateClusters": false
        },
        {
            "virtualHosts": [
                {
                    "name": "backend",
                    "domains": [
                        "*"
                    ],
                    "routes": [
                        {
                            "match": {
                                "prefix": "/stats/prometheus"
                            },
                            "route": {
                                "cluster": "prometheus_stats"
                            }
                        }
                    ]
                }
            ]
        }
    ]
    
    0 讨论(0)
提交回复
热议问题