Problem
I have two pods A
and B
running in a cluster on minikube, both have external IPs www.service-a.com
and www.service-b.com
. Both external IPs are accessible from outside.
I need A
to be able to call B
with it's external IP rather than its cluster DNS, that is A
needs to use www.service-b.com
rather than b.svc.cluster.local
(which does work but I can't use it).
I set A
to use hostNetwork: true
and dnsPolicy: ClusterFirstWithHostNet
. If I spin up a NodeJS docker container manually, it indeed can connect and find it. However, A
is still unable to connect to service-b.com
. Am I using hostNetwork
wrong? How can I configure my pod to connect to b
in that way?
A's Deployment YAML
...
spec:
replicas: 1
selector:
matchLabels:
app: a-app
template:
metadata:
labels:
app: a-app
spec:
hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet
containers:
...
B's service YAML
...
spec:
externalTrafficPolicy: Cluster
type: LoadBalancer
ports:
- port: ...
targetPort: ...
protocol: TCP
name: http
...
Background:
I'm using Minio (a local S3-like solution) and I need to presign the URLs to get and put objects. Minio's pods are running in the same cluster as my authentication pod which would generate the presigned urls. The presigned urls would be used from outside the cluster. Hence I can't sign the url with the cluster dns names like minio.svc.cluster.local
because this URL would not be accessible from outside the cluster and replacing the host with my-minio.com
and keeping the signature does not work because I guess minio signs the entire host and path. Hence I need to have my authentication pod connect to Minio's public facing my-minio.com
instead which does not seem to work.