Skip to content

alpkeskin/kubepf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kubepf: Handy port-forwarding tool for k8s

MIT License Go Report Release

kubepf is a simple utility for creating and managing port-forwarding in k8s. It's written in Go and uses Cobra for CLI.

Here is a kubepf demo: kubepf

Installation

go install -v github.com/alpkeskin/kubepf/cmd/kubepf@latest

Configuration

kubepf uses a config file named .kubepf in your home directory.

You can create it manually or use kubepf init command to create it. Here is an example config file:

# .kubepf config file. Edit it.
projects:
  - name: project1
    namespace: namespace1
    services:
      - name: service1
        local_port: 8081
        target_port: 8081
      - name: service2
        local_port: 8082
        target_port: 8082

  - name: project2
    namespace: namespace2
    services:
      - name: service3
        local_port: 8083
        target_port: 8083
      - name: service4
        local_port: 8084
        target_port: 8084

Usage

List projects and services in .kubepf config file

kubepf list

Start port-forwarding for project

kubepf <project_name>

List active port-forwarding

kubepf active

Kill port-forwarding for project

kubepf kill <project_name>

Kill port-forwarding for service

kubepf kill <service_name>

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.