Quantcast
Channel: User mikyll98 - Stack Overflow
Viewing all articles
Browse latest Browse all 102

Kong External Service: no Route matched with those values

$
0
0

TL;DR

I followed each step of the External Service tutorial, but when I try to send and HTTP request to http://localhost/httpbin/anything, I get the "no Route matched with those values." error message.

Is the guide outdated? Is it missing some step?

Long Version

Kong Setup

I've setup Kong Gateway on a local Kubernetes cluster, with minikube:

minikube start --driver=docker
# In another terminal window/in a background processminikube tunnel

Gateway API CRDs:

kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.0.0/standard-install.yaml
echo "---apiVersion: gateway.networking.k8s.io/v1kind: GatewayClassmetadata: name: kong annotations:   konghq.com/gatewayclass-unmanaged: 'true'spec: controllerName: konghq.com/kic-gateway-controller---apiVersion: gateway.networking.k8s.io/v1kind: Gatewaymetadata: name: kongspec: gatewayClassName: kong listeners: - name: proxy   port: 80   protocol: HTTP" | kubectl apply -f -

Kong installation with helm:

helm repo add kong https://charts.konghq.comhelm repo updatehelm install kong kong/ingress -n kong --create-namespace 

Testing connectivity:

export PROXY_IP=$(kubectl get svc --namespace kong kong-gateway-proxy -o jsonpath='{.status.loadBalancer.ingress[0].ip}')echo $PROXY_IPcurl -i $PROXY_IP

External Service Configuration

I've consensed the Service and HTTPRoute in the same YAML:

---# Servicekind: ServiceapiVersion: v1metadata:  name: proxy-to-httpbinspec:  ports:  - protocol: TCP    port: 80  type: ExternalName  externalName: httpbin.org---# Route /httpbinapiVersion: gateway.networking.k8s.io/v1kind: HTTPRoutemetadata:  name: proxy-from-k8s-to-httpbin  annotations:    konghq.com/strip-path: 'true'spec:  parentRefs:  - name: kong  rules:  - matches:    - path:        type:         value: /httpbin    backendRefs:    - name: proxy-to-httpbin      kind: Service      port: 80

and applied it:

$ kubectl apply -f ./external-service.yamlservice/proxy-to-httpbin createdhttproute.gateway.networking.k8s.io/proxy-from-k8s-to-httpbin created

Result:

$ kubectl get servicesNAME               TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)                      AGEproxy-to-httpbin   ExternalName   <none>          httpbin.org   80/TCP                       8m1s$ kubectl get httproutesNAME                        HOSTNAMES   AGEproxy-from-k8s-to-httpbin               8m51s

Problem

The guide states that after these steps, when testing the service you should get a response similiar to what you would receive from http://httpbin.org/anything.

But when I send an HTTP request to gateway-proxy/httpbin/anything, I get the "no route" error:

$ curl -s -i $PROXY_IP/httpbin/anythingHTTP/1.1 404 Not FoundContent-Type: application/json; charset=utf-8Content-Length: 52Connection: keep-aliveDate: Wed, 15 Nov 2023 15:58:39 GMTX-Kong-Response-Latency: 0Server: kong/3.4.2X-Kong-Upstream-Latency: 9X-Kong-Proxy-Latency: 1Via: kong/3.4.2{"message":"no Route matched with those values"}

Question

How can I make the Gateway forward correctly my HTTP requests to the external service?

Update

I deployed Kong on AKS, with the same configuration, and the external service httpbin now does work:

curl -s -i 4.232.X.X/httpbin/anythingHTTP/1.1 200 OKContent-Type: application/jsonContent-Length: 480Connection: keep-aliveX-Cache-Key: c48fe84b97bba1516dd96c93604fc907de95cf449284992594d1325998236ffbX-Cache-Status: BypassDate: Fri, 01 Dec 2023 10:22:10 GMTServer: gunicorn/19.9.0Access-Control-Allow-Origin: *Access-Control-Allow-Credentials: trueX-Kong-Upstream-Latency: 504X-Kong-Proxy-Latency: 1Via: kong/3.4.2{"args": {},"data": "","files": {},"form": {},"headers": {"Accept": "*/*","Host": "4.232.X.X","User-Agent": "curl/8.2.1","X-Amzn-Trace-Id": "Root=1-6569b3d1-7a71e89914522ebe73d9d548","X-Forwarded-Host": "4.232.X.X","X-Forwarded-Path": "/httpbin/anything","X-Forwarded-Prefix": "/httpbin/"  },"json": null,"method": "GET","origin": "10.224.0.4, 4.232.X.Y","url": "http://4.232.X.X/anything"}

So I guess this might have something to do with minikube


Viewing all articles
Browse latest Browse all 102

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>