Skip to content

Commit

Permalink
Update VM instead of VMI when exposing service objects
Browse files Browse the repository at this point in the history
Signed-off-by: Anish Bista <[email protected]>
  • Loading branch information
anishbista60 committed Oct 9, 2024
1 parent cb94ad9 commit 355a084
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion docs/network/service_objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@ port inside the cluster network:

## Expose VirtualMachineInstance as a NodePort Service

To expose a VirtualMachineInstance via a NodePort service, you must ensure that the VirtualMachine (VM) resource includes the proper labels in the template section. This is crucial to allow the service to correctly associate with the VM's underlying pod.

```yaml
template:
metadata:
labels:
kubevirt.io/domain: "__VM_NAME__"
vmName: "__VM_NAME__"
```
Expose the SSH port (22) of a VirtualMachineInstance running on KubeVirt
by creating a `NodePort` service:

Expand All @@ -101,7 +110,7 @@ spec:
protocol: TCP
targetPort: 22
selector:
special: key
vmName: "__VM_NAME__"
type: NodePort
```

Expand Down

0 comments on commit 355a084

Please sign in to comment.