Tasks
A comprehensive Taskfile collection for Kubernetes development and operations.
Overview
This repository provides a modular, composable set of task definitions for:
- Ephemeral Cluster Management: Kind, K3d, Talos
- Application Deployment: GitOps, observability, databases, service mesh
- Infrastructure Automation: Terraform, Ansible, Pulumi
- Developer Productivity: Standardized workflows across tools
Quick Start
# Install prerequisites
brew install go-task kubectl helm
# Clone repository
git clone https://github.com/andrewrothstein/tasks.git
cd tasks
# Set up environment
cp .env.sample .env
# Edit .env with your settings
# (Optional) Set up pre-commit hooks
uvx pre-commit install # Auto-run checks on git commit
# Option 1: Create default cluster (Kind + Cilium)
task up
# Option 2: Choose specific cluster type
CLUSTER_PROVIDER=k3d task up # Use K3d
CLUSTER_PROVIDER=kind+calico task up # Kind with Calico
CLUSTER_PROVIDER=byo-cluster task up # Use existing clusterCluster Selection
Choosing Your Cluster Type
The repository supports multiple cluster types, each optimized for different use cases:
Via Environment Variable (Recommended)
# Default (Kind with Cilium CNI)
task up
# Specific cluster type
CLUSTER_PROVIDER=kind task up # Basic Kind cluster
CLUSTER_PROVIDER=kind+cilium task up # Kind with Cilium CNI (eBPF)
CLUSTER_PROVIDER=kind+calico task up # Kind with Calico CNI
CLUSTER_PROVIDER=kind+antrea task up # Kind with Antrea CNI
CLUSTER_PROVIDER=kind+registry task up # Kind with local registry
CLUSTER_PROVIDER=kind+spegel task up # Kind with P2P image cache
CLUSTER_PROVIDER=k3d task up # K3d (lightweight, fast)
CLUSTER_PROVIDER=byo-cluster task up # BYO external clusterDirect Task Invocation
task kind:create # Basic Kind cluster
task kind+cilium:create # Kind with Cilium
task k3d:create # K3d clusterCluster Types Explained
| Cluster Type | Best For | Features |
|---|---|---|
| kind | Basic testing | Simple, standard CNI |
| kind+cilium | Advanced networking | eBPF, network policies, observability |
| kind+calico | Enterprise features | BGP, advanced policies |
| kind+antrea | VMware environments | Windows node support |
| kind+registry | Local development | Built-in container registry |
| kind+spegel | CI/CD pipelines | P2P image distribution |
| k3d | Quick iteration | Fast startup, lightweight |
| byo-cluster | Production-like | Use existing clusters (Harvester, EKS, etc.) |
Core Commands
Cluster Management
# Create clusters
task kind:create # Create Kind cluster
task k3d:create # Create K3d cluster
CLUSTER_PROVIDER=byo-cluster task up # Use external cluster
# Delete clusters
task kind:delete # Destroy Kind cluster
task k3d:delete # Destroy K3d cluster
# Switch between multiple clusters
task k8s:switch cluster=harvester # Switch to different cluster
task k8s:list-clusters # List available configs
task k8s:current # Show current clusterApplication Deployment
task argocd:apply # Deploy ArgoCD
task prometheus:apply # Deploy Prometheus
task istio:apply # Deploy Istio service mesh
task cert-manager:apply # Deploy cert-managerTesting
task test # Run all tests
task test:quick # Quick tests (no cluster ops)
task test:ci # CI-appropriate testsEnvironment Configuration
Using Doppler (Recommended)
doppler run --mount .env -- task upUsing .env File
cp .env.sample .env
# Edit .env with your configuration
task upRepository Structure
.
├── Taskfile.yml # Main task orchestrator
├── kubectl.yml # Kubernetes operations utilities
├── kind*.yml # Kind cluster variants
├── k3d.yml # K3d cluster configuration
├── k8s-*.yml # Category aggregators
├── tests/ # Test suites
│ ├── test-all.yml # Test orchestrator
│ └── test-kubectl.yml # kubectl.yml tests
└── chart-*/ # Custom Helm charts
Advanced Usage
Using External Clusters (BYO)
For production or externally-managed clusters (Harvester, Rancher, EKS, GKE, AKS):
# Import existing kubeconfig
task kubectl-config:import file=~/Downloads/kubeconfig.yaml cluster=harvester
# Switch to external cluster
task k8s:switch cluster=harvester
# Use with BYO mode (no-op create/delete)
CLUSTER_PROVIDER=byo-cluster task up
# Quick switches for common clusters
task k8s:use-harvester # Switch to Harvester
task k8s:use-k3s # Switch to K3s
task k8s:use-local # Back to local Kind/K3dManaging Multiple Kubeconfigs
# List available configs
task kubectl-config:list
# Switch between configs
task kubectl-config:switch cluster=dev
task kubectl-config:switch cluster=staging
task kubectl-config:switch cluster=prod
# Merge multiple configs
task kubectl-config:merge clusters=dev,staging,prod output=all
# Backup current config
task kubectl-config:backup name=before-changesDry-Run Mode
KUBECTL_DRY_RUN=true task argocd:applyCustom Timeouts
KUBECTL_TIMEOUT=600s task prometheus:applyTesting
The repository includes comprehensive test coverage:
# Run specific test suites
task --taskfile tests/test-kubectl.yml test-all
# Test individual components
task --taskfile tests/test-kubectl.yml test-namespace
task --taskfile tests/test-kubectl.yml test-apply-deleteContributing
Development Setup
-
Install pre-commit hooks (optional but recommended):
pip install pre-commit pre-commit install
-
Or use uvx (no installation needed):
uvx pre-commit run --all-files
Before Committing
-
Run pre-commit checks:
# Check all files uvx pre-commit run --all-files # Or if pre-commit is installed pre-commit run --all-files # Check only staged files (automatic if hooks installed) pre-commit run
-
Run tests:
task test:quick
Contribution Guidelines
- Create tests for new functionality in
tests/ - Follow existing patterns for task organization
- Update CLAUDE.md for AI-assisted development
- Ensure all pre-commit checks pass
- Run
task testbefore submitting changes - Keep documentation (README.md and CLAUDE.md) in sync
License
MIT
Secrets Management
- For secrets I use doppler:
doppler run --mount .env -- task up - Feel free to manage your secrets as you see fit in
.envper the.env.sample