Skip to content
kubenetworksPublic

Repository files navigation

kubevpn

GitHub Workflow Go Version Go Report Maintainability GitHub License Docker Pulls Releases GoDoc codecov Snapcraft Ask DeepWiki

KubeVPN

English | 中文 | Documentation | Architecture

KubeVPN offers a Cloud-Native Dev Environment that seamlessly connects to your Kubernetes cluster network.

  • Connect directly to cluster network using Pod/Service IP or Kubernetes DNS
  • Intercept inbound traffic from cluster services to your local machine with service mesh
  • Run Kubernetes pods locally in Docker with identical environment, volumes, and network

Prerequisites

  • Valid kubeconfig with appropriate RBAC permissions for target namespace
  • Local sudo/root privileges (for creating TUN device and modifying routing/DNS)
  • unzip (required for script-based installation)

Installation

Choose one method:

# Script (macOS/Linux)
curl -fsSL https://kubevpn.dev/install.sh | sh

# Homebrew (macOS/Linux)
brew install kubevpn

# Snap (Linux)
sudo snap install kubevpn

# Krew (Windows/macOS/Linux)
kubectl krew index add kubevpn https://github.com/kubenetworks/kubevpn.git
kubectl krew install kubevpn/kubevpn

# Scoop (Windows)
scoop bucket add extras
scoop install kubevpn

Or download from GitHub Releases.

Quick Start

  1. Deploy the sample Bookinfo application:
kubectl apply -f https://raw.githubusercontent.com/kubenetworks/kubevpn/master/samples/bookinfo.yaml
  1. Connect to the cluster network:
kubevpn connect
  1. Check connection status:
kubevpn status
  1. Access cluster services:
# Using Pod IP
kubectl get pods -o wide
curl <pod-ip>:9080

# Using Service IP
kubectl get svc -o wide
curl <service-ip>:9080

# Using Kubernetes DNS
curl productpage.default.svc.cluster.local:9080
curl productpage:9080  # short name works in same namespace
  1. Clean up (IMPORTANT: follow this order):
# 1. If you used `kubevpn proxy` or `kubevpn sync`, leave those resources first
#    This restores the workloads to their original state and removes injected sidecars
kubevpn leave deployments/productpage

# 2. Disconnect by connection ID (from `kubevpn status`)
kubevpn disconnect <connection-id>

# 3. Delete the sample Bookinfo
kubectl delete -f https://raw.githubusercontent.com/kubenetworks/kubevpn/master/samples/bookinfo.yaml

Optional: To clean up KubeVPN traffic manager from the cluster entirely:

kubevpn uninstall
# WARNING: This affects all users of this cluster!

Security Notice

  • KubeVPN modifies your local TUN device, routing table, and DNS settings
  • Proxy mode injects sidecar containers into workloads, which may require privileged, NET_ADMIN, or NET_RAW capabilities
  • For production clusters, understand the RBAC and network impacts before use
  • Learn more: Security Documentation

Example Commands

Start the MCP server for AI coding agents (stdio):

kubevpn mcp

Disconnect from a specific connection ID:

kubevpn disconnect <connection-id>

Disconnect from all connections:

kubevpn disconnect --all

Next Steps

Contributing

See CONTRIBUTING.md.

Supported by

JetBrains logo.

Releases

Packages

Used by

Contributors

Languages