1
votes

I have GRPC service written in go and i need to deploy the service on top of AWS-EKS, we are using nginx-ingress and cloudflare to point to our cluster gateway (nginx).

but when i tried to deploy the service and test it using this command grpcurl grpc.fd-admin.com:443 list i always get the following error:

Failed to list services: rpc error: code = Unknown desc = Moved Permanently: HTTP status code 301; transport: missing content-type field

And this is what i did for kubernetes resources:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: grpc
  labels:
    k8s-app: grpc
spec:
  replicas: 1
  template:
    metadata:
      labels:
        k8s-app: grpc
    spec:
      containers:
      - name: grpc
        image: quay.io/kubernetes-ingress-controller/grpc-fortune-teller:0.1
        ports:
        - containerPort: 50051
          name: grpc
---
apiVersion: v1
kind: Service
metadata:
  name: grpc
  namespace: grpc
spec:
  selector:
    k8s-app: grpc
  ports:
  - port: 50051
    targetPort: 50051
    protocol: TCP
    name: grpc
  type: ClusterIP
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    kubernetes.io/ingress.class: "nginx"
    nginx.ingress.kubernetes.io/backend-protocol: "GRPC"
    nginx.ingress.kubernetes.io/ssl-redirect: "true"
  name: grpc
  namespace: grpc
spec:
  rules:
  - host: grpc.fd-admin.com
    http:
      paths:
      - backend:
          serviceName: grpc
          servicePort: grpc
  tls:
  - secretName: grpc
    hosts:
      - grpc.fd-admin.com

So can any one explain why i got this error or what is the reasons may cause this kind of error ?

1

1 Answers

0
votes

Try below the annotations of nginx ingress,

kind: Ingress
metadata:
  annotations:
    kubernetes.io/ingress.class: "nginx"
    nginx.ingress.kubernetes.io/backend-protocol: "GRPC"
    nginx.ingress.kubernetes.io/grpc-backend-for-port: "grpc"
  name: grpc