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.0 KiB

+++ title = "Traefik Ingress发布gRPC服务" date = 2022-09-01 [taxonomies] tags=["kubernetes","coding"] +++ 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