kubevirt / user-guide

This user guide will walk you through installation and various features.
https://kubevirt.io/user-guide
Apache License 2.0
64 stars 234 forks source link

Edit VM instead of VMI when exposing service objects #698

Open aburdenthehand opened 1 year ago

aburdenthehand commented 1 year ago

The service objects doc currently specify users edit the VMI object, however it seems as though this should be done on the VM (and restart if running).

This was raised on this thread: https://kubernetes.slack.com/archives/C8ED7RKFE/p1688475040764709

If this is the case, we should update this doc: https://github.com/kubevirt/user-guide/blame/main/docs/virtual_machines/service_objects.md

drssdinblck commented 1 year ago

To be even more specific: It seems like one must specify the label on the VM and on the VMI object (inside the template section of the VM resource). When specifying the VM as follows, I was able to expose VM ports via NodePort service objects:

yaml
apiVersion: kubevirt.io/v1
kind: VirtualMachine
metadata:
  labels:
    kubevirt.io/os: linux
    vmName: "__VM_NAME__"
  name: "__VM_NAME__"
spec:
  running: true
  template:
    metadata:
      creationTimestamp: null
      labels:
        kubevirt.io/domain: "__VM_NAME__"
        vmName: "__VM_NAME__"
    spec:
      domain:
        cpu:
          cores: __VM_CORES__
          model: host-passthrough
        devices:
          disks:
            - disk:
                bus: virtio
              name: disk0
            - cdrom:
                bus: sata
                readonly: true
              name: cloudinitdisk
          # see https://github.com/kubevirt/user-guide/pull/262/files
          rng: {}
        machine:
          type: q35
        resources:
          requests:
            memory: "__VM_MEMORY__"
      volumes:
        - name: disk0
          persistentVolumeClaim:
            claimName: "__VM_NAME__"
        - cloudInitNoCloud:
            userData: |
              #cloud-config
              hostname: __VM_NAME__
              ssh_pwauth: True
              disable_root: false
              ssh_authorized_keys:
              - __VM_SSH_PUBLIC_KEY__
          name: cloudinitdisk
kubevirt-bot commented 1 year ago

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

/lifecycle stale

kubevirt-bot commented 1 year ago

Stale issues rot after 30d of inactivity. Mark the issue as fresh with /remove-lifecycle rotten. Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

/lifecycle rotten

kubevirt-bot commented 9 months ago

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

/lifecycle stale

kubevirt-bot commented 8 months ago

Stale issues rot after 30d of inactivity. Mark the issue as fresh with /remove-lifecycle rotten. Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

/lifecycle rotten

dhiller commented 8 months ago

/remove-lifecycle rotten

chuot803 commented 6 months ago

Hi! I was wondering if this method of exposing the VM ports has been confirmed. If so, should this VM specification @drssdinblck commented be added to the doc?

kubevirt-bot commented 3 months ago

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

/lifecycle stale

kubevirt-bot commented 2 months ago

Stale issues rot after 30d of inactivity. Mark the issue as fresh with /remove-lifecycle rotten. Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

/lifecycle rotten

kubevirt-bot commented 1 month ago

Rotten issues close after 30d of inactivity. Reopen the issue with /reopen. Mark the issue as fresh with /remove-lifecycle rotten.

/close

kubevirt-bot commented 1 month ago

@kubevirt-bot: Closing this issue.

In response to [this](https://github.com/kubevirt/user-guide/issues/698#issuecomment-2387009090): >Rotten issues close after 30d of inactivity. >Reopen the issue with `/reopen`. >Mark the issue as fresh with `/remove-lifecycle rotten`. > >/close Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.
aburdenthehand commented 1 month ago

/remove-lifecycle rotten

anishbista60 commented 1 month ago

/assign

anishbista60 commented 1 month ago

@aburdenthehand please take a look.