This is my first foray into Kubernetes land... I'm still pretty shaky on how things work and still wrapping my head around some of the concepts so please bear with me there.
The application I am deploying needs access to a couple of external third party http rest apis. What I believe I need from reading the docs is a service with an endpoint that points to the external rest apis ip. This is what I have in my helm templates:
service.yaml:
apiVersion: v1
kind: Service
metadata:
labels:
run: external_rest_service
name: external_rest_service
spec:
ports:
- port: 443
My endpoint.yaml:
kind: Endpoints
apiVersion: v1
metadata:
name: external_rest_service
subsets:
- addresses:
- ip: https://www.someservice.com/api
ports:
- port: 443
This of course doesn't work because ip needs to be an ip address. However, when I do an nslookup of the rest api I get back 3 different ip addresses which I believe may be because of round robin dns. Oddly when I try any of the ip addresses directly via curl I don't get a response. My questions are..
- Is this the correct or best practice approach to giving access to an outside resource from within my cluster?
- Can I configure (and should I) configure Kubernetes to allow access via domain name instead of ip? If so.. where do I configure this? I'm not seeing it when searching the docs.
If anyone could give me any guidance here I would really appreciate it. Thanks much!