<h2>Problem</h2>
<p>I have two pods <code>A</code> and <code>B</code> running in a cluster on minikube, both have external IPs <code>www.service-a.com</code> and <code>www.service-b.com</code>. Both external IPs are accessible from outside.</p>
<p>I need <code>A</code> to be able to call <code>B</code> with it's external IP rather than its cluster DNS, that is <code>A</code> needs to use <code>www.service-b.com</code> rather than <code>b.svc.cluster.local</code> (which does work but I can't use it).</p>
<p>I set <code>A</code> to use <code>hostNetwork: true</code> and <code>dnsPolicy: ClusterFirstWithHostNet</code>. If I spin up a NodeJS docker container manually, it indeed can connect and find it. However, <code>A</code> is still unable to connect to <code>service-b.com</code>. Am I using <code>hostNetwork</code> wrong? How can I configure my pod to connect to <code>b</code> in that way?</p>
<p>A's Deployment YAML</p>
<pre><code>...
spec:
  replicas: 1
  selector:
    matchLabels:
      app: a-app
  template:
    metadata:
      labels:
        app: a-app
    spec:
      hostNetwork: true
      dnsPolicy: ClusterFirstWithHostNet
      containers:
...

</code></pre>
<p>B's service YAML</p>
<pre><code>...
spec:
  externalTrafficPolicy: Cluster
  type: LoadBalancer
  ports:
  - port: ...
    targetPort: ...
    protocol: TCP
    name: http
...
</code></pre>
<h2>Background:</h2>
<p>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 <code>minio.svc.cluster.local</code> because this URL would not be accessible from outside the cluster and replacing the host with <code>my-minio.com</code> 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 <code>my-minio.com</code> instead which does not seem to work.</p>

Math is Hard
<p>Regarding <code>hostNetwork</code>, it looks like you misunderstood it. Setting it to true means that Pod will have access to the host where it's running. In case of minikube it's VM and not your host where actual containers are running.</p>
<p>Also, i'm not sure how you expose your services to external world, but i suggest you to try <a href="https://kubernetes.io/docs/concepts/services-networking/ingress/" rel="noreferrer">Ingress</a> for that.</p>
