Easy Kubernetes Port-Forward For Python
Project description
Easy Kubernetes Port-Forward For Python
Free software: MIT license
Documentation: https://portforward.readthedocs.io.
Installation
Wheels are available for:
Windows
MacOS X
Linux
with Python versions:
3.7
3.8
3.9
3.10
3.11
and architectures:
x84_64
arm64 (known as M1/Apple Chip - MacOS only)
Requirements for installation from source
The following things are required when there is no wheel available for the target system.
Rust installed and available in the path (https://www.rust-lang.org/tools/install)
Python (at least v3.7 - below was never tested but might work)
Pip knows how to install portforward.
pip install portforward
Quickstart
import requests
import portforward
def main():
namespace = "test"
pod_name = "web" # You can also use a service name instead
local_port = 9000 # from port
pod_port = 80 # to port
# No path to kube config provided - will use default from $HOME/.kube/config
with portforward.forward(namespace, pod_name, local_port, pod_port):
response = requests.get("http://localhost:9000")
print(f"Done: \n'{response.status_code}'\n'{response.text[:20]}...'")
if __name__ == "__main__":
main()
Features
Native Kubernetes port-forwarding with the .kube/config from the home dir or any other path to config.
Portforward for pods and services - the lib will first look for a pod with matching name then for a service
Waiting for a pod to become ready
Multiple forwards per pod or service
As context manager, sync or async client
Development
In case you want to develop on this library itself please take a look at the CONTRIBUTING page.
Credits
This project is enabled by PyO3.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for portforward-0.6.0-cp311-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22d87a3f5f6ee45ff477d88181529a802fb0fecb48b27b3d283bc927e4f17dbf |
|
MD5 | c66cc7958b83c313e2d0d97ab60b9883 |
|
BLAKE2b-256 | cc2f981dba13f813f553428fdf48de02c55ef023c7cbeec7b900bf190cf28574 |
Hashes for portforward-0.6.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24cc1b4dbdc7a8812ce2edfc81015a50fdb3397aac765b095e12e6e6738ef0c1 |
|
MD5 | 1f5acfda5ad507394020a58c05e35f18 |
|
BLAKE2b-256 | 4845d9ff75ced9d3e148e822246e441a13884a975dc556a9952f95e0fceaf0f9 |
Hashes for portforward-0.6.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 731b8fe58312aad736e7cc1e565df511ef8f5683c79fac27d96baab4075cd4d8 |
|
MD5 | 28156a5e6acd37832a2c874621528c15 |
|
BLAKE2b-256 | a5afa8bd067563c66c5fac762a54ba6655423331ac4288d7bbe7babcb2cfc68c |
Hashes for portforward-0.6.0-cp311-cp311-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5c713574ada101863580979662d44a4bbe26c65bd22d20bf6c0626e61a458dc |
|
MD5 | 5069cfd6cd1a3649ced8e094f33102c6 |
|
BLAKE2b-256 | f73afb91b65e6ab2343df1adfe7596044ad202ff9f4bf27ce53016d9e2ba90a2 |
Hashes for portforward-0.6.0-cp310-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3fd03812a64a77cf55711ae531e5a914f46018455e4915bd4a9004889a01fe40 |
|
MD5 | 7da27d2d7dda7364797eb96161fa9593 |
|
BLAKE2b-256 | dfc8e5d5bb9197bc008be6c96dfba49b274419307562527fdbe9461582eeb6a7 |
Hashes for portforward-0.6.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab221793c0a0d51173726a7b20039b612040420442fa8b8fe69d3ef0f9c77f86 |
|
MD5 | b62af2ddd17ebdb306fefa6832742623 |
|
BLAKE2b-256 | c3b18d9859be3e9fa161eab122bef2c7acf029e7a3135db9c8d30bbb294d58b4 |
Hashes for portforward-0.6.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 765b37ea0fb708b0eab5429a82b3e159d7f009a71227fab103a15b7aae1a8e4a |
|
MD5 | ad18ff341fb6bb1542aff5978fe90b90 |
|
BLAKE2b-256 | ff2df321cabc6c4d6ed15206c98ed32d1a28ae36e8cdd1a2702a64cefbf8d5c8 |
Hashes for portforward-0.6.0-cp310-cp310-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e228fff18b6a93772c54191b88f18f90c137469d104fe0966ce22af4fa4d80de |
|
MD5 | de2134519a02b503cf977218e1782ef6 |
|
BLAKE2b-256 | 2b4fc64f0cbdecf1f9bc3618c6525bc9aea2d7aeb07bba6f1f3c8d2a49317fab |
Hashes for portforward-0.6.0-cp39-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | da8784aba934c0e6f9359b4957a9eff80e8b49af0081b97294f4ec1af74b423a |
|
MD5 | 1c9e54857012626342154aa381524574 |
|
BLAKE2b-256 | 7b40ef38e0a6dc7a401958624a720cbcaae75ad23034ed7c5c97731d88adb62a |
Hashes for portforward-0.6.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 652d4bc608331620bc30f8a7741f445ad1e988f3831e207a0821ab194d695a8c |
|
MD5 | 63d7d2500d5a134d9fa0178a3b71a825 |
|
BLAKE2b-256 | b3897c1ab7ce0a16b0d42094f2d36083e360b208a277289b630f549f744b699c |
Hashes for portforward-0.6.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 58568102ae31fb5501084e89d35da6c72ecbf3dba1450a29740568eb49bd73af |
|
MD5 | 96bfea0df35ee8753ece2cb28de55002 |
|
BLAKE2b-256 | 61a06c7c474cfb28cfbe3957bdf26f310f947502908135ee242fa415257bbd61 |
Hashes for portforward-0.6.0-cp39-cp39-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cadaf34bc7a56c1b166d55ddcabb74721be5052e606698cbc2a7106483c768b1 |
|
MD5 | 5dd4bc8ab454d698725aa1da5f7a0019 |
|
BLAKE2b-256 | b95c6e11536acade0580bf6d8a8114533f1a2c54f46d860390c817a5c5367aeb |
Hashes for portforward-0.6.0-cp38-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3312620b08dbf0f094427a8cdf6e4677034ef6a4840f5bb0ae7fb4b99bbec0a0 |
|
MD5 | 0526f95f0d8556054be571f87bfd4748 |
|
BLAKE2b-256 | 9377ba7db7f479ef54ebe22b8d6783c901530d6f6b5e62f135fa7a11a02eac86 |
Hashes for portforward-0.6.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29a60a05719a88580c1b41411a48eca393b4b88de6fc86ae698ec6a58b0e1bf5 |
|
MD5 | 072cc261664e637bcc4b345d68b49750 |
|
BLAKE2b-256 | 53502265db51e49e7f90e1a252f596a1e3053100c12ac4a80905debc34629757 |
Hashes for portforward-0.6.0-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd4d19064c7e7cb31530d63df53d3dbba2690834660153837092c4790534847e |
|
MD5 | 23809ae8b6fb304c8cf190305734b9ba |
|
BLAKE2b-256 | c008042b5a2f7f26bc2c08b027fcaf2296dec9b0fc11c44c40a0ed32c433b0f9 |
Hashes for portforward-0.6.0-cp38-cp38-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d22ee7078f16cbd6faea5736484bf947d3bf84cbcb01a9694f9607afe189c9bb |
|
MD5 | dd5e9d52e333f31dd680a6ff9383887d |
|
BLAKE2b-256 | 29e0f778ff5d912361283a5d93dd276551e3314a668995737dc7f556a353e96c |
Hashes for portforward-0.6.0-cp37-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6845503c96a4a84dca38bde10548b2e7932ef3a106533c9d80ca290e8cec0775 |
|
MD5 | 57fdda8f136213ea3c4a432a46d5a10a |
|
BLAKE2b-256 | b5a12e1c14494ac646591c2a622539d64a02227c41393204dfd21e61af3cce56 |
Hashes for portforward-0.6.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 20bd8882e2d6db7b7c51f0c0c06c6a7f74541a0a567651e0818055bd790cd951 |
|
MD5 | 2bca09610488fbac48f06648b1550328 |
|
BLAKE2b-256 | 8fe2a2614028f3971a186458fc7d6429e0bf8ec691c260e57ecffe49dd59bf9a |
Hashes for portforward-0.6.0-cp37-cp37m-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 078bf0a76cc696082710f12e79e619f210fe1289a7ed4da691b5606c255d6a45 |
|
MD5 | fccbeb5e367fc150a1c62dfdcc5cc1d1 |
|
BLAKE2b-256 | 51906191be003fb3a6e238d13da9e6e4c22c54b15a36307b3be9631472e8f3e6 |
Hashes for portforward-0.6.0-cp37-cp37m-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8515ef05b36acf3e9bc9a5dd6085f4e1b6137bbe7a4da46f553502d64941f901 |
|
MD5 | 11123d32f03baf98582c6fab7df24444 |
|
BLAKE2b-256 | 955c3eb3e8746a08dbf8a3a9f59262ca4cb2c319b4b4b300619502621aa8354d |