<p>Here is the issue:
We have several microk8s cluster running on different networks; yet each have access to our storage network where our NAS are.</p>
<p>within Kubernetes, we create disks with an nfs-provisionner (nfs-externalsubdir). Some disks were created with the IP of the NAS server specified.
Once we had to change the IP, we discovered that the disk was bound to the IP, and changing the IP meant creating a new storage resource within.</p>
<p>To avoid this, we would like to be able to set a DNS record on the Kubernetes cluster level so we could create storage resources with the nfs provisionner based on a name an not an IP, and we could alter the DNS record when needed (when we upgrade or migrate our external NAS appliances, for instance)
for instance, I'd like to tell every microk8s environnements that:</p>
<p>192.168.1.4  my-nas.mydomain.local</p>
<p>... like I would within the /etc/hosts file.</p>
<p>Is there a proper way to achieve this?
I tried to follow the advices on this link: <a href="https://stackoverflow.com/questions/37166822/is-there-a-way-to-add-arbitrary-records-to-kube-dns">Is there a way to add arbitrary records to kube-dns?</a>
(the answer upvoted 15 time, the cluster-wise section), restarted a deployment, but it didn't work</p>
<p>I cannot use the hostAliases feature since it isn't provided on every  chart we are using, that's why I'm looking for a more global solution.</p>
<p>Best Regards,</p>

<p><code>...we could create storage resources with the nfs provisionner based on a name an not an IP, and we could alter the DNS record when needed...</code></p>
<p>For this you can try headless service without touching coreDNS:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: my-nas
  namespace: kube-system  # &lt;-- you can place it somewhere else
  labels:
    app: my-nas
spec:
 ports:
 - protocol: TCP
   port: &lt;nas port&gt;
---
apiVersion: v1
kind: Endpoints
metadata:
  name: my-nas
subsets: 
- addresses:
  - ip: 192.168.1.4
  ports:
  - port: &lt;nas port&gt;
</code></pre>
<p>Use it as: <code>my-nas.kube-system.svc.cluster.local</code></p>
