Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

404 error is returned when accessing the route #5380

Open
ZhengXinwei-F opened this issue Mar 1, 2025 · 1 comment
Open

404 error is returned when accessing the route #5380

ZhengXinwei-F opened this issue Mar 1, 2025 · 1 comment
Labels

Comments

@ZhengXinwei-F
Copy link

ZhengXinwei-F commented Mar 1, 2025

Description:

A 404 error is returned, indicating that the route is not found

It might just be an issue with my configuration, but I haven't been able to identify the problem. I would appreciate any guidance or suggestions.

curl https://ecp.cn-sh-02.zxwcoreapi.dev/clusters/vc-88b76a20-f410-11ef-b908-c2f0721a9338/healthz
{"start_time":"2025-03-01T10:24:16.274Z","method":"GET","x-envoy-origin-path":"/clusters/vc-88b76a20-f410-11ef-b908-c2f0721a9338/healthz","protocol":"HTTP/2","response_code":"404","response_flags":"NR","response_code_details":"route_not_found","connection_termination_details":"-","upstream_transport_failure_reason":"-","bytes_received":"0","bytes_sent":"0","duration":"0","x-envoy-upstream-service-time":"-","x-forwarded-for":"100.64.0.2","user-agent":"curl/7.61.1","x-request-id":"ba9a4253-5760-4830-850a-8aba64ccebe6",":authority":"ecp.cn-sh-02.zxwcoreapi.dev","upstream_host":"-","upstream_cluster":"-","upstream_local_address":"-","downstream_local_address":"10.119.8.112:10443","downstream_remote_address":"100.64.0.2:56310","requested_server_name":"-","route_name":"-"}

Repro steps:

create SVC:

[zhengxinwei@HOST-10-111-38-44 ~]$ kubectl get svc -n vc-88b76a20-f410-11ef-b908-c2f0721a9338 vc-88b76a20-f410-11ef-b908-c2f0721a9338-default-vpc
NAME                                                  TYPE        CLUSTER-IP    EXTERNAL-IP   PORT(S)   AGE
vc-88b76a20-f410-11ef-b908-c2f0721a9338-default-vpc   ClusterIP   10.233.48.7   <none>        443/TCP   2d7h
[zhengxinwei@HOST-10-111-38-44 ~]$ kubectl get endpointslices -n vc-88b76a20-f410-11ef-b908-c2f0721a9338 vc-88b76a20-f410-11ef-b908-c2f0721a9338-default-vpc-sssgs
NAME                                                        ADDRESSTYPE   PORTS   ENDPOINTS      AGE
vc-88b76a20-f410-11ef-b908-c2f0721a9338-default-vpc-sssgs   IPv4          8443    10.119.5.209   2d7h
[zhengxinwei@HOST-10-111-38-44 ~]$

create backendTLSPolicy:

[zhengxinwei@HOST-10-111-38-44 ~]$ kubectl get backendtlspolicies -n vc-88b76a20-f410-11ef-b908-c2f0721a9338 vc-88b76a20-f410-11ef-b908-c2f0721a9338       -oyaml
apiVersion: gateway.networking.k8s.io/v1alpha3
kind: BackendTLSPolicy
metadata:
  creationTimestamp: "2025-03-01T06:58:14Z"
  generation: 3
  labels:
    cluster.x-k8s.io/cluster-name: vc-88b76a20-f410-11ef-b908-c2f0721a9338
  name: vc-88b76a20-f410-11ef-b908-c2f0721a9338
  namespace: vc-88b76a20-f410-11ef-b908-c2f0721a9338
  resourceVersion: "42616499"
  uid: adc747de-78a7-4f7a-b557-cbe039dc3fc4
spec:
  targetRefs:
  - group: ""
    kind: Service
    name: vc-88b76a20-f410-11ef-b908-c2f0721a9338-default-vpc
  validation:
    caCertificateRefs:
    - group: ""
      kind: Secret
      name: vc-ca-vc-88b76a20-f410-11ef-b908-c2f0721a9338
    hostname: ecp.cn-sh-02.zxwcoreapi.dev
status:
  ancestors:
  - ancestorRef:
      group: gateway.networking.k8s.io
      kind: Gateway
      name: test-api-gateway
      namespace: envoy-gateway-system
    conditions:
    - lastTransitionTime: "2025-03-01T08:46:06Z"
      message: Policy has been accepted.
      reason: Accepted
      status: "True"
      type: Accepted
    controllerName: gateway.envoyproxy.io/gatewayclass-controller

create referenceGrant :

[zhengxinwei@HOST-10-111-38-44 ~]$ kubectl get referencegrant -n vc-88b76a20-f410-11ef-b908-c2f0721a9338      vc-88b76a20-f410-11ef-b908-c2f0721a9338  -oyaml
apiVersion: gateway.networking.k8s.io/v1beta1
kind: ReferenceGrant
metadata:
  creationTimestamp: "2025-03-01T08:59:23Z"
  generation: 1
  labels:
    cluster.x-k8s.io/cluster-name: vc-88b76a20-f410-11ef-b908-c2f0721a9338
  name: vc-88b76a20-f410-11ef-b908-c2f0721a9338
  namespace: vc-88b76a20-f410-11ef-b908-c2f0721a9338
  resourceVersion: "42539478"
  uid: ea4a3976-7b6a-4dfb-909b-b167dcc1c73f
spec:
  from:
  - group: gateway.networking.k8s.io
    kind: HTTPRoute
    namespace: plat-lepton-service
  to:
  - group: ""
    kind: Service

create httproute:

[zhengxinwei@HOST-10-111-38-44 ~]$ kubectl get httproutes -n plat-lepton-service vc-88b76a20-f410-11ef-b908-c2f0721a9338 -o yaml
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  creationTimestamp: "2025-03-01T10:15:15Z"
  generation: 1
  labels:
    cluster.x-k8s.io/cluster-name: vc-88b76a20-f410-11ef-b908-c2f0721a9338
    lepton.sensetime.com/vc-control: ecp-controller
  name: vc-88b76a20-f410-11ef-b908-c2f0721a9338
  namespace: plat-lepton-service
  resourceVersion: "42633540"
  uid: f39682cc-8dfb-41e8-9ab9-345043dcdff3
spec:
  hostnames:
  - kubernetes
  - ecp.cn-sh-02.zxwcoreapi.dev
  parentRefs:
  - group: gateway.networking.k8s.io
    kind: Gateway
    name: test-gateway
    namespace: envoy-gateway-system
  rules:
  - filters:
    - extensionRef:
        group: gateway.envoyproxy.io
        kind: HTTPRouteFilter
        name: direct-response-options
      type: ExtensionRef
    matches:
    - method: OPTIONS
      path:
        type: PathPrefix
        value: /clusters/vc-88b76a20-f410-11ef-b908-c2f0721a9338/
  - backendRefs:
    - group: ""
      kind: Service
      name: vc-88b76a20-f410-11ef-b908-c2f0721a9338-default-vpc
      namespace: vc-88b76a20-f410-11ef-b908-c2f0721a9338
      port: 443
      weight: 1
    filters:
    - type: URLRewrite
      urlRewrite:
        path:
          replacePrefixMatch: /
          type: ReplacePrefixMatch
    matches:
    - path:
        type: PathPrefix
        value: /clusters/vc-88b76a20-f410-11ef-b908-c2f0721a9338/
status:
  parents:
  - conditions:
    - lastTransitionTime: "2025-03-01T10:15:15Z"
      message: Route is accepted
      observedGeneration: 1
      reason: Accepted
      status: "True"
      type: Accepted
    - lastTransitionTime: "2025-03-01T10:15:15Z"
      message: Resolved all the Object references for the Route
      observedGeneration: 1
      reason: ResolvedRefs
      status: "True"
      type: ResolvedRefs
    controllerName: gateway.envoyproxy.io/gatewayclass-controller
    parentRef:
      group: gateway.networking.k8s.io
      kind: Gateway
      name: test-api-gateway
      namespace: envoy-gateway-system

Environment:

v1.3.0

Logs:

some log :

[zhengxinwei@HOST-10-111-38-44 ~]$ kubectl logs  -n envoy-gateway-system                      envoy-gateway-75b9b58595-w7x9t -f | grep kubernetes/routes.go   | grep -i 88b76a20
2025-03-01T10:09:29.684Z        INFO    provider        kubernetes/routes.go:287        processing HTTPRoute    {"runner": "provider", "namespace": "plat-lepton-service", "name": "vc-88b76a20-f410-11ef-b908-c2f0721a9338"}
2025-03-01T10:09:29.684Z        INFO    provider        kubernetes/routes.go:327        added ReferenceGrant to resource map    {"runner": "provider", "namespace": "vc-88b76a20-f410-11ef-b908-c2f0721a9338", "name": "vc-88b76a20-f410-11ef-b908-c2f0721a9338"}
2025-03-01T10:09:29.710Z        INFO    provider        kubernetes/routes.go:287        processing HTTPRoute    {"runner": "provider", "namespace": "plat-lepton-service", "name": "vc-88b76a20-f410-11ef-b908-c2f0721a9338"}
2025-03-01T10:09:29.710Z        INFO    provider        kubernetes/routes.go:327        added ReferenceGrant to resource map    {"runner": "provider", "namespace": "vc-88b76a20-f410-11ef-b908-c2f0721a9338", "name": "vc-88b76a20-f410-11ef-b908-c2f0721a9338"}
2025-03-01T10:09:29.729Z        INFO    provider        kubernetes/routes.go:287        processing HTTPRoute    {"runner": "provider", "namespace": "plat-lepton-service", "name": "vc-88b76a20-f410-11ef-b908-c2f0721a9338"}
2025-03-01T10:09:29.729Z        INFO    provider        kubernetes/routes.go:327        added ReferenceGrant to resource map    {"runner": "provider", "namespace": "vc-88b76a20-f410-11ef-b908-c2f0721a9338", "name": "vc-88b76a20-f410-11ef-b908-c2f0721a9338"}
2025-03-01T10:09:29.737Z        INFO    provider        kubernetes/routes.go:287        processing HTTPRoute    {"runner": "provider", "namespace": "plat-lepton-service", "name": "vc-88b76a20-f410-11ef-b908-c2f0721a9338"}
2025-03-01T10:09:29.737Z        INFO    provider        kubernetes/routes.go:327        added ReferenceGrant to resource map    {"runner": "provider", "namespace": "vc-88b76a20-f410-11ef-b908-c2f0721a9338", "name": "vc-88b76a20-f410-11ef-b908-c2f0721a9338"}
2025-03-01T10:09:29.746Z        INFO    provider        kubernetes/routes.go:287        processing HTTPRoute    {"runner": "provider", "namespace": "plat-lepton-service", "name": "vc-88b76a20-f410-11ef-b908-c2f0721a9338"}

error log :
refer to the error log in the description

@ZhengXinwei-F
Copy link
Author

@zirain cc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant