easegress-io / easegress

A Cloud Native traffic orchestration system

Home Page:https://megaease.com/easegress/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Question]: Why does pipeline not map properly to the backend server?

kursk-ye opened this issue · comments

This is not Bug report or Feature request

  • I confirm that this is not bug report or feature request.

Is this question answered in the documentation?

  • I have searched the documentation

Is there an existing issue for this?

  • I have searched the existing issues

Your question

I tried to write a demo, as follow

echo '
kind: HTTPServer
name: demo
port: 10080
https: false
rules:
  - paths:
    - path: /pipeline
      backend: demo-0' | egctl create -f -


echo '
name: demo-0
kind: Pipeline
flow:
  - filter: proxy
filters:
  - name: proxy
    kind: Proxy
    pools:
    - servers:
      - url: http://10.102.87.93
      - url: http://10.108.219.50
      loadBalance:
        policy: roundRobin' | egctl create -f -

http://10.102.87.93 and http://10.108.219.50 is k8s's service, There is a corresponding 200 response

root@cp02:~# kcgs
NAME            TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)   AGE    SELECTOR
backend-svc-1   ClusterIP   10.102.87.93    <none>        80/TCP    112m   app=web-front-end,version=v1
backend-svc-2   ClusterIP   10.108.219.50   <none>        80/TCP    112m   app=web-front-end,version=v2
kubernetes      ClusterIP   10.96.0.1       <none>        443/TCP   9d     <none>


root@cp02:~# curl -i http://10.102.87.93 && curl -i http://10.108.219.50
HTTP/1.1 200 OK
Server: nginx/1.18.0 (Ubuntu)
Date: Wed, 31 Jan 2024 02:08:07 GMT
Content-Type: text/html
Content-Length: 38
Last-Modified: Wed, 31 Jan 2024 00:22:59 GMT
Connection: keep-alive
ETag: "65b992e3-26"
Accept-Ranges: bytes

172.16.189.33
Port 8080
welcome kursk
HTTP/1.1 200 OK
Server: nginx/1.18.0 (Ubuntu)
Date: Wed, 31 Jan 2024 02:08:07 GMT
Content-Type: text/html
Content-Length: 38
Last-Modified: Wed, 31 Jan 2024 00:23:12 GMT
Connection: keep-alive
ETag: "65b992f0-26"
Accept-Ranges: bytes

172.16.189.34
Port 9090
welcome kursk

HTTPServer and pipeline are published successfully, but when accessing the HTTPServer, it returns a 404 instead of the normal 200 response from the one of two services

root@cp02:~# curl -v  http://cp01:10080/pipeline
*   Trying 172.26.11.50:10080...
* Connected to cp01 (172.26.11.50) port 10080 (#0)
> GET /pipeline HTTP/1.1
> Host: cp01:10080
> User-Agent: curl/7.81.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 404 Not Found
< Content-Type: text/html
< Date: Wed, 31 Jan 2024 01:59:01 GMT
< Server: nginx/1.18.0 (Ubuntu)
< Content-Length: 162
<
<html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.18.0 (Ubuntu)</center>
</body>
</html>
* Connection #0 to host cp01 left intact

You can see from the logs that pipeline did receive the request, but why did it not foward to the service?
How can I configure it so that the background service responds correctly?

root@cp01:~/easegress.log# tail -f filter_http_access.log
[2024-01-31T01:20:42.316Z] [172.26.11.51:47440 172.26.11.51 GET /pipeline HTTP/1.1 404] [5.122ms rx:64B tx:277B] [status code: 404 | proxy#proxy#main#duration: 4.161ms | pipeline(demo-0): proxy(4.621ms)]
[2024-01-31T01:21:41.811Z] [172.26.11.51:59060 172.26.11.51 GET /pipeline HTTP/1.1 404] [5.443ms rx:64B tx:277B] [status code: 404 | proxy#proxy#main#duration: 4.884ms | pipeline(demo-0): proxy(4.979ms)]
[2024-01-31T01:59:01.63Z] [172.26.11.51:46404 172.26.11.51 GET /pipeline HTTP/1.1 404] [5.108ms rx:64B tx:277B] [status code: 404 | proxy#proxy#main#duration: 4.645ms | pipeline(demo-0): proxy(4.758ms)]

when pipeline transfer, the path is kept. So, it equals to call curl -i http://10.102.87.93/pipeline && curl -i http://10.108.219.50/pipeline

o,I'm such an idiot.

no worries... i make this mistake before for several times.