Skip to content

Commit c784400

Browse files
authored
Merge pull request #60827 from danielclowers/CNV-26737
CNV-26737: RFE - Document how to enable plain ssh usage
2 parents 1630dc5 + af367b4 commit c784400

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * virt/virtual_machines/virt-using-openssh-and-virtctl-port-forward.adoc
4+
5+
:_content-type: PROCEDURE
6+
[id="virt-using-openssh-and-virtctl-port-forward_{context}"]
7+
= Using OpenSSH and virtctl port-forward
8+
9+
You can use your local OpenSSH client and the `virtctl port-forward` command to connect to a running virtual machine (VM). You can use this method with Ansible to automate the configuration of VMs.
10+
11+
This method is recommended for low-traffic applications because port-forwarding traffic is sent over the control plane. This method is not recommended for high-traffic applications such as Rsync or Remote Desktop Protocol because it places a heavy burden on the API server.
12+
13+
.Prerequisites
14+
* You have installed the `virtctl` client.
15+
* The virtual machine you want to access is running.
16+
* The environment where you installed the `virtctl` tool has the cluster permissions required to access the VM. For example, you ran `oc login` or you set the `KUBECONFIG` environment variable.
17+
18+
.Procedure
19+
20+
. Add the following text to the `~/.ssh/config` file on your client machine:
21+
+
22+
[source,terminal]
23+
----
24+
Host vm/*
25+
ProxyCommand virtctl port-forward --stdio=true %h %p
26+
----
27+
28+
. Connect to the VM by running the following command:
29+
+
30+
[source,terminal]
31+
----
32+
$ ssh <user>@vm/<vm_name>.<namespace>
33+
----

virt/virtual_machines/virt-accessing-vm-consoles.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ include::modules/virt-accessing-vmi-ssh.adoc[leveloffset=+2]
4242
* xref:../../virt/virtual_machines/vm_networking/virt-creating-service-vm.adoc#virt-creating-service-vm[Creating a service to expose a virtual machine]
4343
* xref:../../nodes/pods/nodes-pods-secrets.adoc#nodes-pods-secrets-about_nodes-pods-secrets[Understanding secrets]
4444

45+
include::modules/virt-using-openssh-and-virtctl-port-forward.adoc[leveloffset=+2]
46+
4547
include::modules/virt-accessing-serial-console.adoc[leveloffset=+2]
4648

4749
include::modules/virt-accessing-vnc-console.adoc[leveloffset=+2]

0 commit comments

Comments
 (0)