krok
as in ngrok
Expose your local TCP server as Kubernetes service in remote cluster.
Usage
Giving we want to create service in namespace with name service_name on port service_port forwarding all traffic from it to local_host (usually 127.0.0.1) and local_port.
-
Install krok client:
pip install krok -
Install krok server:
kubectl -n <namespace> run --image=smpio/krok-server krok -
Run krok:
krok -n <namespace> -l <local_host> -p <local_port> <service_name> <service_port>
Note: local_host can be any host reachable from your machine, but usually 127.0.0.1 is the most useful.
How it works
We have running krok server in the pod krok_pod in namespace. The server is simple OpenSSH server that allows to forward incoming connections.
Krok client is simple script that automates the following steps:
-
Run
kubectl port-forward <krok_pod> :22. It will listen on randomlocal_ssh_portforwarding all connections to krok's OpenSSH server onkrok_pod. -
Run
ssh -N -R *:0:<local_host>:<local_port> -p <local_ssh_port> krok@localhost. This causes krok's OpenSSH server onkrok_podto listen on randompod_portforwarding all connections tolocal_host:local_portusing SSH tunnel. -
Create or update service
service_namewith portservice_portand targetPortpod_port, with selector matchingkrok_pod.
In the result, all connections to service_name:service_port will be forwarded to krok_pod, then to your local machine via SSH tunnel forwarded by kubectl port-forward, and then forwarded by SSH client to local_host:local_port.
Metadata
Release files for krok 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| krok-1.0.0.tar.gz | 4.4 kB | Without provenance | Details for krok-1.0.0.tar.gz |
Release files / krok-1.0.0.tar.gz
| Download URL | krok-1.0.0.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
22d2c335905f1155660eea7293a76ac31c062a828dec330e202de6a707366d14
|
|
BLAKE2b-256 checksum How to use checksums |
375f3a8036b41fd6655f1679b475ecdd27ea78754233271c890d76450b1c452e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.5
|
Security for krok 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.