Bug 1888830 - NodePort service no longer connected after stopping then starting virtual machine
Summary: NodePort service no longer connected after stopping then starting virtual mac...
Keywords:
Status: CLOSED WORKSFORME
Alias: None
Product: Container Native Virtualization (CNV)
Classification: Red Hat
Component: Networking
Version: 2.4.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: ---
Assignee: Petr Horáček
QA Contact: Meni Yakove
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-10-15 20:43 UTC by Lars Kellogg-Stedman
Modified: 2020-10-23 15:40 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-10-23 15:21:30 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Lars Kellogg-Stedman 2020-10-15 20:43:54 UTC
Description of problem:

After creating a virtual machine, I exposed the ssh port with the following command:

   virtctl expose vm lars-test-vm-1  --port=22 --name=lars-test-ssh --type=NodePort

Which generated the following service:

  clusterIP: 172.30.94.110
  externalTrafficPolicy: Cluster
  ports:
    - nodePort: 32733
      port: 22
      protocol: TCP
      targetPort: 22
  selector:
    flavor.template.kubevirt.io/medium: 'true'
    kubevirt.io/domain: lars-test-vm-1
    kubevirt.io/size: medium
    os.template.kubevirt.io/silverblue32: 'true'
    vm.kubevirt.io/name: lars-test-vm-1
    workload.template.kubevirt.io/server: 'true'
  sessionAffinity: None
  type: NodePort

This worked fine and I was able to connect to the virtual machine by running "ssh -p 32733 <worker-hostname>".

I then stopped the virtual machine:

  virtcl stop lars-test-vm-1

And restarted it:

  virtctl start lars-test-vm-1

Now I am no longer able to connect to the ssh port on the virtual machine. Additionally, if I delete the service and re-run the `virtctl expose` command, the new NodePort is also unable to connect.

Version-Release number of selected component (if applicable):

OCP 4.5.13 baremetal
CNV 2.4.2

How reproducible:


Steps to Reproduce:
1. start new virtual machine
2. expose a service using 'virtctl expose ... --type=NodePort'
3. stop the virtual machine
4. start the virtual machine

Actual results:

NodePort can no longer access the virtual machine

Expected results:

I am able to connect to a virtual machine after restarting it.

Comment 1 Petr Horáček 2020-10-19 08:22:09 UTC
Lars, does the VM have IP configured after the restart? Services aside, are you able to ping outside network from the VM after the restart?

Comment 2 Lars Kellogg-Stedman 2020-10-23 15:21:30 UTC
Petr,

I can't reproduce the behavior I was seeing, so maybe something else was going on. There's been an OCP upgrade and a complete power shutdown/restart since then. Maybe I just hadn't had enough coffee.

Comment 3 Petr Horáček 2020-10-23 15:40:57 UTC
Hehe, no worries man! I suspect it may have been caused by the guest IP configuration. Sometimes the guest uses its DHCP client on the first boot but (unless configured by the user) not on the second+. Please let me know if this happens again.


Note You need to log in before you can comment on or make changes to this bug.