How to implement a gRPC with http and https

Hi,

I am using traefik 2.9 version in K3S where traefik comes by default. So, I am using Kubernetes CRD whic has different source files ...

I am trying to achieve http scenario where we don't have any certs.

I have seen some scenarios being mentioned here for gRPC... Traefik Proxy gRPC Examples - Traefik but they are not in kuberentes friendly files , I somehow managed to create Kubernetes files but couldn't make it to work. I am using one instance of K3S and using an ip instead of domain name...

Is there any documentation for Kubernetes CRD for these sceanarios ?

Below is my config

kind: IngressRoute
metadata:
  name: traefik-ingress-route
  namespace: {{ .Values.application.namespace }}
spec:
  entryPoints:
    - web
  routes:
    - match: Host(`x.x.x.x')
      kind: Rule
      services:
        - name: {{ .Values.application.service_name }}
          namespace: {{ .Values.application.namespace }}
          port: 9999
          scheme: h2c
          passHostHeader: true

apiVersion: v1
kind: Service
metadata:
  name: {{ .Values.application.service_name }}
  namespace: {{ .Values.application.namespace }}
  annotations:
    # cloud.google.com/app-protocols: '{"grpc-api-port":"HTTP2"}'
    # beta.cloud.google.com/backend-config: '{"grpc-api-port": "rpc-config"}'
    # cloud.google.com/backend-config: '{"ports": {"grpc-api-port": "rpc-config"}}'
    # cloud.google.com/neg: '{"ingress": true}'
    traefik.ingress.kubernetes.io/service.serversscheme: h2c
spec:
  ports:
    # - port: {{ .Values.application.port }}
    - port: 9999
      protocol: TCP
      targetPort: grpc-tunnel
      name: grpc-api-port
  selector:
    {{- include "application_labels" .| indent 4 }}
  sessionAffinity: None
  type: {{ .Values.application.service_type }}```

I can see that , in the dashboard everything looks good. When I point my mock client to x.x.x.x:8000 port, it doesn't work.

Thanks.

I am running into a similar issue with connecting to a grpc server on k3s. I am able to connect through HTTPS but am having no luck getting an h2c to work on Traefik. Did you ever figure it out?

First of all I would start with the latest release of Traefik (link), as it is in continuous development.

I'm also having the same issue but in docker, whenever i try to connect a grpc client i get code=Unimplemented, message=unexpected HTTP status code received from server: 404 (Not Found); transport: received unexpected content-type "text/plain; charset=utf-8

First step is to enable Traefik debug log (doc) and also Traefik access log in JSON format (doc). Check if response http status is coming from target service (OriginStatus) or only from Traefik (DownstreamStatus).

If you want support, you should explain your setup and context, and share your Traefik static and dynamic config, and Docker compose file(s).

And you should probably open your own topic, not hijack a different one for kubernetes :wink: