I created a K8S cluster (2 nodes and 1 master), that has no access to Internet, only the piloting machine has.
I wanted to SSH into a Ubuntu-OpenSSH Pod, from outside the cluster and did a port-forwarding :
kubectl port-forward pod/ubuntu-ssh 30180:22
Where 30180 is the container 22 the port the openssh-server is listening to inside the pod.
Except I get an error when I try to connect with the cluster IP :
$ ssh [email protected] -p 30180
ssh: connect to host 192.X.X.X port 30180: Connection refused
But it works just fine if I do it using localhost :
$ ssh root@localhost -p 30180
root@localhost's password:
Welcome to Ubuntu 20.04.4 LTS (GNU/Linux 5.15.0-25-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
This system has been minimized by removing packages and content that are
not required on a system that users do not log into.
To restore this content, you can run the 'unminimize' command.
Last login: Fri Jul 1 12:39:19 2022 from 127.0.0.1
root@ubuntu-ssh:~#
Can someone help me connect to the pod with the ip address and not localhost ? Thanks, in advance !
For more context, I have followed this tutorial : https://sanda-dev.medium.com/ssh-into-kubernetes-pod-without-public-ip-access-fbb9da7f7b26