You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
blog/content/posts/traefik-ingress-grpc.md

1.1 KiB

+++ title = "Traefik Ingress发布gRPC服务" date = 2022-09-01 [taxonomies] tags=["kubernetes","coding"] +++

TLDR:

在Service中加入 traefik.ingress.kubernetes.io/service.serversscheme: h2c 注解 可以避免使用证书

jina框架使用gPRC协议通讯部署到k8s中对外暴露服务需要配置ingress注解。

k3s中默认使用Traefik Ingress参考yaml配置如下


---
# Service
apiVersion: v1
kind: Service
metadata:
  name: grpc-demo
  annotations:  
    traefik.ingress.kubernetes.io/service.serversscheme: h2c
spec:
  ports:
    - port: 8080
  selector:
    app.kubernetes.io/name: grpc-demo
    app.kubernetes.io/instance: grpc-demo
  type: ClusterIP


---
# Ingress
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    ingress.kubernetes.io/protocol: http
  labels:
    app: grpc-demo
  name: grpc-demo
  namespace: grpc-namespace
spec:
  rules:
    - host: grpc.example.org
      http:
        paths:
          - backend:
              service:
                name: grpc-demo
                port:
                  number: 8080
            path: /
            pathType: Prefix