← 全部工具

fabiocicerchia/port-forward-manager

热度 65 更新于 开发与构建

Declarative kubectl port-forward orchestrator — define your forwards in YAML, keep them alive, and manage them as a group with one command.

githubauto-collected

安装

source
git clone https://github.com/fabiocicerchia/port-forward-manager

通过 source 安装。

port-forward-manager (pfm)

Manage multiple kubectl port-forwards from a profile file, with auto-reconnect, per-forward logs, and an at-a-glance status view.

The perpetual daily annoyance, fixed.

$ pfm up
pfm: profile ./pfm.yaml
  db: svc/postgres (ns data) on 5432:5432
  redis: svc/redis (ns data) on 6379:6379
  api: deploy/api (ns app) on 8080:80
pfm: 3 forward(s) started.

$ pfm status
● db     UP    localhost:5432:5432
● redis  UP    localhost:6379:6379
○ api    DOWN  localhost:8080:80 (reconnecting)

Features

  • One profile file drives many kubectl port-forward processes.
  • Auto-reconnect when a forward drops (rollout, node drain, laptop sleep).
  • Per-forward logs and a live status view.

Install

curl -fsSL https://raw.githubusercontent.com/fabiocicerchia/port-forward-manager/main/install.sh | bash

Or from a local clone:

make install          # or copy `pfm` onto your PATH

Or grab the released script directly:

curl -fsSLO https://github.com/fabiocicerchia/port-forward-manager/releases/latest/download/pfm
install -m 0755 pfm /usr/local/bin/pfm

Dependencies: bash, kubectl, nc, awk — nothing else.

Usage

Per-project ./pfm.yaml or global ~/.config/pfm/default.yaml (see pfm.example.yaml):

forwards:
  - name: db
    target: svc/postgres
    namespace: data
    ports: "5432:5432"
  - name: api
    target: deploy/api
    namespace: app
    ports: "8080:80"
    context: staging
pfm up [profile]   # start all forwards
pfm status         # show forwards and their health
pfm logs NAME      # tail one forward's log
pfm down           # stop everything

Each forward is supervised: when kubectl drops the connection, pfm reconnects after PFMRECONNECTDELAY (2s default).