kubectl-port-forward

Manage and reuse kubectl port-forward sessions with identical arguments.

Updated Feb 24, 2026
One-click install
npx skills add https://github.com/bduffany/kpf --skill kubectl-port-forward
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kubectl-port-forward
Source: https://github.com/bduffany/kpf/tree/main/skills/kubectl-port-forward
Command: npx skills add https://github.com/bduffany/kpf --skill kubectl-port-forward

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Replaces manual, ad-hoc kubectl port-forward commands with a fast, idempotent daemon that manages and reuses sessions, reducing startup time and token usage.

Core Features & Use Cases

  • Reusable port-forward sessions: automatically reuses an existing session when the same target is requested.
  • Idempotent design: ensures identical inputs yield the same result without duplicating resources.
  • Kubernetes-compatible: accepts the same arguments as kubectl port-forward, preserving familiar workflows and completion.

Quick Start

Run kpf with a target like service/my-service 8080 and use the returned local port immediately.

Frequently Asked Questions about kubectl-port-forward

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I manage reusable Kubernetes port-forward sessions in CI pipelines?

Reusable Kubernetes port-forward sessions are managed by a fast, idempotent daemon that automatically reuses existing connections when the same target is requested. This reduces startup time and token usage in CI pipelines and automation scripts.

Can I use standard kubectl port-forward arguments with a session manager?

Yes, standard kubectl port-forward arguments are fully supported as a drop-in replacement. It accepts identical arguments like service/my-service 8080, preserving familiar workflows and shell completion.

What's the best way to keep Kubernetes port-forward connections running in the background for tests?

The best way to maintain background Kubernetes port-forward connections for tests is using an idempotent daemon that manages TTL-based sessions. It ensures identical inputs yield the same result without duplicating resources or ports.

Why does kubectl port-forward take so long to start when running automated tests?

Manual kubectl port-forward commands repeatedly establish new connections, causing slow startup times. A session management daemon solves this by reusing existing background sessions, drastically reducing initialization overhead for automated tests.

Does this Kubernetes port-forward session manager work across different namespaces and pods?

Yes, the port-forward session manager works across different contexts, namespaces, and pods. It enables quick startup for tests, demos, and CI pipelines by managing reusable sessions across these Kubernetes boundaries.

What is an idempotent Kubernetes port-forward and when do I need it?

An idempotent Kubernetes port-forward ensures identical inputs yield the same local port result without duplicating resources. You need it for automation, scripting, and CI pipelines where repeatable port-forward access is required.