Skip to content

Kubectl plugin to interactively proxy Kubernetes Services with ease

License

Notifications You must be signed in to change notification settings

Lappihuan/mittens

Repository files navigation

mittens

mittens

A kubectl plugin for intercepting HTTP traffic to Kubernetes Services using mitmproxy.

Build status Latest release License

Usage

kubectl mittens SERVICE [OPTIONS]

Examples:

kubectl mittens my-service -n my-namespace          # Auto-detect port
kubectl mittens my-service -p 8080                  # Explicit port
kubectl mittens my-service -p 443 --https           # HTTPS service

Options:

  • -n, --namespace STRING: Target namespace
  • -p, --port INT: Service port (auto-detected if omitted)
  • --https: Enable for HTTPS services
  • -i, --image STRING: Custom proxy image
  • --command-args STRING: Custom mitmproxy arguments

What happens:

  1. Deploy mitmproxy sidecar to service pods
  2. Redirect traffic through mitmproxy
  3. Open interactive mitmproxy TUI
  4. Auto-cleanup on exit (Ctrl+C)

Installation

Binary: Download from Releases

From source: go install github.com/Lappihuan/mittens/cmd/kubectl-mittens@latest

With Krew: kubectl krew install mittens

K9s Integration

Add to ~/.k9s/plugins.yaml:

plugins:
  mittens:
    shortCut: Ctrl-T
    description: "mittens: inject mitmproxy sidecar"
    scopes:
      - services
    command: kubectl
    background: false
    args:
      - mittens
      - $NAME
      - -n
      - $NAMESPACE

GitOps Integration (ArgoCD/Flux)

When using mittens with GitOps tools, Service port modifications may be reconciled back to the desired state. mittens handles this automatically for Flux. For ArgoCD, manual configuration is required.

Flux

mittens automatically adds helm.toolkit.fluxcd.io/driftDetection: disabled annotation to tapped Services, preventing drift detection from rolling back changes. No configuration needed.

ArgoCD

Add ignoreDifferences to your Application to prevent auto-sync from reverting the port changes:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: my-app
spec:
  ignoreDifferences:
    - group: ""
      kind: Service
      name: my-service
      namespace: default
      jsonPointers:
        - /spec/ports/0/targetPort

License

Apache 2.0. See LICENSE.

mittens is a fork of kubetap by Soluble Inc.

About

Kubectl plugin to interactively proxy Kubernetes Services with ease

Resources

License

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors 4

  •  
  •  
  •  
  •  

Languages