1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/microshift-accessing-cluster-remotely.adoc
2024-09-11 18:18:40 +00:00

64 lines
2.4 KiB
Plaintext

// Module included in the following assemblies:
//
// microshift_install_rpm/microshift-install-rpm.adoc
// microshift_install_rpm_ostree/microshift-embed-in-rpm-ostree.adoc
// microshift_configuring/microshift-cluster-access-kubeconfig.adoc
:_mod-docs-content-type: PROCEDURE
[id="accessing-microshift-cluster-remotely_{context}"]
= Accessing the {microshift-short} cluster remotely
Use the following procedure to access the {microshift-short} cluster from a remote location by using a `kubeconfig` file.
The `user@workstation` login is used to access the host machine remotely. The `<user>` value in the procedure is the name of the user that `user@workstation` logs in with to the {microshift-short} host.
.Prerequisites
* You have installed the `oc` binary.
* The `user@microshift` has opened the firewall from the local host.
.Procedure
. As `user@workstation`, create a `~/.kube/` folder if your {op-system} machine does not have one by running the following command:
+
[source,terminal,subs="attributes+"]
----
[user@workstation]$ mkdir -p ~/.kube/
----
. As `user@workstation`, set a variable for the hostname of your {microshift-short} host by running the following command:
+
[source,terminal,subs="attributes+"]
----
[user@workstation]$ MICROSHIFT_MACHINE=<name or IP address of {microshift-short} machine>
----
. As `user@workstation`, copy the generated `kubeconfig` file that contains the host name or IP address you want to connect with from the {op-system} machine running {microshift-short} to your local machine by running the following command:
+
[source,terminal]
----
[user@workstation]$ ssh <user>@$MICROSHIFT_MACHINE "sudo cat /var/lib/microshift/resources/kubeadmin/$MICROSHIFT_MACHINE/kubeconfig" > ~/.kube/config
----
+
[NOTE]
====
To generate the `kubeconfig` files for this step, see link:https://access.redhat.com/documentation/en-us/red_hat_build_of_microshift/{product-version}/html/configuring/microshift-kubeconfig#generating-additional-kubeconfig-files_microshift-kubeconfig[Generating additional kubeconfig files for remote access].
====
. As `user@workstation`, update the permissions on your `~/.kube/config` file by running the following command:
+
[source,terminal]
----
$ chmod go-r ~/.kube/config
----
.Verification
* As `user@workstation`, verify that {microshift-short} is running by entering the following command:
+
[source,terminal]
----
[user@workstation]$ oc get all -A
----