I have a Kubernetes cluster with services and I use Ambassador as an API gateway between outside world and my services.
With Ambassador I know that I can use a service, which I have, to check authentication and authorization for incoming requests but does this only apply for requests coming outside the cluster?
I want to intercept service-to-service calls as well.
I have the same problem at the moment. Ambassador routes every request to an auth service (if provided), the auth service can be anything. So you can setup http basic auth, oauth, jwt auth and so on. The next important thing to mention is that your services may use header based routing (https://www.getambassador.io/reference/headers). Only if a bearer (or something similiar) is present the request will hit your service, otherwise will fail. In your service you can check for permissions and so on. So all in all ambassador can help you, but you have still to program something by yourself.
If you want something ready from start or more advanced you can try https://github.com/ory/oathkeeper or https://istio.io.
If you already found a solution, it would be interesting to know.
I would be surprised if you cannot.
This answer needs some terminology, to avoid getting lost in word-soup.
Service
, and the one which will be authenticating to AmbassadorService
(the selector would target its Pod
s)Service
for app-Z we'll call z-service
in the z
namespace, for a FQDN of z-service.z.svc.cluster.local
It seems like you can use its v-host support and teach it to honor the in-cluster virtual host (the aforementioned FQDN), then update the z-service
selector to target the Ambassador Pods rather than the underlying app-Z Pods.
From app-A's point of view, the only thing that would change is that it now must provide authentication for contacting z-service.z.svc.cluster.local
.
Without studying Ambassador's setup more, it's hard to know if Ambassador would Just Work⢠at that point, or whether you would then need a "implementation" Service
-- such as z-for-real.z.svc.cluster.local
-- so that Ambassador knows how to find the actual app-Z Pods.