emissary-ingress / emissary

open source Kubernetes-native API gateway for microservices built on the Envoy Proxy
https://www.getambassador.io
Apache License 2.0
4.34k stars 681 forks source link

Help with Bare Metal Ambassador setup and gRPC upstream timeout #1018

Closed MirzaMerdovic closed 5 years ago

MirzaMerdovic commented 5 years ago

Hi,

Goal

I'd like avoid using NodePort configuration for every gRPC service I have hosted on Kubernetes, so I am trying to configure the Amabassador (Kubernetes service type=NodePort) as an gateway and that way I will only have one port value to take care of.

Problem

I am receiving error: 'Status(StatusCode=Unavailable, Detail="upstream request timeout")' when I try to consume gRCP service hosted in local Kubernetes setup. When I just expose the k8s service with "NodePort" everything works fine.

On K8s dashboars when I go to Ambassador pods logs all I can find is this:

ACCESS [2018-12-07T10:28:10.109Z] "POST /gamesettings.internalgrpc.GameSettingsService/GetGameByGameId HTTP/2" 200 UT 14 0 3002 - "-" "grpc-csharp/1.16.0 grpc-c/6.0.0 (windows; chttp2; gao)" "04b1b7ca-2bcf-4818-a7eb-cf6ad617c1de" "localhost:30300" "10.99.78.36:80"

So I am not sure where I have the problem: Ambassador, Kubernetes or somewhere else.

Setup

Kuberentes (kubectl v1.13) install through Docker for Windows. Ambassador installed following the official guide gRCP services are code in C# .NET Core 2.0 and are running in Linux containers

YAML Configurations

Pod:

apiVersion: v1
kind: Pod
metadata:
  name: gamesettings-internalgrpc
  labels:
    name: gamesettings-internalgrpc
spec:
  containers:
  - name: gamesettings-internalgrpc
    image: gamesettings-internalgrpc
    ports:
      - containerPort: 80
    imagePullPolicy: Never

Service:

apiVersion: v1
kind: Service
metadata:
  name: gamesettings-internalgrpc
  annotations:
    getambassador.io/config: |
      ---
      apiVersion: ambassador/v0
      kind:  Mapping
      name:  gamesettinggrpc_mapping
      grpc: True
      prefix: /gamesettings.internalgrpc.GameSettingsService/
      rewrite: /gamesettings.internalgrpc.GameSettingsService/
      service: gamesettings-internalgrpc
  labels:
    name: gamesettings-internalgrpc
spec:
  selector:
    app: gamesettings-internalgrpc
  ports:
  - port: 80
    targetPort: 80

I apologize if this is not a correct place to write this kind of inquiry in that case please direct me to a proper channel and just delete this. I thought about going to gitter but it felt to hard to explain my problem on a general chat :/

Thanks!

Baykonur commented 5 years ago

I am just a fellow user of Ambassador but check your service selector and verify it to your pod’s label, they do not match.

MirzaMerdovic commented 5 years ago

@Baykonur thanks a bunch! I was blind, fixing the selector.app to selector.name works.

MirzaMerdovic commented 5 years ago

Closing this, sorry for spamming.