ingress-nginx
ingress-nginx copied to clipboard
Proxy grpc path have prefix , no work !!!
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: ask-inst
namespace: designhub
annotations:
kubernetes.io/ingress.class: "nginx"
nginx.ingress.kubernetes.io/backend-protocol: "GRPC"
nginx.ingress.kubernetes.io/use-regex: "true"
spec:
tls:
- hosts:
- intranet.designhub.test.realibox.com
secretName: designhub-test-certs
rules:
- host: intranet.designhub.test.realibox.com
http:
paths:
- path: /api.ask_server.v1.AskServer
pathType: Prefix
backend:
serviceName: ask-server
servicePort: 9000
my proto
syntax = "proto3";
package api.ask_server.v1;
import "google/api/annotations.proto";
option go_package = "gitlab.realibox.cn/designhub/go-designhub-project/api/ask-server/v1;v1";
service AskServer {
// Service activity detection
rpc Hello (HelloRequest) returns (HelloReply) {
option (google.api.http) = {
get: "/api/v1/ask/hello/{name}",
};
}
}
// The request message containing the user's name.
message HelloRequest {
string name = 1;
}
// The response message containing the greetings
message HelloReply {
string message = 1;
}
The test way
@rainbowMorelhahahah: This issue is currently awaiting triage.
If Ingress contributors determines this is a relevant issue, they will accept it by applying the triage/accepted
label and provide further guidance.
The triage/accepted
label can be added by org members by writing /triage accepted
in a comment.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
/help
@longwuyuan: This request has been marked as needing help from a contributor.
Guidelines
Please ensure that the issue body includes answers to the following questions:
- Why are we solving this issue?
- To address this issue, are there any code changes? If there are code changes, what needs to be done in the code and what places can the assignee treat as reference points?
- Does this issue have zero to low barrier of entry?
- How can the assignee reach out to you for help?
For more details on the requirements of such an issue, please see here and ensure that they are met.
If this request no longer meets these requirements, the label can be removed
by commenting with the /remove-help
command.
In response to this:
/help
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
/help
help me
I have a similar issue. Requesting to grpc.mydomain.com
is working fine but grpc.mydomain.com/myPath
returns failed name resolution.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: grpc-ingress
annotations:
nginx.ingress.kubernetes.io/backend-protocol: "GRPC"
kubernetes.io/ingress.class: "nginx"
cert-manager.io/issuer: letsencrypt-nginx
spec:
tls:
- hosts:
- grpc.mydomain.com
secretName: letsencrypt-nginx
rules:
- host: grpc.mydomain.com
http:
paths:
- path: /myPath
pathType: Prefix
backend:
service:
name: service-1
port:
number: 8080
- path: /
pathType: Prefix
backend:
service:
name: service-0
port:
number: 8080
can you write a step by step instruction procedure, that anyone can copy/paste to a kind cluster or a minikube cluster and reproduce this problem, using this hello-world app https://github.com/grpc/grpc-go/blob/91e0aeb192456225adf27966d04ada4cf8599915/examples/features/reflection/server/main.go
Well, I've tried to do that but I'm not experienced with GoLang. Instead, I use Dart's hello-world example.
FROM dart:latest AS build
WORKDIR /app
COPY . .
RUN dart pub get
RUN dart compile exe bin/server.dart -o bin/server
FROM scratch
COPY --from=build /runtime/ /
COPY --from=build /app/bin/server /app/bin/server
EXPOSE 50051
CMD ["/app/bin/server"]
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: grpc-test
spec:
selector:
matchLabels:
app: grpc-test
replicas: 1
template:
metadata:
labels:
app: grpc-test
spec:
containers:
- name: grpc-test
image: morhpt.sv:32000/grpc-test
---
apiVersion: v1
kind: Service
metadata:
name: grpc-test
spec:
type: ClusterIP
selector:
app: grpc-test
ports:
- port: 50051
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: grpc-ingress
annotations:
nginx.ingress.kubernetes.io/backend-protocol: "GRPC"
kubernetes.io/ingress.class: "nginx"
spec:
rules:
- host: burak.sv
http:
paths:
- path: /customPath
pathType: Prefix
backend:
service:
name: grpc-test
port:
number: 50051
- path: /
pathType: Prefix
backend:
service:
name: grpc-test
port:
number: 50051
The problem with this deployment is that /customPath
not working. The endpoint I'm trying to access is 'http://burak.sv/customPathand it gives a message saying
Name resolution failed for target dns:http://burak.sv/customPath`.
Requesting without a path works as expected.
Could be related to https://github.com/grpc/grpc/issues/19954.
Any updates on this? We have the same problem
If one path works and another path does not, then it's not a problem with the ingress-controller. I think the app needs to be looked into.
On Thu, 17 Nov, 2022, 8:49 pm Elizaveta Prosvirina, < @.***> wrote:
Any updates on this? We have the same problem
— Reply to this email directly, view it on GitHub https://github.com/kubernetes/ingress-nginx/issues/9033#issuecomment-1318790777, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABGZVWW6G444TAOUKDXBLLLWIZEIPANCNFSM6AAAAAAQH54WUI . You are receiving this because you were mentioned.Message ID: @.***>
What do you mean?
The app doesn't need to listen /customPath
since the ingress-controller
will be listening to it and routes to the specified backend service.
Are you suggesting that the backend service should listen to /customPath
?
@buraktabn we need data to solve this kind of problems. Look at the screenshot below. This is data the ingress-nginx controller routes traffic for a URL similar to what you showed ;
If you can post data here that is detailed and descriptive, someone can analyze it for you
This is the second test for path based routing. Check the config of the ingress object showing the value off the spec path
;
@buraktabn we need data to solve this kind of problems.
I'll create a reproducible example of this when I got a time.
Also noticed that the screenshots you provided are based on HTTP/1.1 and gRPC uses HTTP/2. Does the ingress-controller work the same between the two protocols?
@buraktabn the problem with the ingress-controller, that is being reported in this issue, and that needs to be solved, is not clear. I hope you can describe the problem to be solved in the ingress-controller. Because this ingress ;
...
- path: /customPath
pathType: Prefix
backend:
service:
name: grpc-test
port:
number: 50051
- path: /
pathType: Prefix
backend:
service:
name: grpc-test
port:
number: 50051
...
is not showing any problem with the ingress-controller. Just FYI, You need to look at the nginx.conf, inside the ingress-controller pod, to see the result of using this configuration. Important to to note in this configuration, is that your combination of path: /
and a pathType: Prefix
implies that a request to http://burak.sv/customPath
can be matched by both the rules. So it is not clear as to why you have redundant rules configured.
Backend protocol GRPC works, as you have tested. Just FYI, I know nothing about GRPC but the documentation here talks about defining a service & method https://grpc.io/docs/what-is-grpc/introduction/ . So as per the documentation here https://kubernetes.github.io/ingress-nginx/examples/grpc/ , the service and method requested over grpc, works just fine. See screenshot below
Beyond this, just saying that a request to http://burak.sv/customPath
does not work, is not enough information about the problem with the ingress-controller.
好吧,我已经尝试过这样做,但我对GoLang没有经验。相反,我使用Dart的hello-world示例。
I solved this kind of problem using kong's plugin
/remove-kind bug /kind support /close
@longwuyuan: Closing this issue.
In response to this:
/remove-kind bug /kind support /close
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.