Not able to access Service running in Kubevirt-VM throght POD IP / Cluster IP / Route in OKD 3.11

294 views
Skip to first unread message

CHINTAN KANADIA

unread,
May 13, 2019, 2:58:54 PM5/13/19
to kubevirt-dev
Hi,

Not able to access Service running in Kubevirt-VM throght POD IP / Cluster IP / Route in OKD 3.11

Can anyone help how to access service running in Kubevirt VM ?

Thank You

Chintan

Roman Mohr

unread,
May 14, 2019, 2:27:28 AM5/14/19
to CHINTAN KANADIA, kubevirt-dev
Hi,

On Mon, May 13, 2019 at 8:59 PM CHINTAN KANADIA <huremot...@gmail.com> wrote:
Hi,

Not able to access Service running in Kubevirt-VM throght POD IP / Cluster IP / Route in OKD 3.11


Could you share your VMI and service definition? Can you access the VMI via `virtctl console` or `virtctl vnc`?

Best regards,
Roman
 
Can anyone help how to access service running in Kubevirt VM ?

Thank You

Chintan

--
You received this message because you are subscribed to the Google Groups "kubevirt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubevirt-dev...@googlegroups.com.
To post to this group, send email to kubevi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kubevirt-dev/d4b39983-f853-4a54-a09a-345d56f7e716%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

CHINTAN KANADIA

unread,
May 14, 2019, 10:54:09 AM5/14/19
to kubevirt-dev
Yes, Please find attachment as VMI - yaml defination.

yes, I am able to access VM through `virtctl console` or `virtctl vnc`

I can Access Internet from VM & but not able to access Service running on VM ( I can access service on Localhost on VM ) and Also not from other VM running in Same namespace.

Following are my ifconfig of VM


49.png




On Tuesday, May 14, 2019 at 2:27:28 AM UTC-4, Roman Mohr wrote:
Hi,

On Mon, May 13, 2019 at 8:59 PM CHINTAN KANADIA <huremot...@gmail.com> wrote:
Hi,

Not able to access Service running in Kubevirt-VM throght POD IP / Cluster IP / Route in OKD 3.11


Could you share your VMI and service definition? Can you access the VMI via `virtctl console` or `virtctl vnc`?

Best regards,
Roman
 
Can anyone help how to access service running in Kubevirt VM ?

Thank You

Chintan

--
You received this message because you are subscribed to the Google Groups "kubevirt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubevi...@googlegroups.com.
ubuntu-vm.yaml

Sebastian Scheinkman

unread,
May 14, 2019, 11:08:23 AM5/14/19
to kubevirt-dev
Hi chintan,

Thanks for posting the yaml.

I think the issue is that you need to configure Ports in the interface section.

for example:

interfaces:
- bootOrder: 2
  masquerade: {}
  name: nic0
  ports:
    - name: http
      port: 80
      protocol: TCP

please tell me if the fix your problem.
you will be able to add as many ports as you machine expose

Thanks!
Sebastian

CHINTAN KANADIA

unread,
May 14, 2019, 4:11:19 PM5/14/19
to kubevirt-dev
Thanks Sebastian for reply.

But still not able to access service after adding ports as you suggested into yaml

Thanks again

Roman Mohr

unread,
May 15, 2019, 2:41:06 AM5/15/19
to CHINTAN KANADIA, kubevirt-dev
On Tue, May 14, 2019 at 4:54 PM CHINTAN KANADIA <huremot...@gmail.com> wrote:
Yes, Please find attachment as VMI - yaml defination.

yes, I am able to access VM through `virtctl console` or `virtctl vnc`

I can Access Internet from VM & but not able to access Service running on VM ( I can access service on Localhost on VM ) and Also not from other VM running in Same namespace.


Can you reach your app inside the VM also on enp1s0 or only on localhost?
Can you also share your service definition? Also ensure that your service has a label selector for `vm.kubevirt.io/name: ubuntu`.

You can also try to access the ip from the VMI directly from another pod or another VMI.

Best Regards,
Roman

 
Following are my ifconfig of VM

That looks good in general.

Best Regards,
Roman 


49.png




On Tuesday, May 14, 2019 at 2:27:28 AM UTC-4, Roman Mohr wrote:
Hi,

On Mon, May 13, 2019 at 8:59 PM CHINTAN KANADIA <huremot...@gmail.com> wrote:
Hi,

Not able to access Service running in Kubevirt-VM throght POD IP / Cluster IP / Route in OKD 3.11


Could you share your VMI and service definition? Can you access the VMI via `virtctl console` or `virtctl vnc`?

Best regards,
Roman
 
Can anyone help how to access service running in Kubevirt VM ?

Thank You

Chintan

--
You received this message because you are subscribed to the Google Groups "kubevirt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubevi...@googlegroups.com.
To post to this group, send email to kubevi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kubevirt-dev/d4b39983-f853-4a54-a09a-345d56f7e716%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "kubevirt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubevirt-dev...@googlegroups.com.

To post to this group, send email to kubevi...@googlegroups.com.

CHINTAN KANADIA

unread,
May 15, 2019, 11:47:13 AM5/15/19
to kubevirt-dev
Hi Roman,

Thanks for reply, following are answer of your question.

Can you reach your app inside the VM also on enp1s0 or only on localhost?

- Yes on both enp1s0 & local host.

Can you also share your service definition?

kind: Service
apiVersion: v1
metadata:
  name: cockpit
  namespace: vnc
  selfLink: /api/v1/namespaces/vnc/services/fedora
  uid: eafa63e5-6f27-11e9-88bf-78e3b51df240
  resourceVersion: '64482654'
  creationTimestamp: '2019-05-05T11:21:24Z'
spec:
  ports:
    - name: cockpit
      protocol: TCP
      port: 9090
      targetPort: 9090
  selector:
    vm.kubevirt.io/name: ubuntu
  clusterIP: 172.30.7.18
  type: ClusterIP
  sessionAffinity: None
status:
  loadBalancer: {}

You can also try to access the ip from the VMI directly from another pod or another VMI.

Yes I tried but not get into.

Thanks again
 

Sebastian Scheinkman

unread,
May 15, 2019, 12:29:10 PM5/15/19
to kubevirt-dev
Can you please run 
kubectl exec -it <virt-launcher-pod> -c compute bash 

then inside the pod run

iptables -vnL
and
iptables -t nat -vnL

and also please run 

kubectl get endpoints cockpit -n vnc

kubectl describe pod <virt-launcher-pod>


Thanks!
Sebastian

CHINTAN KANADIA

unread,
May 15, 2019, 1:30:41 PM5/15/19
to kubevirt-dev
Hi Sebastian,

Thanks for reply, Please find output of requested commands into vir-launcher-pod:

$ iptables -vnL

Chain INPUT (policy ACCEPT 44 packets, 4272 bytes)                                                                                                                                                                 
pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 150K packets, 261M bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 42 packets, 3114 bytes)
pkts bytes target prot opt in out source destination


$ iptables -t nat -vnL


Chain PREROUTING (policy ACCEPT 617 packets, 44959 bytes)
pkts bytes target prot opt in out source destination
27 1668 KUBEVIRT_PREINBOUND all -- eth0 * 0.0.0.0/0 0.0.0.0/0
Chain INPUT (policy ACCEPT 27 packets, 1668 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 1 packets, 427 bytes)
pkts bytes target prot opt in out source destination
Chain POSTROUTING (policy ACCEPT 2 packets, 755 bytes)
pkts bytes target prot opt in out source destination
589 42963 MASQUERADE all -- * * 10.0.2.2 0.0.0.0/0
2 755 KUBEVIRT_POSTINBOUND all -- * k6t-eth0 0.0.0.0/0 0.0.0.0/0
Chain KUBEVIRT_POSTINBOUND (1 references)
pkts bytes target prot opt in out source destination
Chain KUBEVIRT_PREINBOUND (1 references)
pkts bytes target prot opt in out source destination


$ kubectl get endpoints cockpit -n vnc

[root@master1 ~]# kubectl get endpoints cockpit -n vnc
NAME ENDPOINTS AGE
cockpit 10.129.8.19:9090 10d


[root@master1 ~]# kubectl describe pod virt-launcher-cockpit-n8b9d
Name: virt-launcher-cockpit-n8b9d
Namespace: vnc
Priority: 0
PriorityClassName: <none>
Node: pc5.myhu.cloud/192.168.152.5
Start Time: Tue, 14 May 2019 15:21:57 -0400
Labels: kubevirt.io=virt-launcher
Status: Running
IP: 10.129.8.19
Controlled By: VirtualMachineInstance/cockpit
Containers:
volumerootdisk:
Container ID: docker://58a6873db407b95f6e746555ced97040e94d50af1c792034cdaa5248d0245e60
Image: kubevirt/fedora30-cloud-container-disk-demo
Port: <none>
Host Port: <none>
Command:
/entry-point.sh
State: Running
Started: Tue, 14 May 2019 15:22:24 -0400
Ready: True
Restart Count: 0
Readiness: exec [cat /tmp/healthy] delay=2s timeout=5s period=5s #success=2 #failure=5
Environment:
COPY_PATH: /var/run/kubevirt-ephemeral-disks/container-disk-data/vnc/cockpit/disk_rootdisk/disk-image
Mounts:
/var/run/kubevirt-ephemeral-disks from ephemeral-disks (rw)
compute:
Container ID: docker://480bd16fa1dcd037ce35a4748b01c03a60f99013781b1572a6baec15deaa7e29
Port: <none>
Host Port: <none>
Command:
/usr/bin/virt-launcher
--qemu-timeout
5m
--name
cockpit
--uid
89feec95-767d-11e9-b50f-78e3b51df240
--namespace
vnc
--kubevirt-share-dir
/var/run/kubevirt
--ephemeral-disk-dir
/var/run/kubevirt-ephemeral-disks
--readiness-file
/var/run/kubevirt-infra/healthy
--grace-period-seconds
15
--hook-sidecars
0
--less-pvc-space-toleration
10
State: Running
Started: Tue, 14 May 2019 15:22:24 -0400
Ready: True
Restart Count: 0
Limits:
Requests:
memory: 2173849290
Readiness: exec [cat /var/run/kubevirt-infra/healthy] delay=2s timeout=5s period=2s #success=1 #failure=5
Environment: <none>
Mounts:
/var/run/kubevirt from virt-share-dir (rw)
/var/run/kubevirt-ephemeral-disks from ephemeral-disks (rw)
/var/run/kubevirt-infra from infra-ready-mount (rw)
/var/run/libvirt from libvirt-runtime (rw)
Conditions:
Type Status
Initialized True
Ready True
ContainersReady True
PodScheduled True
Volumes:
infra-ready-mount:
Type: EmptyDir (a temporary directory that shares a pod's lifetime)
Medium:
virt-share-dir:
Type: HostPath (bare host directory volume)
Path: /var/run/kubevirt
HostPathType:
libvirt-runtime:
Type: EmptyDir (a temporary directory that shares a pod's lifetime)
Medium:
ephemeral-disks:
Type: EmptyDir (a temporary directory that shares a pod's lifetime)
Medium:
QoS Class: Burstable
region=primary
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning Unhealthy 40m kubelet, pc5.myhu.cloud Readiness probe failed: rpc error: code = 2 desc = oci runtime error: exec failed: container_linux.go:247: starting container process caused "process_linux.go
:87: adding pid 10322 to cgroups caused \"failed to write 10322 to cgroup.procs: write /sys/fs/cgroup/cpu,cpuacct/kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod8a043887_767d_11e9_b50f_78e3b51df24
0.slice/docker-480bd16fa1dcd037ce35a4748b01c03a60f99013781b1572a6baec15deaa7e29.scope/cgroup.procs: invalid argument\""

Message has been deleted
Message has been deleted

Seba Sch

unread,
May 27, 2019, 4:34:25 AM5/27/19
to CHINTAN KANADIA, kubevirt-dev
Hi CHINTAN,

Can you please try to deploy the follow vmi object.

```
apiVersion: kubevirt.io/v1alpha3
kind: VirtualMachineInstance
metadata:
  labels:
    special: vmi-masquerade
  name: vmi-masquerade
spec:
  domain:
    devices:
      disks:
      - disk:
          bus: virtio
        name: containerdisk
      - disk:
          bus: virtio
        name: cloudinitdisk
      interfaces:
      - masquerade: {}
        name: testmasquerade

        ports:
        - name: http
          port: 80
          protocol: TCP
    machine:
      type: ""
    resources:
      requests:
        memory: 1024M
  networks:
  - name: testmasquerade
    pod: {}
  terminationGracePeriodSeconds: 0
  volumes:
  - containerDisk:
      image: kubevirt/fedora-cloud-container-disk-demo:latest
    name: containerdisk
  - cloudInitNoCloud:
      userData: |-
        #!/bin/bash
        echo "fedora" |passwd fedora --stdin
        yum install -y nginx
        systemctl enable nginx
        systemctl start nginx
    name: cloudinitdisk
```

the run the exec command into the virt-launcher pod and show me the output of the follow command.

iptables -vnL -t nat

Thanks!
Sebastian


On Mon, 27 May 2019 at 11:14, CHINTAN KANADIA <huremot...@gmail.com> wrote:
is this enough info or u need more ?

--
You received this message because you are subscribed to a topic in the Google Groups "kubevirt-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kubevirt-dev/JWlhXIWFX74/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kubevirt-dev...@googlegroups.com.

To post to this group, send email to kubevi...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages