cancel
Showing results for 
Search instead for 
Did you mean: 
simplyedwin
Mission Specialist
Mission Specialist
  • 3,146 Views

Login via SSH for RHOCP

Hi,

Is this the way to login RHOCP via ssh ?

ssh $RHT_OCP4_DEV_USER@$R HT_OCP4_MASTER_API

Labels (1)
4 Replies
simplyedwin
Mission Specialist
Mission Specialist
  • 3,116 Views

Apparently, it will gives you the following error if you tried it in the lab environment:

ssh: cannot resolve hostname ${RHT_OCP4_MASTER_API}: Name or service not known

Anyone has any idea ?

jordisola
Flight Engineer
Flight Engineer
  • 2,965 Views

Hi Simplyedwin

Can you clarify what are you trying to accomplish?

ssh $RHT_OCP4_DEV_USER@$RHT_OCP4_MASTER_API seems not appropriate: you are trying to establish an SSH connection to a REST (HTTPS) API, hence it will not work.

Are you maybe trying to connect to a container inside OCP? Or maybe you want to ssh into one of the nodes of the OCP cluster?

BTW, that command makes use of the environment variables $RHT_OCP4_DEV_USER and $RHT_OCP4_MASTER_API. That environment variables are usually assigned in our labs when using the lab-configure script first, and then the source /usr/local/etc/ocp4.config command.

Hope that helps.

Jordi Sola

 
 

 

 

 

simplyedwin
Mission Specialist
Mission Specialist
  • 2,931 Views

Hi Jordi,

My projects are mainly on premises environment. Meaning that there won't be any internet access to for my projects. I am exploring to setup RHOCP in VM and to access it via ssh for security reason. What would be the correct way to use ssh for my case ?

Thanks in advance.

Edwin

 

jordisola
Flight Engineer
Flight Engineer
  • 2,845 Views

Hi!

I am a bit confused by your setup.

If I understood correctly, your objective is to have an on-premises RHOCP cluster to deploy your applications. Do you intend to create a VM to hold the whole RHOCP cluster? I don´t recommend doing so unless there is a strong reason: an RHOCP cluster is usually composed of several nodes, so if you target to run everything in a single host you usually end up creating multiple VM inside the host. If your host is a VM, then you will be creating VMs inside VMs, which is usually a receipt for problems.

I would recommend taking a look at projects that might control the cluster for you: CodeReady Containers or the new single-node OpenShift variant if you require RHOCP, or Minikube or Kind if you can live with a vanilla Kubernetes.

 

Focusing on the SSH problem: The main question here is exactly where do you want to connect to.

- If you want to connect to the VM holding the cluster, you need to refer to the documentation of the projects I previously mentioned (if you are using any), or manually set-up the SSH server in the and the VM-Host network between the host and the VM. 

- If you want to connect to one node in the cluster (possibly the main node), again refer to the documentation of the project. If the project is deploying an RHOCP cluster, probably the "oc debug node" command is what you are looking for. 

- If you want to connect to a container controlled by the cluster (say a replica for your application), I would rather use "oc rsh" (when using RHOCP) or "kubectl exec" (when using Kubernetes). Those can run commands in the container, even if those containers are shell sessions.

Note that the two last options do not use SSH (or at least not directly), but they are secure enough.

I hope that clarifies a bit.

Kind regards

Jordi Sola

 

Join the discussion
You must log in to join this conversation.