Oscar Cervantes
Oscar Cervantes

Reputation: 53

run remote commands between pods

I've a question.

How can I run a netstat command in a pod A from a pod B?, pod A and B are in a different namespace. My pod A stablish connection with a server outside the cluster and my pod B contains a script that convert netstat result in SNMP traps. I can't modify pod A image to include anything. Pod B it's from my own.

Thanks.

Upvotes: 0

Views: 324

Answers (1)

Will
Will

Reputation: 2410

If there's no network policies in place then something like this should work :

kubectl exec -it <pod B> -- sh
> ssh [email protected] "your command"

Note that ssh must be installed on the podB and you must have a user to connect with on Pod A.

Upvotes: 1

Related Questions