Bug 1795889 - internal IP shown on VMI spec instead of public one on VMI with guest-agent
Summary: internal IP shown on VMI spec instead of public one on VMI with guest-agent
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Container Native Virtualization (CNV)
Classification: Red Hat
Component: Networking
Version: 2.3.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: 2.4.0
Assignee: Vatsal Parekh
QA Contact: Meni Yakove
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-01-29 06:37 UTC by Vatsal Parekh
Modified: 2023-10-06 19:08 UTC (History)
6 users (show)

Fixed In Version: virt-handler-container-v2.4.0-33
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-07-28 19:09:38 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github kubevirt kubevirt pull 3063 0 None closed virt-handler should only update guest-agent details if interface doesn't have masquerade binding 2021-02-08 02:21:51 UTC
Red Hat Issue Tracker CNV-10898 0 None None None 2023-10-06 19:08:15 UTC
Red Hat Product Errata RHSA-2020:3194 0 None None None 2020-07-28 19:09:53 UTC

Description Vatsal Parekh 2020-01-29 06:37:17 UTC
Description of problem:
On latest kubevirt master, seeing that on a VMI with Masquerade and guest-agent  internal IP is reported on VMI spec instead of the Public one.

VMI Spec:
```
➜  kubevirt git:(master) ✗ kg vmi -o yaml
apiVersion: v1
items:
- apiVersion: kubevirt.io/v1alpha3
  kind: VirtualMachineInstance
  metadata:
    annotations:
      kubevirt.io/latest-observed-api-version: v1alpha3
      kubevirt.io/storage-observed-api-version: v1alpha3
    creationTimestamp: "2020-01-29T06:14:23Z"
    finalizers:
    - foregroundDeleteVirtualMachine
    generation: 12
    labels:
      kubevirt.io/nodeName: node01
      special: vmi-fedora
    name: vmi-fedora
    namespace: default
    resourceVersion: "4930"
    selfLink: /apis/kubevirt.io/v1alpha3/namespaces/default/virtualmachineinstances/vmi-fedora
    uid: 982783a7-425e-11ea-a68b-525500d15501
  spec:
    domain:
      devices:
        disks:
        - disk:
            bus: virtio
          name: containerdisk
        - disk:
            bus: virtio
          name: cloudinitdisk
        interfaces:
        - masquerade: {}
          name: default
        rng: {}
      features:
        acpi:
          enabled: true
      firmware:
        uuid: 2f94b14b-e614-482c-a308-a66cec020cae
      machine:
        type: q35
      resources:
        requests:
          cpu: 100m
          memory: 1024M
    networks:
    - name: default
      pod: {}
    terminationGracePeriodSeconds: 0
    volumes:
    - containerDisk:
        image: registry:5000/kubevirt/fedora-cloud-container-disk-demo:devel
        imagePullPolicy: IfNotPresent
      name: containerdisk
    - cloudInitNoCloud:
        userData: |-
          #cloud-config
          password: fedora
          chpasswd: { expire: False }
      name: cloudinitdisk
  status:
    conditions:
    - lastProbeTime: null
      lastTransitionTime: null
      status: "True"
      type: LiveMigratable
    - lastProbeTime: "2020-01-29T06:19:22Z"
      lastTransitionTime: null
      status: "True"
      type: AgentConnected
    - lastProbeTime: null
      lastTransitionTime: "2020-01-29T06:14:30Z"
      status: "True"
      type: Ready
    guestOSInfo:
      id: fedora
      kernelRelease: 4.18.16-300.fc29.x86_64
      kernelVersion: '#1 SMP Sat Oct 20 23:24:08 UTC 2018'
      name: Fedora
      prettyName: Fedora 29 (Cloud Edition)
      version: "29"
      versionId: "29"
    interfaces:
    - interfaceName: eth0
      ipAddress: 10.0.2.2/24
      ipAddresses:
      - 10.0.2.2/24
      - fe80::ff:fe21:c02d/64
      mac: 02:00:00:21:c0:2d
      name: default
    migrationMethod: BlockMigration
    nodeName: node01
    phase: Running
    qosClass: Burstable
kind: List
metadata:
  resourceVersion: ""
  selfLink: ""
➜  kubevirt git:(master) ✗ kg vmi,po -o wide
NAME                                            AGE   PHASE     IP            NODENAME   LIVE-MIGRATABLE
virtualmachineinstance.kubevirt.io/vmi-fedora   6m    Running   10.0.2.2/24   node01     True

NAME                                 READY   STATUS    RESTARTS   AGE   IP            NODE     NOMINATED NODE   READINESS GATES
pod/local-volume-provisioner-bvst4   1/1     Running   0          23m   10.244.0.6    node01   <none>           <none>
pod/virt-launcher-vmi-fedora-8fd6c   2/2     Running   0          6m    10.244.0.23   node01   <none>           <none>
```

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

How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:
reports the internal IP

Expected results:
Should have reported the public IP with Masquerade 

Additional info:

Comment 1 Petr Horáček 2020-02-27 13:02:43 UTC
Vatsal is working on a fix in https://github.com/kubevirt/kubevirt/pull/3063

Comment 2 Petr Horáček 2020-03-17 19:39:24 UTC
Since this is not a blocker and will likely need some additional work on API as discussed on the community call, I'm targeting this to 2.4.

Comment 3 yzaindbe 2020-06-09 02:11:04 UTC
Test Environment :
==================

$ oc version
Client Version: 4.5.0-rc.1
Server Version: 4.5.0-rc.1
Kubernetes Version: v1.18.3+a637491

CNV Version
$ oc get csv -n openshift-cnv | awk ' { print $4 } ' | tail -n1
2.4.0

Steps:
=====

Bug Summary: Vmi with Masquerade and guest-agent shows on spec the internal IP instead of the virt-launcher Pods IP.
Fix: Vmi will show the same IP of the virt-launcher Pod.

1. Create Vm with Masquerade

$ oc create -f vm-fedora.yaml
$ virtctl start vm-fedora

2. start guest-agent on vmi

$ virtctl console vm-fedora
[fedora@vm-fedora ~]$ sudo yum install -y qemu-guest-agent
[fedora@vm-fedora ~]$ sudo systemctl start qemu-guest-agent
[fedora@vm-fedora ~]$ sudo systemctl enable qemu-guest-agent

3. see in vmi status:conditions: that AgentConnected

$ oc get vmi vm-fedora -o yaml
apiVersion: kubevirt.io/v1alpha3
kind: VirtualMachineInstance
metadata:
  annotations:
    kubevirt.io/latest-observed-api-version: v1alpha3
    kubevirt.io/storage-observed-api-version: v1alpha3
  creationTimestamp: "2020-06-09T01:45:52Z"
  finalizers:
  - foregroundDeleteVirtualMachine
  generateName: vm-fedora
  generation: 11
  labels:
    kubevirt-vm: vm-fedora
    kubevirt.io/nodeName: host-172-16-0-34
  managedFields:
  - apiVersion: kubevirt.io/v1alpha3
    fieldsType: FieldsV1
    fieldsV1:
      f:metadata:
        f:annotations:
          .: {}
          f:kubevirt.io/latest-observed-api-version: {}
          f:kubevirt.io/storage-observed-api-version: {}
        f:generateName: {}
        f:labels:
          .: {}
          f:kubevirt-vm: {}
          f:kubevirt.io/nodeName: {}
        f:ownerReferences: {}
      f:spec:
        .: {}
        f:domain:
          .: {}
          f:cpu:
            .: {}
            f:cores: {}
          f:devices:
            .: {}
            f:disks: {}
            f:interfaces: {}
            f:rng: {}
          f:firmware:
            .: {}
            f:uuid: {}
          f:machine:
            .: {}
            f:type: {}
          f:resources:
            .: {}
            f:requests:
              .: {}
              f:memory: {}
        f:networks: {}
        f:terminationGracePeriodSeconds: {}
        f:volumes: {}
      f:status:
        .: {}
        f:activePods:
          .: {}
          f:493851dd-eafb-4403-aed7-5f35cf9c7a60: {}
        f:guestOSInfo: {}
        f:nodeName: {}
        f:qosClass: {}
    manager: virt-controller
    operation: Update
    time: "2020-06-09T01:46:00Z"
  - apiVersion: kubevirt.io/v1alpha3
    fieldsType: FieldsV1
    fieldsV1:
      f:status:
        f:conditions: {}
        f:guestOSInfo:
          f:id: {}
          f:kernelRelease: {}
          f:kernelVersion: {}
          f:name: {}
          f:prettyName: {}
          f:version: {}
          f:versionId: {}
        f:interfaces: {}
        f:migrationMethod: {}
        f:phase: {}
    manager: virt-handler
    operation: Update
    time: "2020-06-09T01:58:12Z"
  name: vm-fedora
  namespace: default
  ownerReferences:
  - apiVersion: kubevirt.io/v1alpha3
    blockOwnerDeletion: true
    controller: true
    kind: VirtualMachine
    name: vm-fedora
    uid: 4b36bab9-8012-4715-9404-1e876549d9c9
  resourceVersion: "1571484"
  selfLink: /apis/kubevirt.io/v1alpha3/namespaces/default/virtualmachineinstances/vm-fedora
  uid: c9f0ac70-da18-4422-aaf0-ce357718f55c
spec:
  domain:
    cpu:
      cores: 1
    devices:
      disks:
      - disk:
          bus: virtio
        name: disk0
      - disk:
          bus: virtio
        name: cloudinitdisk
      interfaces:
      - masquerade: {}
        name: default
      rng: {}
    features:
      acpi:
        enabled: true
    firmware:
      uuid: c9dc132f-1bb1-5f88-9891-deed35a6d803
    machine:
      type: pc-q35-rhel8.2.0
    resources:
      requests:
        cpu: 100m
        memory: 2Gi
  networks:
  - name: default
    pod: {}
  terminationGracePeriodSeconds: 0
  volumes:
  - containerDisk:
      image: kubevirt/fedora-cloud-container-disk-demo:latest
      imagePullPolicy: Always
    name: disk0
  - cloudInitNoCloud:
      userData: |-
        #cloud-config
        password: fedora
        chpasswd: { expire: False }
    name: cloudinitdisk
status:
  activePods:
    493851dd-eafb-4403-aed7-5f35cf9c7a60: host-172-16-0-34
  conditions:
  - lastProbeTime: null
    lastTransitionTime: null
    status: "True"
    type: LiveMigratable
  - lastProbeTime: null
    lastTransitionTime: "2020-06-09T01:45:59Z"
    status: "True"
    type: Ready
  - lastProbeTime: "2020-06-09T01:58:12Z"
    lastTransitionTime: null
    status: "True"
    type: AgentConnected
  guestOSInfo:
    id: fedora
    kernelRelease: 5.6.6-300.fc32.x86_64
    kernelVersion: '#1 SMP Tue Apr 21 13:44:19 UTC 2020'
    name: Fedora
    prettyName: Fedora 32 (Cloud Edition)
    version: "32"
    versionId: "32"
  interfaces:
  - interfaceName: eth0
    ipAddress: 10.128.2.141
    mac: 02:00:00:42:f6:15
    name: default
  migrationMethod: BlockMigration
  nodeName: host-172-16-0-34
  phase: Running
  qosClass: Burstable

4. Verify that vmi IP is the same as virt-launcher pod IP.

$ oc get pod,vmi -o wide
NAME                                READY   STATUS    RESTARTS   AGE   IP             NODE               NOMINATED NODE   READINESS GATES
pod/virt-launcher-vm-fedora-4kgmx   2/2     Running   0          21m   10.128.2.141   host-172-16-0-34   <none>           <none>

NAME                                           AGE   PHASE     IP             NODENAME           LIVE-MIGRATABLE
virtualmachineinstance.kubevirt.io/vm-fedora   21m   Running   10.128.2.141   host-172-16-0-34   True

Comment 9 errata-xmlrpc 2020-07-28 19:09:38 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2020:3194


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