Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vbem/k8s-port-forward
An action forward local ports to workloads in Kubernetes.
https://github.com/vbem/k8s-port-forward
actions daemon k8s kubectl kubernetes port-forward workload
Last synced: 3 months ago
JSON representation
An action forward local ports to workloads in Kubernetes.
- Host: GitHub
- URL: https://github.com/vbem/k8s-port-forward
- Owner: vbem
- License: apache-2.0
- Created: 2022-04-10T05:16:26.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-10-21T07:02:56.000Z (over 1 year ago)
- Last Synced: 2024-10-31T10:46:32.807Z (4 months ago)
- Topics: actions, daemon, k8s, kubectl, kubernetes, port-forward, workload
- Homepage: https://github.com/marketplace/actions/kubernetes-port-forward
- Size: 18.6 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# k8s-port-forward
[](https://github.com/vbem/k8s-port-forward/actions/workflows/test.yml)
[](https://github.com/vbem/k8s-port-forward/actions/workflows/linter.yml)
[](https://github.com/vbem/k8s-port-forward/releases)
[](https://github.com/marketplace/actions/kubernetes-port-forward)## About
This action can be used to [forward](https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/) local ports on GitHub runners to workloads in your Kubernetes cluster.
Current implementation is to setup a `kubectl port-forward` daemon in background and immune to hangups, which make local ports on runner available to subsequent steps.
Note that this action follow [official *kubeconfig* authentication methods](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/) and you need to sign in your K8s cluster via other actions such as [kubeconfig4sa](https://github.com/marketplace/actions/kubeconfig-for-service-account-sa), or manually set `KUBECONFIG` environment variable for this action in your workflows file.
## Example usage
```yaml
- name: Setup KUBECONFIG
uses: vbem/kubeconfig4sa@v1
with:
server: https://your-kubeapi-server:6443
ca-base64: ${{ secrets.K8S_CA_BASE64 }}
token: ${{ secrets.K8S_SA_TOKEN }}
namespace: my-namespace# This action will forward port 8080 on runner to port 80 of your service in Kubernetes!
- name: Setup Kubernetes port-forward daemon
uses: vbem/k8s-port-forward@v1
with:
workload: 'svc/mysvc'- name: Request a service in Kubernetes
run: curl localhost:8080
```
## Inputs
ID | Type | Default | Description
--- | --- | --- | ---
`workload` | String | *Required input* | Kubernetes workload `type/name` such as `deploy/mydeploy`, `svc/mysvc` or `po/mypod`
`mappings` | String | `8080:80` | Ports mappings `[LOCAL_PORT:]REMOTE_PORT [...[LOCAL_PORT_N:]REMOTE_PORT_N]`
`options` | String | `` | Other command-line options, such as `--namespace=myns`
`sleep` | String | `3` | Seconds to wait before action finished## Outputs
ID | Type | Description
--- | --- | ---
`pid` | String | Process ID of port-forward daemon
`log` | String | Path to port-forward log file