This example sets up two KubeVirt VMs connected to the cluster network via masquerade. These VMs can use their FQDN to access themselves locally and get from one to another over the cluster network.
Apply VMs and Services
kubectl apply -f vms.yaml
Wait for VMs to be running
kubectl wait vmi vm1 vm2 --for condition=Available
Connect to one of the VMs
virtctl console vm1 # login with fedora:fedora
Verify that FQDN of the VM can be resolved locally
sudo dnf install -y traceroute
traceroute vm1.default.svc.cluster.local
traceroute to vm1.default.svc.cluster.local (127.0.0.1), 30 hops max, 60 byte packets
1 localhost (127.0.0.1) 0.542 ms 0.400 ms 0.375 ms
Verify that it is possible to reach out to the second VM using the service name
ssh fedora@vm2.default.svc.cluster.local
The authenticity of host 'vm2.default.svc.cluster.local (10.96.130.9)' can't be established.
ECDSA key fingerprint is SHA256:nyj164Cw67561g1d7kO9TthUZtMfVyfWwFzuHn0LNjM.
ECDSA key fingerprint is MD5:d3:10:16:ff:1a:79:48:73:13:e2:61:d3:18:ee:a1:df.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'vm2.default.svc.cluster.local,10.96.130.9' (ECDSA) to the list of known host
s.
fedora@vm2.default.svc.cluster.local's password:
[fedora@vm2 ~]$