Angular 7 - Rest API consume in Kubernetes service (that is not exposed)

5/3/2019

I had a Angular 7 web app, I am trying to consume a REST API deployed in Kubernetes that port is not open to the Internet.

Tried with http client module ... but this is executing client side ... so no way to reach the service that is running in Kubernetes.

Is it possible to consume this without expose the service to the Internet ?

-- Pedro Sosa
angular
angular-httpclient
kubernetes

2 Answers

5/3/2019

If you want to use Rest API internally inside cluster you can create new pod and use service or setup proxy some how.

you can setup ingress and white label particular ip so only from that IP you can consume Rest API.

-- Harsh Manvar
Source: StackOverflow

5/3/2019

Your Angular application is running on your clients so you have to publicly expose the REST API in order to consume it from there. If you only want to expose the API for specific IPs (if your Angular application should only work within your intranet for example), then you can use an ingress controller (e. g. nginx) and configure it with annotations. Example:

nginx.ingress.kubernetes.io/whitelist-source-range: <YourNetworkCIDR>
-- Martin Brandl
Source: StackOverflow