A modern, modular command-line toolkit for Kubernetes operations, built with Go and following Test-Driven Development (TDD) principles.
Go K8s Tools aims to simplify and automate Kubernetes workflows for DevOps, SRE, and backend engineers. The project provides a robust, extensible foundation for building custom K8s CLI tools, focusing on maintainability, scalability, and developer productivity.
go-k8s-tools/
├── cmd/ # CLI entry points and main commands
│ └── root.go # Main command definition
├── internal/ # Private application logic
│ ├── cli/ # CLI command implementations and handlers
│ │ └── terminal_ui_service.go
│ ├── core/ # Core logic and dependency injection
│ │ └── dependency_injection.go
│ ├── k8s/ # Kubernetes business logic
│ │ ├── k8s_client.go
│ │ ├── k8s_service.go
│ │ ├── k8s_service_test.go
│ │ └── resource_structs.go
├── pkg/ # Public utility library
│ └── utils/
│ └── utilies.go
├── test/ # Testing infrastructure and test files
│ └── fixtures/ # Test data and mock files
├── main.go # Program entry point
├── go.mod / go.sum # Go modules management
├── Makefile # Automation scripts
├── README.md # Project documentation
├── docs/ # Additional docs
- Install dependencies
go mod tidy
- Run the main program
go run main.go
- Run tests
go test ./...
To build the executable file using Make:
-
Build the project
make build
The compiled executable will be generated in the workspace root as
gk.exe
(on Windows) orgk
(on Unix-like systems). -
Run the executable
./gk.exe
(On Unix-like systems, use
./gk
)
- Place business logic in
internal/
, reusable utilities inpkg/
- Cover all major features with tests in
test/
or alongside code - Use dependency injection (
internal/core/dependency_injection.go
) for modularity - CLI commands are recommended to use Cobra
- Configuration via Viper, logging via Logrus
Feel free to open issues, submit PRs, or contact maintainers to help improve this project!
For more details, check the docs/
folder. Happy coding! 😄