このコンテンツは選択した言語では利用できません。
Chapter 3. Accessing the MicroShift node with oc
Access a MicroShift node by using the OpenShift CLI (oc).
3.1. How to access the MicroShift node リンクのコピーリンクがクリップボードにコピーされました!
Access the MicroShift service by using the OpenShift CLI (oc).
- You can access the node from either the same machine running the MicroShift service or from a remote location.
- You can use this access to observe and administer workloads.
-
When using the following steps, choose the
kubeconfigfile that contains the hostname or IP address you want to connect to and place it in the relevant directory.
3.1.1. Accessing the MicroShift node locally リンクのコピーリンクがクリップボードにコピーされました!
Use the following procedure to access the MicroShift node locally by using a kubeconfig file.
Prerequisites
-
You have installed the
ocbinary.
Procedure
Optional: to create a
~/.kube/folder if your Red Hat Enterprise Linux (RHEL) machine does not have one, run the following command:$ mkdir -p ~/.kube/Copy the generated local access
kubeconfigfile to the~/.kube/directory by running the following command:$ sudo cat /var/lib/microshift/resources/kubeadmin/kubeconfig > ~/.kube/configUpdate the permissions on your
~/.kube/configfile by running the following command:$ chmod go-r ~/.kube/config
Verification
Verify that MicroShift is running by entering the following command:
$ oc get all -A
3.1.2. Opening the firewall for remote access to the MicroShift node リンクのコピーリンクがクリップボードにコピーされました!
You must open the firewall before a workstation user can access the MicroShift node remotely.
For this procedure, user@microshift is the user on the MicroShift host machine and is responsible for setting up that machine so that it can be accessed by a remote user on a separate workstation.
Prerequisites
-
You installed the OpenShift CLI (
oc). - Your account has cluster administration privileges.
Procedure
As
user@microshifton the MicroShift host, open the firewall port for the Kubernetes API server (6443/tcp) by running the following command:[user@microshift]$ sudo firewall-cmd --permanent --zone=public --add-port=6443/tcp && sudo firewall-cmd --reload
Verification
As
user@microshift, verify that MicroShift is running by entering the following command:[user@microshift]$ oc get all -A
3.1.3. Accessing the MicroShift node remotely リンクのコピーリンクがクリップボードにコピーされました!
Access the MicroShift service 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 host.
Prerequisites
-
You installed the OpenShift CLI (
oc). -
The
user@microshifthas opened the firewall from the local host. -
You generated additional
kubeconfigfiles.
Procedure
As
user@workstation, create a~/.kube/folder if your Red Hat Enterprise Linux (RHEL) machine does not have one by running the following command:[user@workstation]$ mkdir -p ~/.kube/As
user@workstation, set a variable for the hostname of your MicroShift host by running the following command:[user@workstation]$ MICROSHIFT_MACHINE=<name or IP address of MicroShift machine>As
user@workstation, copy the generatedkubeconfigfile that contains the hostname or IP address you want to connect to from the RHEL machine running MicroShift to your local machine by running the following command:[user@workstation]$ ssh <user>@$MICROSHIFT_MACHINE "sudo cat /var/lib/microshift/resources/kubeadmin/$MICROSHIFT_MACHINE/kubeconfig" > ~/.kube/configReplace <user> with your SSH login credentials.
As
user@workstation, update the permissions on your~/.kube/configfile by running the following command:$ chmod go-r ~/.kube/config
Verification
As
user@workstation, verify that MicroShift is running by entering the following command:[user@workstation]$ oc get all -A