How to reach spice server inside of kubernetes pod?

1/14/2021

I have a docker container that runs an Ubuntu image that then runs a windows vm via qemu-system-x86_64.

I can use spice to access the windows vm by sharing a port with the docker container and then I tell qemu-system-x86_64 to use that port for spice.

Running container:

docker run -p 5930:5930...

Inside of container:

qemu-system-x86_64 -spice port=5930,disable-ticketing...

This works from a remote machine on the same VPN by using this address:

spice://<server ip>:5930

I now have this container running in a kubernetes pod inside minikube, but I'm not sure what kind of service to use to access the spice server remotely.

-- Phillip Merritt
docker
kubernetes
qemu

1 Answer

1/14/2021

Use microk8s. Put your container into pod and create service with NodePort.

apiVersion: v1
kind: Pod
metadata:
  name: my-pod
spec:
  containers:
  - name: my-pod
    image: image here
    ports:
    - containerPort: 5930

apiVersion: v1
kind: Service
metadata:
  name: my-service
spec:
  type: NodePort
  selector:
    app: my-pod
  ports:
    - port: 5930
      nodePort: 30000

Now call http://server_ip:30000

-- Sekru
Source: StackOverflow