We have an application listening on gRPC and local testing works fine. This application has an http port for healthchecks and a gRPC port for application data.
The pod yaml:
(sic)
metadata:
name: myapp
namespace: default
(sic)
ports:
- containerPort: 8080
protocol: TCP
- containerPort: 6565
protocol: TCP
(sic)
The service yaml:
apiVersion: v1
kind: Service
metadata:
labels:
app: myapp
name: myapp
namespace: default
spec:
ports:
- name: app-svc-port
port: 80
protocol: TCP
targetPort: 8080
- name: app-grpc-port
port: 6565
protocol: TCP
targetPort: 6565
selector:
app: myapp
type: ClusterIP
The IngressRoute yaml for web access:
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
labels:
app: myapp
name: myapp
namespace: default
spec:
routes:
- kind: Rule
match: Host(`myapp.example.com`)
services:
- kind: Service
name: myapp
port: 80
tls:
secretName: public-cert
The IngressRoute yaml for gRPC access:
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
labels:
app: myapp
name: myapp
namespace: default
spec:
routes:
- kind: Rule
match: Host(`myapp-grpc.example.com`)
services:
- kind: Service
name: myapp
port: 6565
tls:
secretName: public-cert
Doing a query over the browser to myapp-grpc.example.com, I get an html page that is being served from the 8080 port of the pod, not the gRPC endpoint that should be responding.
HTTP/2.0 200 OK
content-type: application/vnd.spring-boot.actuator.v3+json;q=0.8
date: Thu, 27 Feb 2020 21:51:50 GMT
content-length: 15
X-Firefox-Spdy: h2
What I am expecting to see is something similar to this:
ÿÿÿ :aUnexpected HTTP/1.x request: GET /actuator/health
I tried making a different service for each of the two ports of the pod, but the traffic still ends up being sent to port 8080 on the pod rather than 6565.
Traefik version is latest:
time="2020-02-27T21:36:02Z" level=info msg="Traefik version 2.1.4 built on 2020-02-06T17:10:06Z"
as I found this issue: https://github.com/containous/traefik/issues/3131 which was merged when 2.1.3 was release and I assume is inside 2.1.4. When using the endpoint with a gRPC client, I get this response:
evans: failed to run REPL mode: failed to instantiate a new spec: failed to instantiate the spec from proto files: rpc error: code = Unimplemented desc = Not Found: HTTP status code 404; transport: received the unexpected content-type "text/plain; charset=utf-8"