Search code examples
kubernetesmicroservicesconsulenvoyproxyocelot

Microservices Api gateway and Identity Server 4 kubernates


I have microsevices and SPA app. All of them run on docker with docker compose. I have ocelot api gateway. But gateway knows ip address or container names of microservices for reaching . I add a aggregater service inside ocelot app. And I can reach to all services from aggregator service with ips.

But I want to move kubernates. I can scale services. there is no static ip. How can I configure .

I have identity service. This service knows clients ip addresses. Again same problem.

I searched for hours. I found some keywords. Envoy, Ingress, Consul, Ocelot . Can someone explain these things ?


Solution

  • It sounds like your question is related to Service Discovery.

    In Kubernetes, the native way an "API Gateway" is implemented, is by using Ingress resources and Ingress Controllers. If you use a cloud provider, they usually have a product for this, or you can use a custom deployed within the cluster.

    Service Discovery the Kubernetes way, is by referring to Service resources, e.g. the Ingress resources maps URLs (in your public API) to services. And your app is deployed as a Deployment resource, and all replicas (instances) is exposed via a Service resource. An app can also send request to other apps, and it should address that request to the Service resource for the other app. The Service resource does load balancing to the replicas of the receiving app.