Closed sharadregoti closed 1 month ago
Please confirm:
You can access 10.43.0.10 IP in the VM No
ubuntu@node-01:~$ nc -zv 10.43.0.10 53 nc: connect to 10.43.0.10 port 53 (tcp) failed: Connection refused ubuntu@node-01:~$
You can access internet in canonical Pods Yes,
- Using netshoot
kubectl run netshoot --image=nicolaka/netshoot --rm -it --restart=Never --command -- dig +short google.com 216.58.211.238 pod "netshoot" deleted
- Use the ssh example from virtlink readme
export VM_NAME=ubuntu-container-rootfs export VM_POD_NAME=$(kubectl get vm $VM_NAME -o jsonpath='{.status.vmPodName}') export VM_IP=$(kubectl get pod $VM_POD_NAME -o jsonpath='{.status.podIP}') kubectl run ssh-$VM_NAME --rm --image=alpine --restart=Never -it -- /bin/sh -c "apk add openssh-client && ssh ubuntu@$VM_IP" --- kubeclt exec.... commands apk add curl / # curl google.com <HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8"> <TITLE>301 Moved</TITLE></HEAD><BODY> <H1>301 Moved</H1> The document has moved <A HREF="http://www.google.com/">here</A>. </BODY></HTML> / #
You can access internet in the VM Pod No
- Tried with my custom images as well as the image from the example from readme.md
/ # vi /etc/resolv.conf / # cat /etc/resolv.conf nameserver 10.43.0.10 search default.svc.cluster.local svc.cluster.local cluster.local options ndots:5 / # dig sh: dig: not found / # curl google.com curl: (6) Could not resolve host: google.com / #
google.com
, but when I ssh into the VM (using the readme commands). I am getting internet.ubuntu@ubuntu-container-rootfs:~$ curl google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>
ubuntu@ubuntu-container-rootfs:~$
I do observer that during that start just for 15-20 seconds the VM has internet, then it suddenly stop working.
ubuntu@node-01:~$ curl google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>
ubuntu@node-01:~$ curl google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>
ubuntu@node-01:~$ curl google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>
ubuntu@node-01:~$ curl google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>
ubuntu@node-01:~$ curl google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>
ubuntu@node-01:~$ curl google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>
ubuntu@node-01:~$ curl google.com
curl: (6) Could not resolve host: google.com
ubuntu@node-01:~$ curl google.com
curl: (6) Could not resolve host: google.com
ubuntu@node-01:~$
You can try reproducing the behaviour with the below spec
apiVersion: virt.virtink.smartx.com/v1alpha1
kind: VirtualMachine
metadata:
labels:
app.kubernetes.io/managed-by: Helm
virtlink.io/os: linux
virtlink.io/vm: node-01
name: node-01
spec:
instance:
cpu:
coresPerSocket: 1
sockets: 1
disks:
- name: image
- name: cloud-init
interfaces:
- bridge: {}
name: pod
memory:
size: 2Gi
networks:
- name: pod
pod: {}
resources: {}
runPolicy: Once
volumes:
- containerRootfs:
image: sharadregoti/vm-kubernetes:ubuntu-jammy-v1.29-v0.1.0
size: 10Gi
name: image
- cloudInit:
userData: |-
#cloud-config
hostname: node-01
password: ubuntu
chpasswd: { expire: False }
package_update: true
package_upgrade: true
name: cloud-init
I'm getting a little bit confused here.
The strange thing is that though from using the example from readme, the VM pod does not resolve google.com, but when I ssh into the VM (using the readme commands). I am getting internet.
Are you saying that you can access internet from the official example VM? If so, it could means there's something wrong with you custom image, maybe something related to network configs or DHCP things.
From the spec you shared, you were using the Pod network? If so, it's expected that you cannot access the internet from the VM pod, since Virtink would move VM pod's MAC and IP to the VM.
The issue was with my custom VM image. After trying a new approach it worked.
This is my virtual machine config
Network Debugging Logs
Other pods can access the internet with the same core DNS configuration.
With this configuration the VM is created but it has not internet. Because DNS resolution is not working. The DNS IP retrieved from DHCP is 10.43.0.10 (kube-dns) service IP.
I am getting timeout errors, whenever trying to resolve a domain name from the VM. Note, I am able to SSH into the VM (because it connected to my pod network).
Note: If I add 8.8.8.8 to /etc/resolv.conf. I am able to access the internet