How to make a call from angular application to .net core web api in kubernetes

4/27/2019

I have created docker image for angular and .net core api and deployed in the azure kubernetes. I have used Ingress controller for angular to expose outside of the cluster. I would like to know how to make a http call from angular app to core api which is exposed as ClusterIP service(Without exposing outside).

For Example: http://xxxxxxxxxx/api/test (from angular app) here what is the value of xxxxxxxxxxx.? Or How can we make a call.?

Could you please suggest with example.?

-- Seenu
azure
azure-aks
azure-kubernetes
kubernetes
nginx-ingress

1 Answer

4/27/2019

Every service you create in kubernetes has a dns name (two actually):

  1. service_name:service_port
  2. service_name.namespace_name.svc.cluster.local:service_port

they will always resolve to the proper ip address to talk to your service (as long as kubernetes functions properly).

so just create a service for your api and use this notation to access it.

Reading: https://kubernetes.io/docs/concepts/services-networking/service/

-- 4c74356b41
Source: StackOverflow