mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 12:46:18 +01:00
34 lines
1.3 KiB
Plaintext
34 lines
1.3 KiB
Plaintext
// Module included in the following assemblies:
|
|
//
|
|
// * virt/virtual_machines/virt-accessing-vm-ssh.adoc
|
|
|
|
:_mod-docs-content-type: PROCEDURE
|
|
[id="virt-using-virtctl-port-forward-command_{context}"]
|
|
= Using the virtctl port-forward command
|
|
|
|
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.
|
|
|
|
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.
|
|
|
|
.Prerequisites
|
|
* You have installed the `virtctl` client.
|
|
* The virtual machine you want to access is running.
|
|
* 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.
|
|
|
|
.Procedure
|
|
|
|
. Add the following text to the `~/.ssh/config` file on your client machine:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
Host vm/*
|
|
ProxyCommand virtctl port-forward --stdio=true %h %p
|
|
----
|
|
|
|
. Connect to the VM by running the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ ssh <user>@vm/<vm_name>.<namespace>
|
|
----
|