I have a k8s cluster in cent Os7 and a Windows virtual machine instance running in same cluster as pod. There is a service running in windows on port 9092. I have created a nodeport for that service to access outside cluster but its not working... Can anyone help?
---
apiVersion: kubevirt.io/v1alpha3
kind: VirtualMachineInstance
metadata:
name: win10-vm
labels:
special: key
spec:
domain:
devices:
interfaces:
- name: default
masquerade: {}
model: virtio
disks:
- disk:
bus: sata
name: dvdisk
- cdrom:
bus: sata
name: virtiocontainerdisk
machine:
type: "q35"
resources:
requests:
memory: 8G
networks:
- name: default
pod: {} # Stock pod network
terminationGracePeriodSeconds: 0
volumes:
- name: dvdisk
dataVolume:
name: windows-datavolume
- name: virtiocontainerdisk
containerDisk:
image: quay.io/kubevirt/virtio-container-disk
status: {}
```
apiVersion: v1
kind: Service
metadata:
name: nodeport
spec:
externalTrafficPolicy: Cluster
ports:
- name: nodeport
nodePort: 30000
port: 9092
protocol: TCP
targetPort: 9092
selector:
special: key
type: NodePort
```
#Disabled windows firewall
As you are using TCP Protocol Port should be 80. Port and Target port should be different. Try below service and have a check once :
Refer this doc for more information on NodePort and Its service YAML Example.
Let me know if this resolves your issue.