gRPC AWS Ingress Kubernetes

11/16/2021

I am trying to set up an Ingress manifest that allows traffic through an ALB to connect to a gRPC pod. I am currently getting the error:

{
  "error": "14 UNAVAILABLE: Trying to connect an http1.x server"
}

Not really sure what this means as I am new to gRPC. I am using BloomRPC to test this currently by hitting dns-of-alb:50051

Kubernetes Manifests:

service.yaml:

apiVersion: v1
kind: Service
metadata:
  name: {{.Values.name}}-svc
spec:
  ports:
  - port: 50051
    targetPort: 50051
    protocol: TCP
  type: NodePort
  selector:
    app: {{.Values.name}}

ingress.yaml

apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: {{.Values.name}}-ingress
  namespace: {{.Values.namespace}}
  annotations:
    alb.ingress.kubernetes.io/backend-protocol-version: GRPC
    alb.ingress.kubernetes.io/listen-ports: '[{"HTTPS": 50051}]'
    alb.ingress.kubernetes.io/backend-protocol: HTTPS
    alb.ingress.kubernetes.io/scheme: internet-facing
    alb.ingress.kubernetes.io/target-type: instance
    kubernetes.io/ingress.class: alb
    alb.ingress.kubernetes.io/healthcheck-path: /                                 
    alb.ingress.kubernetes.io/healthcheck-protocol: HTTP
    alb.ingress.kubernetes.io/certificate-arn: {{.Values.loadBalancerCertificate}}
spec:
  rules:
    - http:
        paths:
          - path: /*
            backend:
              serviceName: {{.Values.name}}-svc
              servicePort: 50051
  backend:
    serviceName: {{.Values.name}}-svc
    servicePort: 50051

deployment.yaml

{{- if .Values.env.config}}
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{.Values.name}}
data:
{{.Values.env.config | toYaml | indent 2}}
---
{{- end}}

{{- if .Values.env.secrets}}
apiVersion: v1
kind: Secret
metadata:
  name: {{.Values.name}}
stringData:
{{.Values.env.secrets | toYaml | indent 2}}
---
{{- end}}

{{- if .Values.dockercfg}}
apiVersion: v1
kind: Secret
metadata:
  name: {{.Values.name}}-dockercfg
  annotations:
    harness.io/skip-versioning: true
data:
  .dockercfg: {{.Values.dockercfg}}
type: kubernetes.io/dockercfg
---
{{- end}}

apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{.Values.name}}-deployment
spec:
  replicas: {{int .Values.replicas}}
  selector:
    matchLabels:
      app: {{.Values.name}}
  template:
    metadata:
      labels:
        app: {{.Values.name}}
        tags.datadoghq.com/env: {{.Values.environment_name}}
        tags.datadoghq.com/service: {{.Values.name}}
        tags.datadoghq.com/version: "{{.Values.version}}"
    spec:
      {{- if .Values.dockercfg}}
      imagePullSecrets:
      - name: {{.Values.name}}-dockercfg
      {{- end}}
      serviceAccountName: {{.Values.name}}-service-account
      containers:
      - name: {{.Values.name}}
        image: {{.Values.image}}
        env:
          - name: DD_AGENT_HOST
            valueFrom:
              fieldRef:
                fieldPath: status.hostIP
          - name: DD_ENV
            valueFrom:
              fieldRef:
                fieldPath: metadata.labels['tags.datadoghq.com/env']
          - name: DD_SERVICE
            valueFrom:
              fieldRef:
                fieldPath: metadata.labels['tags.datadoghq.com/service']
          - name: DD_VERSION
            valueFrom:
              fieldRef:
                fieldPath: metadata.labels['tags.datadoghq.com/version']
        {{- if or .Values.env.config .Values.env.secrets}}
        envFrom:
        {{- if .Values.env.config}}
        - configMapRef:
            name: {{.Values.name}}
        {{- end}}
        {{- if .Values.env.secrets}}
        - secretRef:
            name: {{.Values.name}}
        {{- end}}
        {{- end}}
-- sd-gallowaystorm
amazon-web-services
aws-application-load-balancer
grpc
kubernetes

0 Answers