Based on your description, I believe you are trying to setup a kubernetes cloud based development workspace. So that you could SSH into the pod containing your codebase using the public IP address of the pod or node or cluster, and edit the code in the docker container/pod using your IDE from laptop or so.
If your endgoal is to get remote SSH access to your private Kubernetes cluster nodes or pods, then you have 2 options:
Option# 1:
Install and run an OpenSSH server inside your docker container pod.
SSH server listens on port 22 and you need to expose that to the outside network.
Expose the pod target port 22 through a clusterPort or nodePort service using a Kubernetes service configuration as shown below.
Reference: https://kubernetes.io/docs/concepts/services-networking/service/
apiVersion: v1
kind: Service
metadata:
name: my-ssh-service
spec:
type: NodePort
selector:
app: MyApp
ports:
- port: 22
targetPort: 22
nodePort: 30022
Now you could SSH into your pod using the NodeIP (Public IP address of the worker node, say 34.100.0.1) and NodePort as shown below
ssh user@34.10.0.1 -p 30022
The only catch here is that you need to expose your worker node to the internet using a public IP address, so that you could access your pod from outside the network. It is not a security best practice to expose your node or cluster via a public IP to the internet as it increases the attack surface of your cloud.
Option #2:
An alternate and better approach (from a security standpoint) would be to use a Kubernetes Cluster Remote SSH Access solution like SocketXP which doesn't require any public IP to be assigned to your nodes or cluster. You can retain your cluster as a private cluster. You can use IDE or something to SSH into your pod and access your codebase.
Reference: https://www.socketxp.com/docs/guide/kubernetes-pod-remote-ssh-access.html
Disclaimer: I'm the founder of SocketXP Kubernetes Remote Access solution. So I don't want to discuss my solution in detail here. You can go to the reference link above if you need the details and instructions to set it up.