windows icon indicating copy to clipboard operation
windows copied to clipboard

[Question]: Kubernetes port forwarding 3389 (RDP)

Open TesterEric opened this issue 8 months ago • 1 comments

Is your question not already answered in the FAQ?

  • [x] I made sure the question is not listed in the FAQ.

Is this a general question and not a technical issue?

  • [x] I am sure my question is not about a technical issue.

Question

I want to run Dockurr\windows on a Kubernetes cluster.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: vpi-atf-deployment
  labels:
    name: vpi-atf
spec:
  replicas: 1
  selector:
    matchLabels:
      app: vpi-atf
  template:
    metadata:
      labels:
        app: vpi-atf
    spec:
      containers:
      - name: vpi-atf
        image: dockurr/windows
        env:
        - name: VERSION
          value: "11"
        - name: DISK_SIZE
          value: "64G"
        - name: USERNAME
          valueFrom:
            secretKeyRef:
              name: vpi-atf-secret
              key: vpi-atf-user
        - name: PASSWORD
          valueFrom:
            secretKeyRef:
              name: vpi-atf-secret
              key: vpi-atf-password
        ports:
          - containerPort: 8006
            name: http
            protocol: TCP
          - containerPort: 3389
            name: rdp-tcp
            protocol: TCP
          - containerPort: 3389
            name: rdp-udp
            protocol: UDP
          - containerPort: 5900
            name: vnc
            protocol: UDP
          - containerPort: 5985
            name: winrm
            protocol: TCP
        securityContext:
          capabilities:
            add:
            - NET_ADMIN
          privileged: true
        volumeMounts:
          - mountPath: /storage
            name: storage
          - mountPath: /dev/kvm
            name: dev-kvm
          - mountPath: /dev/net/tun
            name: dev-tun
          - mountPath: /oem
            name: vpi-atf-install-bat-file-volume
      terminationGracePeriodSeconds: 120
      volumes:
        - name: storage
          persistentVolumeClaim:
            claimName: vpi-atf-pvc
        - hostPath:
            path: /dev/kvm
          name: dev-kvm
        - hostPath:
            path: /dev/net/tun
            type: CharDevice
          name: dev-tun
        - name: vpi-atf-install-bat-file-volume
          configMap:
            name: vpi-atf-install-bat-file
---
apiVersion: v1
kind: Service
metadata:
  name: vpi-atf-service
spec:
  internalTrafficPolicy: Cluster
  ports:
    - name: http
      port: 8006
      protocol: TCP
      targetPort: 8006
    - name: rdp
      port: 3389
      protocol: TCP
      targetPort: 3389
    - name: udp
      port: 3389
      protocol: UDP
      targetPort: 3389
    - name: vnc
      port: 5900
      protocol: TCP
      targetPort: 5900
    - name: winrm
      port: 5985
      protocol: TCP
      targetPort: 5985
  selector:
    app: vpi-atf
  type: ClusterIP

Windows is correctly installed and up and running the cluster and with port forwarding (kubectl poport-forward <pod_name> 8006:8006) I can easily open the Windows UI in browser (localhost:8006).

There is an issue when trying to establish a RDP connection via port 3389. First port forwarding is done via kubectl poport-forward <pod_name> 3390:3389. Connecting to localhost:3390 (via Remote Desktop Connection on Windows local machine) results in:

Image

What is the reason that it is not possible to establish the RDP connection? My assumption (which is maybe not correct) is that port forwarding of port 8006 works in the same way is any other port.

TesterEric avatar May 08 '25 12:05 TesterEric