Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a method in kubernetes client replacing "kubectl port-forward" command

Tags:

kubernetes

I need to forward port of one Kubernetes pods. One possible way is to execute kubectl command like bellow:

kubectl port-forward podm-resource-manager-56b9ccd59c-8pmdn 8080

Is there a way to achieve the same using python (for example python kubernetes-client)?

like image 498
japiasec Avatar asked Jan 31 '19 22:01

japiasec


1 Answers

The method connect_get_namespaced_pod_portforward is available in in the python kubernetes-client to do a port forward.

like image 167
Jaime M. Avatar answered Oct 04 '22 02:10

Jaime M.