5

I am trying to run Ambassador API gateway on my local dev environment so I would simulate what I'll end up with on production - the difference is that on prod my solution will be running in Kubernetes. To do so, I'm installing Ambassador into Docker Desktop and adding the required configuration to route requests to my microservices. Unfortunately, it did not work for me and I'm getting the error below:

upstream connect error or disconnect/reset before headers. reset reason: connection failure

I assume that's due to an issue in the mapping file, which is as follows:

apiVersion: ambassador/v2
kind:  Mapping
name:  institutions_mapping
prefix: /ins/
service: localhost:44332

So what I'm basically trying to do is rewrite all requests coming to http://{ambassador_url}/ins to a service running locally in IIS Express (through Visual Studio) on port 44332.

What am I missing?

Kassem
  • 8,116
  • 17
  • 75
  • 116
  • Try changing `localhost` in `service` with local IP of your machine, like `192.168.5.10:44332`. Do not use loopback address (e.g. 127.0.0.1). – anemyte Dec 14 '20 at 09:03
  • Unfortunately this did not work. – Kassem Dec 15 '20 at 13:23
  • That's probably because an IP address is not a service after all. My bad. Does it produce any logs? Have you tried to create an external name or a headless service to create host's IP as a service? – anemyte Dec 15 '20 at 13:48
  • How can I create the host's IP as a service that is visible to Ambassador in Docker? An example would be appreciated. – Kassem Dec 15 '20 at 14:00
  • Try this: ``` apiVersion: v1 kind: Service metadata: name: my-localhost spec: type: ClusterIP clusterIP: None --- kind: Endpoints apiVersion: v1 metadata: name: my-localhost subsets: - addresses: - ip: 10.1.1.5 # your host IP here ```. Sorry for formatting. – anemyte Dec 15 '20 at 14:31
  • @anemyte are you sure this is something that works with Docker? This looks a lot like the YAML used for Kubernetes services. Again, what I'm trying to achieve here is to use Ambassador WITHOUT Kubernetes. What I found online is that I can deploy Ambassador as a Docker container but unfortunately this is not working for me as you can see in the post above. Any other ideas or links to some useful resources? – Kassem Dec 16 '20 at 10:27
  • I'm sorry I was under the false impression that you still use k8s somehow from docker container because of the mapping file, which is a k8s CRD. Ambassador expects a k8s service as a backend and there is no way around it. You need a k8s cluster to use Ambassador: https://www.getambassador.io/getting-started-menu/#no . – anemyte Dec 17 '20 at 10:40
  • https://github.com/datawire/ambassador/issues/585 – Harsh Manvar Dec 18 '20 at 04:53
  • @Kassem issue is connecting with API-gateway. is your API gateway is exposed properly at docker/container level? and are you able to connect ?? – Akhil Surapuram Dec 20 '20 at 12:46
  • if its ambassador issue try using alternatives like NGNIX – Akhil Surapuram Dec 20 '20 at 12:46
  • @Kassem I am falling into the same issue as you described, have you found a suitable solution? – Coderji Sep 12 '22 at 14:41

1 Answers1

1

I think you may be better off using another one of Ambassador Labs tools called Telepresence.

https://www.telepresence.io/

With Telepresence you can take your local service you have running on localhost and project it into your cluster to see how it performs. This way you don't need to spin up a local cluster, and can get real time feedback on how your service operates with other services in the cluster.

  • This is convenient for when I want to do some kind of an integration test before I push my code. But what about the development experience (inner dev loop) where an engineer would be actively writing code, running their code, debugging, and repeat until the code is ready to push? – Kassem Jan 27 '21 at 17:07
  • By adding telepresence to your inner-dev-loop you are always testing code against real dependencies. I wrote an article about using Skaffold and Telepresence in your inner dev loop. https://blog.getambassador.io/super-fast-inner-development-loops-for-kubernetes-with-skaffold-and-telepresence-1cd3e42ba665 – peteroneilljr Feb 08 '21 at 20:27