<p>I am using an external database that requires you to whitelist IPs for use, and I want a particular service in my k8s cluster to have access to this database.</p>

<p>I don't know which IP address to add to the whitelist. I tried whitelisting the <code>IP</code> field from <code>kubectl describe svc &lt;service_name&gt;</code>. That did not appear to work, so I then tried whitelisting the IP field from <code>kubectl describe pod &lt;pod_name&gt;</code>, which also didn't work. </p>

<p>Ideally I would be able to whitelist the IP from the service instead of the pod, as the pod IP is not static.</p>

<p>You cannot whitelist the service IP because there is a sorta of NAT that is connecting pods to pods and containers to containers etc (using etcd). But you can whitelist  your global IP, which means you will have access to the database from every pod or service.</p>

<p>Read more about the network <a href="https://coreos.com/kubernetes/docs/latest/kubernetes-networking.html" rel="nofollow">here</a></p>
