我需要使用visual远程调试运行在openshift集群上的基于c++的应用程序。由于这个原因,我需要一个工作的ssh连接到我的吊舱。我正在使用CRC集群。
以下是我迄今所尝试过的。我通过码头文件在吊舱上安装了openssh服务器。然后,我访问了荚的外壳,启动了服务器并生成了密钥。然后我试图通过荚的外壳在本地连接到服务器。
ssh -vvv -i /root/.ssh/id_rsa root@localhost我得到以下日志
OpenSSH_8.9p1 Ubuntu-3, OpenSSL 3.0.2 15 Mar 2022
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/root/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/root/.ssh/known_hosts2'
debug2: resolving "localhost" port 22
debug3: resolve_host: lookup localhost:22
debug3: ssh_connect_direct: entering
debug1: Connecting to localhost [::1] port 22.
debug3: set_sock_tos: set socket 3 IPV6_TCLASS 0x10
debug1: Connection established.
debug1: identity file /root/.ssh/id_rsa type 0
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.9p1 Ubuntu-3
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.9p1 Ubuntu-3
debug1: compat_banner: match: OpenSSH_8.9p1 Ubuntu-3 pat OpenSSH* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to localhost:22 as 'root'
debug1: load_hostkeys: fopen /root/.ssh/known_hosts: No such file or directory
debug1: load_hostkeys: fopen /root/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug3: order_hostkeyalgs: no algorithms matched; accept original
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
Connection reset by ::1 port 22我也尝试过使用minikube集群,在那里我可以在本地成功地连接到ssh服务器。
发布于 2022-10-13 04:38:27
虽然我承认我还没有尝试过,但是在OpenShift上安装SSH几乎肯定不会成功,因为默认的容器权限可能还不够。(相比之下,minikube是为开发人员设计的,因此默认情况下是非常不安全的。)最值得注意的问题是,默认情况下不能将容器作为根运行,尽管它们也可能是其他问题。虽然我可以告诉您如何在不安全的特权模式下运行OpenShift吊舱,但这似乎是一种非常困难的尝试和调试pod的方法。
我知道你说过你“需要在Visual中调试,因此需要SSH",但是进入你的吊舱的任何终端都不能工作吗?你试过oc rsh了吗?还是通过OpenShift UI打开终端?
整个文档的“如何调试pod”一章可能会有所帮助:https://docs.openshift.com/container-platform/4.11/support/troubleshooting/investigating-pod-issues.html
https://stackoverflow.com/questions/74028288
复制相似问题