Reputation: 91
I want to do ssh between two pods in kubernetes.
Can anyone tell me how to do that?
Upvotes: 3
Views: 4889
Reputation: 22884
Oversimplifying the answer, you can not.
That is, under "normal" circumstances... Your containers in pod launch single process, that is your application, be it nodejs, php, java or whatever, so they do not have a running SSH server inside their namespaces. Unless you explicitly run it by ie. running a "fat" container that launches a supervisor process (like ie. by using something like phusion/baseimage
container) which by most in container world is considered an anti-pattern, or by running ssh in sidecar container, which will allow you to access that ssh server (but it will have it's own FS and potentially process tree, unless shared PID namespace is used).
As suggested in another answer, you could use serviceaccounts to grant your software rights to call kubernetes API and hence use things like ie. kubectl exec
. Is it the right call for you... that depends on what you really want to achieve in the end.
Upvotes: 2