README
ΒΆ
DevOps Toolkit
A powerful, beautiful CLI toolkit for modern DevOps operations
Features β’ Installation β’ Quick Start β’ Documentation β’ Contributing
π― Why DevOps Toolkit?
Native DevOps tools often provide minimal, hard-to-read output. DevOps Toolkit transforms your terminal experience with:
- π¨ Beautiful Output β Color-coded statuses, progress bars, and styled tables
- π Enhanced Visibility β See more information at a glance than native tools provide
- π Unified Interface β One CLI for Kubernetes, Docker, GitLab, and compliance checks
- β‘ Productivity Boost β Common operations simplified into single commands
β¨ Features
π Kubernetes Operations
| Command | Description |
|---|---|
k8s health |
Comprehensive cluster health dashboard |
k8s pods |
Enhanced pod listing with status colors & restart counts |
k8s nodes |
Node status with resource utilization bars |
k8s resources |
CPU/Memory breakdown by namespace |
k8s cleanup |
Remove failed pods, completed jobs, orphaned resources |
k8s events |
Filtered event viewing with highlighting |
πΈ Screenshot: Kubernetes Health Check
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Cluster Health Summary β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Component Status Details
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Nodes β Healthy 5/5 Ready
Pods β Healthy Running: 45, Pending: 0, Failed: 0
PVCs β OK Bound: 12/12
Deployments β Warning Ready: 14/15, Unavailable: 1
Services β OK ClusterIP: 12, LoadBalancer: 3
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Resource Utilization β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Resource Used Capacity Utilization
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
CPU 2400m 8000m ββββββββββββββββββββ 30%
Memory 12.4Gi 32.0Gi ββββββββββββββββββββ 39%
π³ Docker Operations
| Command | Description |
|---|---|
docker containers |
Enhanced container listing with health status |
docker images |
Image analysis with size breakdown |
docker stats |
Real-time resource usage with visual bars |
docker clean |
Smart cleanup of unused resources |
docker inspect |
Beautiful, readable container details |
docker logs |
Syntax-highlighted log viewing |
πΈ Screenshot: Docker Stats
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Container Statistics β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Container CPU % Mem % Net I/O
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
nginx βββββββββββββββ 23% βββββββββββββββ 12% 1.2MB / 890KB
postgres βββββββββββββββ 8% βββββββββββββββ 78% 45MB / 12MB
redis βββββββββββββββ 2% βββββββββββββββ 5% 230KB / 180KB
api-server βββββββββββββββ 45% βββββββββββββββ 42% 890MB / 1.2GB
βΈ Resource Summary
Total CPU: 78%
Total Memory: 8.2 GB / 16.0 GB (51%)
βΈ Alerts
β postgres: High memory usage (78%)
π¦ GitLab CI/CD
| Command | Description |
|---|---|
gitlab pipelines |
List pipelines with status indicators |
gitlab jobs |
View jobs grouped by stage |
gitlab trigger |
Trigger new pipelines with variables |
gitlab artifacts |
Manage pipeline artifacts |
gitlab status |
Project CI/CD dashboard |
πΈ Screenshot: GitLab Pipelines
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CI/CD Pipelines β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ID Status Ref Commit Duration
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
#1234 β success main a1b2c3d4 5m 23s
#1233 β success main e5f6g7h8 4m 12s
#1232 β failed feature/auth i9j0k1l2 2m 45s
#1231 β running develop m3n4o5p6 3m 10s
#1230 β pending hotfix/bug q7r8s9t0 -
βΈ Pipeline Summary
β Success: 2
β Failed: 1
β Running: 1
β Pending: 1
π Compliance & Security
| Command | Description |
|---|---|
compliance check k8s |
Kubernetes security best practices |
compliance check docker |
Container security analysis |
compliance check files |
Validate manifests & Dockerfiles |
compliance report [target] |
Generate HTML/JSON/JUnit reports (k8s, docker, files, all) |
compliance policies |
List all available policies |
πΈ Screenshot: Compliance Check
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Compliance Check β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βΈ Kubernetes Security
Status Severity Rule Resource Message
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CRIT K8S-SEC-001 default/nginx Container running privileged
β HIGH K8S-SEC-002 default/api Running as root user
β MED K8S-SEC-003 default/worker Read-only filesystem enabled
β MED K8S-RES-001 default/nginx No CPU limits defined
βΈ Summary
Total Checks: 24
β Passed: 18
β Failed: 4
β Warnings: 2
Compliance Score: ββββββββββββββββββββ 75%
π¦ Installation
Go Install
go install github.com/SiavashBeheshti/devops-toolkit@latest
Download Binary
Download the latest binary from the Releases page.
# Set the version you want to install
VERSION="1.0.0"
# Linux (amd64)
curl -LO "https://github.com/SiavashBeheshti/devops-toolkit/releases/download/v${VERSION}/devops-toolkit_${VERSION}_linux_amd64"
chmod +x devops-toolkit_${VERSION}_linux_amd64
sudo mv devops-toolkit_${VERSION}_linux_amd64 /usr/local/bin/devops-toolkit
# Linux (arm64)
curl -LO "https://github.com/SiavashBeheshti/devops-toolkit/releases/download/v${VERSION}/devops-toolkit_${VERSION}_linux_arm64"
chmod +x devops-toolkit_${VERSION}_linux_arm64
sudo mv devops-toolkit_${VERSION}_linux_arm64 /usr/local/bin/devops-toolkit
# macOS (Intel)
curl -LO "https://github.com/SiavashBeheshti/devops-toolkit/releases/download/v${VERSION}/devops-toolkit_${VERSION}_darwin_amd64"
chmod +x devops-toolkit_${VERSION}_darwin_amd64
sudo mv devops-toolkit_${VERSION}_darwin_amd64 /usr/local/bin/devops-toolkit
# macOS (Apple Silicon)
curl -LO "https://github.com/SiavashBeheshti/devops-toolkit/releases/download/v${VERSION}/devops-toolkit_${VERSION}_darwin_arm64"
chmod +x devops-toolkit_${VERSION}_darwin_arm64
sudo mv devops-toolkit_${VERSION}_darwin_arm64 /usr/local/bin/devops-toolkit
# Windows (amd64) - using PowerShell
# Invoke-WebRequest -Uri "https://github.com/SiavashBeheshti/devops-toolkit/releases/download/v${VERSION}/devops-toolkit_${VERSION}_windows_amd64.exe" -OutFile "devops-toolkit.exe"
Build from Source
git clone https://github.com/SiavashBeheshti/devops-toolkit.git
cd devops-toolkit
make build
sudo make install-local
Docker
docker pull ghcr.io/SiavashBeheshti/devops-toolkit:latest
# Run with kubectl config
docker run -it --rm \
-v ~/.kube:/root/.kube \
-v /var/run/docker.sock:/var/run/docker.sock \
ghcr.io/SiavashBeheshti/devops-toolkit k8s health
Shell Alias (Optional)
For convenience, you can set up a shorter alias:
# Bash (~/.bashrc)
echo 'alias dtk="devops-toolkit"' >> ~/.bashrc
source ~/.bashrc
# Zsh (~/.zshrc)
echo 'alias dtk="devops-toolkit"' >> ~/.zshrc
source ~/.zshrc
# Fish (~/.config/fish/config.fish)
echo 'alias dtk="devops-toolkit"' >> ~/.config/fish/config.fish
source ~/.config/fish/config.fish
Then use dtk instead of devops-toolkit:
dtk k8s health
dtk docker stats
dtk gitlab pipelines
Shell Completion
DevOps Toolkit supports shell auto-completion for commands, flags, and resource names (pods, containers, namespaces, etc.).
Bash
# Linux
devops-toolkit completion bash > /etc/bash_completion.d/devops-toolkit
# macOS (with Homebrew)
devops-toolkit completion bash > $(brew --prefix)/etc/bash_completion.d/devops-toolkit
# Or load for current session only
source <(devops-toolkit completion bash)
Zsh
# If shell completion is not already enabled:
echo "autoload -U compinit; compinit" >> ~/.zshrc
# Generate completion script
devops-toolkit completion zsh > "${fpath[1]}/_devops-toolkit"
# For Oh My Zsh users:
devops-toolkit completion zsh > ~/.oh-my-zsh/completions/_devops-toolkit
# Or load for current session only
source <(devops-toolkit completion zsh)
Fish
devops-toolkit completion fish > ~/.config/fish/completions/devops-toolkit.fish
# Or load for current session only
devops-toolkit completion fish | source
PowerShell
# Load for current session
devops-toolkit completion powershell | Out-String | Invoke-Expression
# Add to profile for persistent loading
devops-toolkit completion powershell >> $PROFILE
What Gets Completed
- Commands & Subcommands:
devops-toolkit k8s <TAB>shows pods, nodes, health, etc. - Flags:
devops-toolkit k8s pods --<TAB>shows available flags - Kubernetes Resources: Pod names, namespace names, container names, context names
- Docker Resources: Container names/IDs, image names, volume names, network names
- Flag Values:
--namespace <TAB>lists namespaces,--format <TAB>shows format options
π Quick Start
Prerequisites
- Kubernetes:
kubectlconfigured with cluster access - Docker: Docker daemon running
- GitLab: Access token with API permissions
Basic Usage
# Check Kubernetes cluster health
devops-toolkit k8s health
# List all pods with enhanced output
devops-toolkit k8s pods -A
# Show Docker container statistics
devops-toolkit docker stats
# List GitLab pipelines
devops-toolkit gitlab pipelines -p mygroup/myproject
# Run compliance checks
devops-toolkit compliance check k8s
π Documentation
Kubernetes Commands
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# CLUSTER HEALTH
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Full cluster health overview
devops-toolkit k8s health
# Health check for specific namespace
devops-toolkit k8s health -n production
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# POD MANAGEMENT
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# List pods in current namespace
devops-toolkit k8s pods
# List pods in all namespaces
devops-toolkit k8s pods -A
# Show only problematic pods
devops-toolkit k8s pods --problems
# Sort by restarts (descending)
devops-toolkit k8s pods -s restarts
# Wide output with node and IP
devops-toolkit k8s pods --wide
# Filter by label
devops-toolkit k8s pods -l app=nginx
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# NODE ANALYSIS
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# List nodes with basic info
devops-toolkit k8s nodes
# Show resource utilization
devops-toolkit k8s nodes --resources
# Wide output with OS and kernel info
devops-toolkit k8s nodes --wide
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# RESOURCE USAGE
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Cluster-wide resource summary
devops-toolkit k8s resources
# Show top resource-consuming pods
devops-toolkit k8s resources --top-pods
# Limit to top 5 pods
devops-toolkit k8s resources --top-pods --limit 5
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# CLEANUP
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Dry run - see what would be deleted
devops-toolkit k8s cleanup
# Actually perform cleanup
devops-toolkit k8s cleanup --dry-run=false
# Cleanup specific resource types
devops-toolkit k8s cleanup --completed-pods --failed-pods --dry-run=false
# Include orphaned ReplicaSets
devops-toolkit k8s cleanup --orphan-rs --dry-run=false
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# EVENTS
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Show recent events
devops-toolkit k8s events
# Show only warnings
devops-toolkit k8s events --warnings-only
# Filter by reason
devops-toolkit k8s events --reason BackOff
# Limit number of events
devops-toolkit k8s events --limit 20
Docker Commands
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# CONTAINERS
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# List running containers
devops-toolkit docker containers
# List all containers (including stopped)
devops-toolkit docker containers -a
# Wide output with command and created time
devops-toolkit docker containers --wide
# Show container sizes
devops-toolkit docker containers --size
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# IMAGES
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# List images sorted by size
devops-toolkit docker images
# Show only dangling images
devops-toolkit docker images --dangling
# Sort by name or created time
devops-toolkit docker images -s name
devops-toolkit docker images -s created
# Show image digests
devops-toolkit docker images --digest
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# STATISTICS
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Show real-time container stats
devops-toolkit docker stats
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# CLEANUP
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Dry run - see what would be cleaned
devops-toolkit docker clean
# Actually perform cleanup
devops-toolkit docker clean --dry-run=false
# Include unused volumes (dangerous!)
devops-toolkit docker clean --volumes --dry-run=false
# Remove all unused images (not just dangling)
devops-toolkit docker clean --all-images --dry-run=false
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# INSPECT & LOGS
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Inspect container with beautiful output
devops-toolkit docker inspect mycontainer
# Show all details (env, mounts, network)
devops-toolkit docker inspect mycontainer --all
# View logs with highlighting
devops-toolkit docker logs mycontainer
# Tail last 50 lines
devops-toolkit docker logs mycontainer -n 50
# Follow logs
devops-toolkit docker logs mycontainer -f
# Show timestamps
devops-toolkit docker logs mycontainer --timestamps
GitLab Commands
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# SETUP
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Set credentials via environment
export GITLAB_TOKEN=your-personal-access-token
export GITLAB_PROJECT=mygroup/myproject
export GITLAB_URL=https://gitlab.com # Optional, defaults to gitlab.com
# Or use flags
devops-toolkit gitlab pipelines --token $TOKEN --project mygroup/myproject
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# PIPELINES
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# List recent pipelines
devops-toolkit gitlab pipelines
# Filter by status
devops-toolkit gitlab pipelines -s running
devops-toolkit gitlab pipelines -s failed
# Filter by branch
devops-toolkit gitlab pipelines -r main
# Show more pipelines
devops-toolkit gitlab pipelines -n 50
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# JOBS
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# List jobs for a pipeline
devops-toolkit gitlab jobs -i 12345
# Show only failed jobs
devops-toolkit gitlab jobs -i 12345 --failed
# Filter by stage
devops-toolkit gitlab jobs -i 12345 --stage test
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# TRIGGER
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Trigger pipeline on branch
devops-toolkit gitlab trigger -r main
# Trigger with variables
devops-toolkit gitlab trigger -r main -v ENV=production -v DEBUG=true
# Trigger and wait for completion
devops-toolkit gitlab trigger -r main --wait
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# STATUS & ARTIFACTS
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Project CI/CD overview
devops-toolkit gitlab status
# List pipeline artifacts
devops-toolkit gitlab artifacts -i 12345
Compliance Commands
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# CHECKS
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Check Kubernetes resources
devops-toolkit compliance check k8s
# Check specific namespace
devops-toolkit compliance check k8s -n production
# Check Docker containers and images
devops-toolkit compliance check docker
# Check specific image
devops-toolkit compliance check docker --image nginx:latest
# Check configuration files
devops-toolkit compliance check files --path ./manifests
# Run all checks
devops-toolkit compliance check all
# Skip specific rules
devops-toolkit compliance check k8s --skip K8S-SEC-001,K8S-SEC-002
# Only run specific rules
devops-toolkit compliance check k8s --only K8S-SEC-001
# Set minimum severity
devops-toolkit compliance check k8s --severity high
# Fail on warnings (for CI)
devops-toolkit compliance check k8s --fail-on-warn
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# REPORTS
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Generate HTML report for all checks
devops-toolkit compliance report -f html -o report.html
# Generate report for Kubernetes checks only
devops-toolkit compliance report k8s -f html -o k8s-report.html
# Generate report for Docker checks only
devops-toolkit compliance report docker -f json -o docker-report.json
# Generate report for file checks only
devops-toolkit compliance report files -f html -o files-report.html
# Generate JUnit XML (for CI integration)
devops-toolkit compliance report -f junit -o results.xml
# Generate report for specific namespace
devops-toolkit compliance report k8s -n production -f html -o prod-report.html
# Exclude passed checks from report
devops-toolkit compliance report --include-passed=false
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# POLICIES
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# List all available policies
devops-toolkit compliance policies
# Filter by category
devops-toolkit compliance policies --category "Kubernetes Security"
# Filter by severity
devops-toolkit compliance policies --severity critical
βοΈ Configuration
Configuration File
Create ~/.devops-toolkit.yaml:
# GitLab Configuration
gitlab:
url: https://gitlab.com
token: glpat-xxxxxxxxxxxxxxxxxxxx
project: mygroup/myproject
# Default Settings
defaults:
output: table # table, json, yaml
verbose: false
# Kubernetes Settings
kubernetes:
context: "" # Use specific context
namespace: "" # Default namespace
# Compliance Settings
compliance:
policy_dir: ~/.devops-toolkit/policies
skip_rules: []
severity: low # Minimum severity to report
Environment Variables
| Variable | Description | Default |
|---|---|---|
GITLAB_TOKEN |
GitLab personal access token | - |
GITLAB_URL |
GitLab instance URL | https://gitlab.com |
GITLAB_PROJECT |
Default project ID or path | - |
KUBECONFIG |
Kubernetes config file path | ~/.kube/config |
DEVOPS_TOOLKIT_CONFIG |
Config file path | ~/.devops-toolkit.yaml |
ποΈ Architecture
devops-toolkit/
βββ cmd/ # CLI commands (Cobra)
β βββ root.go # Root command & global flags
β βββ completion.go # Shell completion command
β βββ k8s/ # Kubernetes subcommands
β βββ docker/ # Docker subcommands
β βββ gitlab/ # GitLab subcommands
β βββ compliance/ # Compliance subcommands
β
βββ pkg/ # Reusable packages
β βββ output/ # Terminal output formatting
β β βββ theme.go # Colors & styles (Lipgloss)
β β βββ table.go # Table rendering
β β βββ printer.go # Print utilities & spinners
β βββ completion/ # Shell completion helpers
β β βββ k8s.go # K8s resource completions
β β βββ docker.go # Docker resource completions
β β βββ common.go # Common completions
β βββ k8s/ # Kubernetes client wrapper
β βββ docker/ # Docker client wrapper
β βββ gitlabclient/ # GitLab API client
β βββ compliance/ # Compliance engine
β βββ k8s_checker.go
β βββ docker_checker.go
β βββ file_checker.go
β
βββ main.go # Entry point
βββ go.mod # Go modules
βββ Makefile # Build automation
βββ .goreleaser.yaml # Release configuration
Tech Stack
| Component | Technology |
|---|---|
| CLI Framework | Cobra |
| Configuration | Viper |
| Terminal Styling | Lipgloss |
| Tables | Tablewriter |
| Spinners | Spinner |
| Kubernetes | client-go |
| Docker | Docker SDK |
| GitLab | go-gitlab |
π οΈ Development
Prerequisites
- Go 1.21+
- Docker (for testing Docker commands)
- kubectl configured (for testing K8s commands)
Setup
# Clone repository
git clone https://github.com/SiavashBeheshti/devops-toolkit.git
cd devops-toolkit
# Install dependencies
go mod download
# Build
make build
# Run tests
make test
# Lint
make lint
Make Commands
make help # Show available commands
make build # Build for current platform
make build-all # Build for all platforms
make install # Install to GOPATH/bin
make test # Run tests
make test-coverage # Run tests with coverage
make lint # Run linter
make fmt # Format code
make clean # Clean build artifacts
πΊοΈ Roadmap
- Kubernetes operations
- Docker operations
- GitLab CI/CD integration
- Compliance checking
- Shell auto-completion (bash, zsh, fish, powershell)
- GitHub Actions integration
- AWS/GCP/Azure cloud operations
- Terraform state viewer
- Helm chart analysis
- Interactive TUI mode
- Plugin system
- Prometheus metrics querying
- Log aggregation (Loki/ELK)
See the open issues for a full list of proposed features.
π€ Contributing
Contributions make the open-source community amazing! Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
π License
Distributed under the MIT License. See LICENSE for more information.
π Acknowledgements
- Cobra - Powerful CLI library
- Charm - Beautiful terminal UI libraries
- Kubernetes - Container orchestration
- Docker - Containerization platform
- GitLab - DevOps platform
Made with β€οΈ by @SiavashBeheshti
β Star this repo if you find it useful!
Documentation
ΒΆ
There is no documentation for this package.