I have a development environment where some services run in a local Kubernetes cluster, while others run in local nginx & IIS (Windows) outside of the cluster. Most of these services are HTTP APIs, and I sometimes need them to communicate to each other. I have found a way to for non-Kubernetes services to access services inside the cluster (by using IIS as a proxy), but not the other way around.
Basically, from within my container I need to be able to do curl https://app-running-in-iis.local
. The address app-running-in-iis.local
should resolve to the IP of the host running the Kubernetes cluster.
What would be the simplest way to do this?
In Kubernetes best practices: mapping external services
You can find two examples how to map external resources into your cluster using services and endpoints:
kind: Service
apiVersion: v1
metadata:
name: nginx
Spec:
type: ClusterIP
ports:
- port: 31500
targetPort: 27017
kind: Endpoints
apiVersion: v1
metadata:
name: nginx
subsets:
- addresses:
- ip: 10.240.0.4
ports:
- port: 27017
Additional resources:
Hope this help.