2.3 KiB
2.3 KiB
Infrastructure CLI Tool
A user-friendly CLI tool for provisioning and managing infrastructure components, with a focus on Kubernetes clusters.
Installation
Important
: This tool has only been tested on Ubuntu 24.04 and WSL Ubuntu 24.04. There is no guarantee it will work on other operating systems.
Quick install/build (Ubuntu)
./build.sh
This builds the CLI tool to project root.
Usage
Run the command to start the interactive CLI:
provision
The tool will guide you through:
- Choosing an operation (provision or cleanup)
- Selecting what to provision/cleanup (Kubernetes or PostgreSQL)
- Configuring settings or using defaults
- Confirming and executing the operation
Example: Provision Kubernetes
$ provision
? What would you like to do? provision
? What would you like to provision? Kubernetes Cluster
Current default settings:
Kubernetes Version: 1.32
Pod CIDR: 192.168.0.0/16
Service CIDR: 10.96.0.0/16
CNI Plugin: calico
Control Plane: 4 CPUs, 8G Memory, 40G Disk
Worker Nodes: 4 CPUs, 8G Memory, 40G Disk
? Do you want to use these default settings? Yes
? Do you want to proceed? Yes
Running provisioning script...
Example: Clean Up
$ provision
? What would you like to do? cleanup
? What would you like to clean up? Kubernetes Cluster
? Are you sure you want to clean up Kubernetes Cluster? Yes
Starting Kubernetes cluster cleanup...
Cleanup completed successfully
Requirements
- Host OS: Ubuntu 24.04 or WSL Ubuntu 24.04 (tool has only been tested on these platforms)
- Ansible (for provisioning operations)
- Multipass (for VM creation)
- SSH client tools
Development
Project Structure
cmd/provision/- Main CLI codecmd/- Command definitions using Cobrakubernetes/- Kubernetes-specific functionalityinteractive/- User interaction utilitiesansible/- Ansible wrapper functionsconfig/- Configuration management
Building the CLI
To modify or extend the CLI tool:
- Make changes to the Go code
- Build binary:
./build.sh
Adding New Commands
- Create a new command file in
cmd/provision/cmd/ - Register the command in
cmd/provision/cmd/root.go - Implement the command functionality
Testing
Run the tests with:
cd cli
go test ./...