Skip to content

πŸ” Kubernetes Resource Differ - Compare K8s resources between namespaces with colored diff output, kubectl neat integration, and multiple format support. Essential DevOps tool for environment comparison and debugging.

License

Notifications You must be signed in to change notification settings

rajamohan-rj/kdiff

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

kdiff - Kubernetes Resource Differ

A tool to compare Kubernetes resources between different namespaces, making it easy to spot differences across environments.

Features

  • πŸ” Compare Kubernetes resources between any two namespaces
  • 🎨 Colored diff output for better readability
  • 🧹 Optional kubectl neat integration to clean output
  • πŸ“Š Multiple output formats (unified, context, side-by-side)
  • πŸ”§ Support for all Kubernetes resource types
  • πŸ“ Verbose logging for debugging

Installation

πŸš€ Quick Install (Recommended)

Unix/Linux/macOS

curl -sSL https://raw.githubusercontent.com/rajamohan-rj/kdiff/main/install.sh | bash

Windows (PowerShell)

iwr -useb https://raw.githubusercontent.com/rajamohan-rj/kdiff/main/install.ps1 | iex

πŸ“¦ Package Managers

Using Go

go install github.com/rajamohan-rj/kdiff@latest

Using Homebrew (macOS/Linux)

# Add the tap (after setting up Homebrew tap)
brew tap rajamohan-rj/tap
brew install kdiff

πŸ› οΈ Advanced Installation

Install to custom directory

# Unix/Linux/macOS
curl -sSL https://raw.githubusercontent.com/rajamohan-rj/kdiff/main/install.sh | bash -s -- --dir ~/.local/bin

# Windows
iwr -useb https://raw.githubusercontent.com/rajamohan-rj/kdiff/main/install.ps1 | iex -InstallDir 'C:\tools'

Install specific version

# Unix/Linux/macOS
curl -sSL https://raw.githubusercontent.com/rajamohan-rj/kdiff/main/install.sh | bash -s -- --version v0.1.0

# Windows
iwr -useb https://raw.githubusercontent.com/rajamohan-rj/kdiff/main/install.ps1 | iex -Version 'v0.1.0'

πŸ“₯ Manual Download

Download the latest binary from releases and extract.

Usage

# Compare deployments between staging and production
kdiff staging my-app production my-app

# Compare services with verbose output
kdiff --verbose dev my-service prod my-service

# Compare without colored output
kdiff --no-color namespace1 deployment/app namespace2 deployment/app

# Use context diff format
kdiff --output context ns1 svc/api ns2 svc/api

# Compare with side-by-side format and skip kubectl neat
kdiff --output side-by-side --no-neat ns1 pod/web ns2 pod/web

Options

  • --no-color - Disable colored output
  • --no-neat - Skip kubectl neat processing
  • --output - Output format (unified, context, side-by-side)
  • --verbose - Enable verbose logging
  • --version - Show version information

Prerequisites

  • kubectl command-line tool
  • kubectl neat plugin (optional, for cleaner YAML output)
  • colordiff (optional, for colored output)

How it works

  1. Retrieves the specified resource from the first namespace using kubectl get
  2. Retrieves the specified resource from the second namespace
  3. Optionally processes the YAML through kubectl neat to remove cluster-specific metadata
  4. Performs a diff between the two YAML files
  5. Optionally colorizes the output using colordiff

License

MIT License - see LICENSE file for details.

About

πŸ” Kubernetes Resource Differ - Compare K8s resources between namespaces with colored diff output, kubectl neat integration, and multiple format support. Essential DevOps tool for environment comparison and debugging.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published