A Go CLI tool for managing a local GitOps environment with k3d, ArgoCD, ChartMuseum, and Git server. This tool provides a complete GitOps workflow for deploying applications using ArgoCD and Git-based manifest management.
- Local k3d cluster - Create and manage local Kubernetes clusters with custom names
- ArgoCD integration - Automatic application deployment and synchronization
- Git server - Built-in Git server for manifest storage (no local Git required)
- ChartMuseum - Helm chart repository for package management
- Docker registry - Local container registry for images
Install the latest version directly from GitHub:
go install github.com/aqaliarept/local-gitops/cmd/gitops@latestOr install a specific version:
go install github.com/aqaliarept/local-gitops/cmd/gitops@v1.0.0Clone the repository and build locally:
git clone https://github.com/aqaliarept/local-gitops.git
cd local-gitops
# Using Makefile (recommended)
make build
# Or using go build directly
go build -o bin/gitops ./cmd/gitopsFor development, you can use the provided Makefile:
# Show all available targets
make help
# Build development version
make dev-build
# Install development version
make dev-install
# Run tests
make test
# Clean build artifacts
make cleanCheck that the CLI is installed correctly:
gitops --version
gitops --helpIf the gitops command is not found, you may need to add the Go bin directory to your PATH:
# Add to your shell profile (~/.bashrc, ~/.zshrc, etc.)
export PATH=$PATH:$(go env GOPATH)/bin
# Or for the current session
export PATH=$PATH:$(go env GOPATH)/binYou can verify your Go bin directory location with:
go env GOPATHBefore using the CLI, ensure you have the following tools installed:
- Go (1.21 or later) - For building and installing the CLI
- Docker - For container operations and Git server
- kubectl - For Kubernetes cluster management
- k3d - For local Kubernetes cluster creation
# Install Go
brew install go
# Install Docker
brew install --cask docker
# Install kubectl
brew install kubectl
# Install k3d
brew install k3d# Install Go
sudo apt update
sudo apt install golang-go
# Install Docker
sudo apt install docker.io
sudo systemctl start docker
sudo systemctl enable docker
# Install kubectl
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
# Install k3d
curl -s https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash# Install Go from https://golang.org/dl/
# Install Docker Desktop from https://www.docker.com/products/docker-desktop
# Install kubectl from https://kubernetes.io/docs/tasks/tools/install-kubectl-windows/
# Install k3d from https://k3d.io/stable/#installationThe CLI follows semantic versioning (semver) and provides different installation options:
# Install latest stable release
go install github.com/aqaliarept/local-gitops/cmd/gitops@latest
# Install specific version
go install github.com/aqaliarept/local-gitops/cmd/gitops@v1.0.0# Install latest development version (from main branch)
go install github.com/aqaliarept/local-gitops/cmd/gitops@mainCheck the installed version and build information:
gitops --version
# Output: gitops version 1.0.0 (commit: abc1234, built: 2025-09-21_14:06:18)This project uses GitHub Actions for continuous integration:
The CI workflow runs on every push and pull request to the main branch and performs:
- Dependency Verification: Downloads and verifies Go modules
- Testing: Runs all tests with
go test - Code Analysis: Runs
go vetfor static analysis - Build Verification: Builds the binary using the Makefile
- Binary Testing: Verifies the built binary works correctly
gitops init --target-dir my-app --cluster-name my-clusterThis creates a directory with:
manifest/- nginx application Kubernetes manifests (deployment, service, ingress)bootstrap.yaml- ArgoCD Application manifest.gitops-config.yaml- Configuration file with cluster name and portsREADME.md- Usage instructions
gitops setup --target-dir my-appThis creates:
- k3d cluster with local registry
- ArgoCD for GitOps deployment (default: port 8083)
- ChartMuseum for Helm charts (default: port 8084)
- Git server for manifest storage (default: port 8085)
gitops deploy --target-dir my-appThis:
- Applies the bootstrap.yaml to create ArgoCD application
- Pushes manifest content to Git repository (using Docker container)
- Triggers ArgoCD sync to deploy the nginx application
# Check application status
gitops status --target-dir my-app
# Port forward to services
gitops port-forward --target-dir my-app
# Access nginx application
kubectl port-forward svc/nginx-app 8080:80
curl http://localhost:8080Initialize a new GitOps directory with nginx application manifests.
Flags:
--target-dir- Directory name to create (required)--cluster-name- k3d cluster name (default: "devcluster")--argocd-port- ArgoCD UI port (default: "8083")--chartmuseum-port- ChartMuseum port (default: "8084")--git-server-port- Git server port (default: "8085")
Setup k3d cluster and all GitOps tools (ArgoCD, ChartMuseum, Git server).
Flags:
--target-dir- Directory containing .gitops-config.yaml (default: ".")
Deploy application by applying bootstrap and pushing manifests to Git.
Flags:
--target-dir- Directory containing .gitops-config.yaml (default: ".")
Check the status of the cluster and applications.
Flags:
--target-dir- Directory containing .gitops-config.yaml (default: ".")
Port forward to ArgoCD, ChartMuseum, and Git server.
Flags:
--target-dir- Directory containing .gitops-config.yaml (default: ".")--service- Specific service to port forward (argocd, chartmuseum, git-server, all)
Clean up the k3d cluster and Docker registry.
Flags:
--target-dir- Directory containing .gitops-config.yaml (default: ".")
--verbose- Enable verbose output for all commands
The CLI uses a .gitops-config.yaml file to store configuration:
clusterName: "my-cluster"
registryName: "myregistry.localhost"
registryPort: "5001"
argocdPort: "8083"
chartmuseumPort: "8084"
gitServerPort: "8085"# Initialize with default settings
gitops init --target-dir nginx-app
# Setup cluster (using target-dir)
gitops setup --target-dir nginx-app
# Deploy application (using target-dir)
gitops deploy --target-dir nginx-app
# Check status (using target-dir)
gitops status --target-dir nginx-app
# Access ArgoCD UI (using target-dir)
gitops port-forward --target-dir nginx-app --service argocd
# Open http://localhost:8083 (admin/admin)# Initialize with custom ports
gitops init --target-dir nginx-app \
--cluster-name my-cluster \
--argocd-port 9083 \
--chartmuseum-port 9084 \
--git-server-port 9085
# Setup cluster (using target-dir)
gitops setup --target-dir nginx-app
# Deploy application (using target-dir)
gitops deploy --target-dir nginx-app
# Port forward with custom ports (using target-dir)
gitops port-forward --target-dir nginx-app
# ArgoCD: http://localhost:9083
# ChartMuseum: http://localhost:9084
# Git Server: http://localhost:9085The CLI creates a complete GitOps environment:
- k3d cluster - Local Kubernetes cluster with custom name
- ArgoCD - GitOps continuous delivery (configurable port)
- Git server - Manifest repository (configurable port, no local Git required)
- ChartMuseum - Helm chart repository (configurable port)
- Docker registry - Container image storage
my-app/
├── manifest/
│ ├── deployment.yaml # nginx deployment
│ ├── service.yaml # nginx service
│ └── ingress.yaml # nginx ingress
├── bootstrap.yaml # ArgoCD application
├── .gitops-config.yaml # Configuration file
└── README.md # Usage instructions
- Git repository is initialized and managed within Docker containers
- No need to have Git installed locally or manage local repositories
- All Git operations happen in isolated containers
- All settings stored in
.gitops-config.yaml - Custom port configuration for all services
- Project-specific configuration in each directory
- All commands use
--target-dirto specify the project directory - Commands can be run from any directory by specifying
--target-dir - Each project maintains its own configuration in
.gitops-config.yaml - Consistent workflow regardless of current working directory
- Detailed logging for debugging and monitoring
- Shows all external command executions
- Helps troubleshoot issues during setup and deployment
- Docker
- kubectl
- k3d
- Go (for building from source)
If you encounter port conflicts, use custom ports during initialization:
gitops init --target-dir my-app \
--argocd-port 9083 \
--chartmuseum-port 9084 \
--git-server-port 9085If you have issues with the cluster, clean up and start fresh:
gitops cleanup --target-dir my-app
gitops setup --target-dir my-appAccess ArgoCD UI with default credentials:
- URL: http://localhost:8083 (or your custom port)
- Username: admin
- Password: admin
Enable verbose output to see detailed command execution:
gitops setup --verbose
gitops deploy --verbose