Skip to content

Commit 19d99d1

Browse files
authored
Merge pull request #55113 from sjhala-ccs/BZ2028490
BZ2028490: Updated procedures to connect to Windows VMs with RDP
2 parents 8fbccb6 + 52ffb26 commit 19d99d1

File tree

3 files changed

+86
-68
lines changed

3 files changed

+86
-68
lines changed

modules/virt-accessing-rdp-console.adoc

Lines changed: 78 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -6,71 +6,101 @@
66
[id="virt-accessing-rdp-console_{context}"]
77
= Connecting to a Windows virtual machine with an RDP console
88

9-
The Remote Desktop Protocol (RDP) provides a better console experience for
10-
connecting to Windows virtual machines.
11-
12-
To connect to a Windows virtual machine with RDP, specify the IP address of the
13-
attached L2 NIC to your RDP client.
9+
Create a Kubernetes `Service` object to connect to a Windows virtual machine (VM) by using your local Remote Desktop Protocol (RDP) client.
1410

1511
.Prerequisites
1612

17-
* A running Windows virtual machine with the QEMU guest agent installed. The
18-
`qemu-guest-agent` is included in the VirtIO drivers.
19-
* A layer 2 NIC attached to the virtual machine.
20-
* An RDP client installed on a machine on the same network as the
21-
Windows virtual machine.
13+
* A running Windows virtual machine with the QEMU guest agent installed. The `qemu-guest-agent` object is included in the VirtIO drivers.
14+
* An RDP client installed on your local machine.
2215
2316
.Procedure
2417

25-
. Log in to the {VirtProductName} cluster through the `oc` CLI tool as a user with
26-
an access token.
18+
. Edit the `VirtualMachine` manifest to add the label for service creation:
19+
+
20+
[source,yaml]
21+
----
22+
apiVersion: kubevirt.io/v1
23+
kind: VirtualMachine
24+
metadata:
25+
name: vm-ephemeral
26+
namespace: example-namespace
27+
spec:
28+
running: false
29+
template:
30+
metadata:
31+
labels:
32+
special: key <1>
33+
# ...
34+
----
35+
<1> Add the label `special: key` in the `spec.template.metadata.labels` section.
36+
+
37+
38+
[NOTE]
39+
====
40+
Labels on a virtual machine are passed through to the pod. The `special: key` label must match the label in the `spec.selector` attribute of the `Service` manifest.
41+
====
42+
43+
. Save the `VirtualMachine` manifest file to apply your changes.
44+
. Create a `Service` manifest to expose the VM:
45+
+
46+
[source,yaml]
47+
----
48+
apiVersion: v1
49+
kind: Service
50+
metadata:
51+
name: rdpservice <1>
52+
namespace: example-namespace <2>
53+
spec:
54+
ports:
55+
- targetPort: 3389 <3>
56+
protocol: TCP
57+
selector:
58+
special: key <4>
59+
type: NodePort <5>
60+
# ...
61+
----
62+
<1> The name of the `Service` object.
63+
<2> The namespace where the `Service` object resides. This must match the `metadata.namespace` field of the `VirtualMachine` manifest.
64+
<3> The VM port to be exposed by the service. It must reference an open port if a port list is defined in the VM manifest.
65+
<4> The reference to the label that you added in the `spec.template.metadata.labels` stanza of the `VirtualMachine` manifest.
66+
<5> The type of service.
67+
68+
. Save the `Service` manifest file.
69+
. Create the service by running the following command:
2770
+
2871
[source,terminal]
2972
----
30-
$ oc login -u <user> https://<cluster.example.com>:8443
73+
$ oc create -f <service_name>.yaml
3174
----
3275

33-
. Use `oc describe vmi` to display the configuration of the running
34-
Windows virtual machine.
76+
. Start the VM. If the VM is already running, restart it.
77+
. Query the `Service` object to verify that it is available:
3578
+
79+
[source, terminal]
80+
----
81+
$ oc get service -n example-namespace
82+
----
83+
+
84+
.Example output for `NodePort` service
3685
[source,terminal]
3786
----
38-
$ oc describe vmi <windows-vmi-name>
87+
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
88+
rdpservice NodePort 172.30.232.73 <none> 3389:30000/TCP 5m
89+
----
90+
91+
. Run the following command to obtain the IP address for the node:
92+
+
93+
[source,terminal]
94+
----
95+
$ oc get node <node_name> -o wide
3996
----
4097
+
4198
.Example output
42-
[source,yaml]
99+
[source,terminal]
43100
----
44-
...
45-
spec:
46-
networks:
47-
- name: default
48-
pod: {}
49-
- multus:
50-
networkName: cnv-bridge
51-
name: bridge-net
52-
...
53-
status:
54-
interfaces:
55-
- interfaceName: eth0
56-
ipAddress: 198.51.100.0/24
57-
ipAddresses:
58-
198.51.100.0/24
59-
mac: a0:36:9f:0f:b1:70
60-
name: default
61-
- interfaceName: eth1
62-
ipAddress: 192.0.2.0/24
63-
ipAddresses:
64-
192.0.2.0/24
65-
2001:db8::/32
66-
mac: 00:17:a4:77:77:25
67-
name: bridge-net
68-
...
101+
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP
102+
node01 Ready worker 6d22h v1.24.0 192.168.55.101 <none>
69103
----
70104

71-
. Identify and copy the IP address of the layer 2 network interface. This is
72-
`192.0.2.0` in the above example, or `2001:db8::` if you prefer IPv6.
73-
. Open an RDP client and use the IP address copied in the previous step for the
74-
connection.
75-
. Enter the *Administrator* user name and password to connect to the
76-
Windows virtual machine.
105+
. Specify the node IP address and the assigned port in your preferred RDP client.
106+
. Enter the user name and password to connect to the Windows virtual machine.

modules/virt-creating-a-service-from-a-virtual-machine.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,27 +79,27 @@ $ oc create -f <service_name>.yaml
7979
.Verification
8080
. Query the `Service` object to verify that it is available:
8181
+
82-
[source, terminal]
82+
[source,terminal]
8383
----
8484
$ oc get service -n example-namespace
8585
----
8686
+
8787
.Example output for `ClusterIP` service
88-
[source, terminal]
88+
[source,terminal]
8989
----
9090
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
9191
vmservice ClusterIP 172.30.3.149 <none> 27017/TCP 2m
9292
----
9393
+
9494
.Example output for `NodePort` service
95-
[source, terminal]
95+
[source,terminal]
9696
----
9797
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
9898
vmservice NodePort 172.30.232.73 <none> 27017:30000/TCP 5m
9999
----
100100
+
101101
.Example output for `LoadBalancer` service
102-
[source, terminal]
102+
[source,terminal]
103103
----
104104
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
105105
vmservice LoadBalancer 172.30.27.5 172.29.10.235,172.29.10.235 27017:31829/TCP 5s

modules/virt-vm-rdp-console-web.adoc

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,20 @@
66
[id="virt-vm-rdp-console-web_{context}"]
77
= Connecting to a Windows virtual machine with RDP
88

9-
The desktop viewer console, which utilizes the Remote Desktop Protocol (RDP),
10-
provides a better console experience for connecting to Windows virtual machines.
9+
The *Desktop viewer* console, which utilizes the Remote Desktop Protocol (RDP), provides a better console experience for connecting to Windows virtual machines.
1110

12-
To connect to a Windows virtual machine with RDP, download the `console.rdp` file for the virtual machine from the *Consoles* tab on the *VirtualMachine Details* page of the web console and supply it to your preferred RDP client.
11+
To connect to a Windows virtual machine with RDP, download the `console.rdp` file for the virtual machine from the *Console* tab on the *VirtualMachine details* page of the web console and supply it to your preferred RDP client.
1312

1413
.Prerequisites
1514

1615
* A running Windows virtual machine with the QEMU guest agent installed. The `qemu-guest-agent` is included in the VirtIO drivers.
17-
* A layer-2 NIC attached to the virtual machine.
1816
* An RDP client installed on a machine on the same network as the Windows virtual machine.
1917
2018
.Procedure
2119

2220
. In the {product-title} console, click *Virtualization* -> *VirtualMachines* from the side menu.
2321
. Click a Windows virtual machine to open the *VirtualMachine details* page.
2422
. Click the *Console* tab.
25-
. In the *Console* list, select *Desktop Viewer*.
26-
. In the *Network Interface* list, select the layer-2 NIC.
23+
. From the list of consoles, select *Desktop viewer*.
2724
. Click *Launch Remote Desktop* to download the `console.rdp` file.
28-
. Open an RDP client and reference the `console.rdp` file. For example, using
29-
*remmina*:
30-
+
31-
[source,terminal]
32-
----
33-
$ remmina --connect /path/to/console.rdp
34-
----
35-
36-
. Enter the *Administrator* user name and password to connect to the
37-
Windows virtual machine.
25+
. Reference the `console.rdp` file in your preferred RDP client to connect to the Windows virtual machine.

0 commit comments

Comments
 (0)