dns: Add note about ndots (#907)

Following https://github.com/kubevirt/kubevirt/issues/14934
We can see that when using subdomain,
`nslookup vmi.subdomain` won't resolve.
Reason is that despite virt-launcher has default k8s ndots:5,
ndots option isn't populated to the guest, and depends on the local resolver.

If desired, cloud init can be used to override ndots.

      - cloudInitNoCloud:
          userData: |-
            #cloud-config
            bootcmd:
            - nmcli connection modify "System eth0" ipv4.dns-options "ndots:2"
            - nmcli connection up "System eth0"
        name: cloudinitdisk

Update docs about ndots effect.

Signed-off-by: Or Shoval <oshoval@redhat.com>
This commit is contained in:
Or Shoval 2025-07-17 10:15:37 +03:00 committed by GitHub
parent 3c71826ed6
commit f530840e6f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 0 deletions

View File

@ -82,3 +82,7 @@ If no `spec.hostname` is set, then we fall back to the
VirtualMachineInstance name itself. The resulting DNS A-record looks
like this then:
`<vmi.metadata.name>.<vmi.spec.subdomain>.<vmi.metadata.namespace>.svc.cluster.local`.
> **Note** To resolve short names like `myvmi.mysubdomain` using search domains, the guest's `/etc/resolv.conf` must include `options ndots:2` or higher.
> In a Linux guest if `options ndots` is not specified, the system defaults to `ndots:1` as indicated in resolver spec](https://man7.org/linux/man-pages/man5/resolv.conf.5.html).
> KubeVirt does not configure the guest system resolver. It can either be pre-configured in the VM image or configured at runtime using cloud-init.