k8s-controller
🔰 A production-grade Golang Kubernetes controller
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.2%) to scientific vocabulary
Keywords
Repository
🔰 A production-grade Golang Kubernetes controller
Basic Info
- Host: GitHub
- Owner: searge
- License: gpl-3.0
- Language: Go
- Default Branch: main
- Homepage: https://pkg.go.dev/github.com/Searge/k8s-controller
- Size: 238 KB
Statistics
- Stars: 4
- Watchers: 0
- Forks: 0
- Open Issues: 1
- Releases: 3
Topics
Metadata Files
README.md
Kubernetes Controller
My implementation of the Golang Kubernetes Controller course from FWDays.
About
This project follows the step-by-step tutorial for building production-grade Kubernetes controllers in Go. Each step is implemented as a separate commit/branch with detailed explanations.
Course: Crash Course: Kubernetes controllers Instructors: @den-vasyliev (Principal SRE), @Alex0M (Senior Platform Engineer)
Quick Start
Prerequisites
- Go 1.23.1+ - Installation guide
- Taskfile - Installation guide
- Podman - Installation guide
- Docker (optional) - Alternative to Podman
One-Command Setup
Get a complete Kubernetes development environment running in seconds:
```bash
Clone the repository
git clone https://github.com/Searge/k8s-controller.git cd k8s-controller
Initialize Podman machine and provision Kubernetes cluster
task init && task ssh -- 'cd /srv/app && go-task provision'
Access your cluster
task ssh kubectl get nodes kubectl get all -A ```
This automated setup creates:
- Podman machine with Fedora CoreOS
- Complete single-node Kubernetes cluster (v1.30.0)
- All control plane components (etcd, API server, scheduler, controller-manager)
- Kubelet with containerd runtime
- CNI networking with bridge plugin
- PKI infrastructure with auto-generated certificates
Development Environment
The project includes a fully automated Kubernetes cluster setup for realistic controller development and testing. See ansible/README.md for detailed information about:
- Automated cluster provisioning
- Component configuration
- Available Ansible tags for selective deployment
- Troubleshooting and logging
Available Tasks
The project uses Taskfile for task automation:
```bash
View all available tasks
task
Development workflow
task dev # Format, lint, test, build task test-watch # Run tests in watch mode task docker-build # Build Docker image
Environment management
task init # Create and setup Podman machine task ssh # SSH into the machine task provision # Run Ansible provisioning task reboot # Restart the machine task rm # Remove the machine ```
Progress
[x] Foundation
- [x] Golang CLI Application using Cobra
- [x] Structured logging with zerolog
- [x] HTTP server with FastHTTP
- [x] Comprehensive testing suite
- [x] Quality assurance with linters
- [x] Development environment automation
- [x] Documentation and examples
[ ] Kubernetes Integration (Next Steps)
- [ ] List Kubernetes Deployments with client-go
- [ ] Deployment Informer with client-go
- [ ] JSON API Endpoint for deployments
- [ ] controller-runtime Deployment Controller
- [ ] Leader Election and Metrics
[ ] Advanced Features (Future)
- [ ] Custom Resource (FrontendPage CRD)
- [ ] Platform API (CRUD + Swagger)
- [ ] JWT Authentication
- [ ] OpenTelemetry Instrumentation
- [ ] Helm Charts and GitOps
Architecture
```mermaid C4Container title Kubernetes Controller Architecture
Person(user, "DevOps Engineer", "Uses CLI")
System_Boundary(app, "Controller Application") {
Container(cli, "CLI Client", "Go, Cobra", "Command line interface")
Container(server, "HTTP Server", "Go, FastHTTP", "REST API and UI")
Container(controller, "Controller", "Go, controller-runtime", "Reconciliation logic")
Container(informers, "Informers", "Go, client-go", "Watch and cache")
}
System_Ext(k8s, "Kubernetes API", "Manages cluster resources")
Rel(user, cli, "Uses")
Rel(cli, server, "Commands")
Rel(server, k8s, "API calls")
Rel(k8s, informers, "Events")
Rel(informers, controller, "Cached data")
Rel(controller, k8s, "Reconcile")
```
Project Structure
bash
├── ansible/ # Kubernetes cluster automation
│ ├── README.md # Detailed Ansible documentation
│ ├── init.yml # Initial system setup
│ ├── provision.yml # Main K8s provisioning
│ └── templates/ # Service and config templates
├── cmd/ # CLI application code
├── notebooks/ # Go learning notebooks
├── scripts/ # Setup and utility scripts
├── Taskfile.yaml # Task automation
├── Dockerfile # Container image definition
└── README.md # This file
📚 Documentation
- API Documentation - HTTP endpoints and CLI commands
🔗 Resources
- Course: Kubernetes Controllers Crash Course
- Reference: Tutorial Reference Implementation
- Go Style: Google Go Style Guide
- Kubernetes: client-go Documentation
📄 License
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
Built with ❤️ by @Searge
Owner
- Name: Sergij Boremchuk
- Login: Searge
- Kind: user
- Location: Luts'k, Ukraine
- Company: @Smile-SA
- Website: https://searge.github.io
- Twitter: Searge
- Repositories: 24
- Profile: https://github.com/Searge
DevOps
Citation (CITATION.cff)
cff-version: 1.2.0
message: "If you use this software, please cite it as below."
type: software
title: "Kubernetes Controller"
abstract: "A production-grade Golang Kubernetes controller implementation following a step-by-step tutorial for DevOps and SRE engineers. This project demonstrates building Kubernetes controllers with Go, including CLI applications, HTTP servers, informers, custom resources, and observability features."
authors:
- family-names: "Boremchuk"
given-names: "Sergij"
email: "searge@duck.com"
repository-code: "https://github.com/Searge/k8s-controller"
url: "https://github.com/Searge/k8s-controller"
license: GPL-3.0-or-later
keywords:
- kubernetes
- golang
- controller
- devops
- sre
- client-go
- controller-runtime
- cobra
- containerization
- infrastructure
version: "0.5.0"
date-released: "2025-07-07"
references:
- type: software
title: "Kubernetes Controller Tutorial Reference"
authors:
- family-names: "Vasyliev"
given-names: "Denis"
- family-names: "Sudom"
given-names: "Alex"
url: "https://github.com/den-vasyliev/k8s-controller-tutorial-ref"
notes: "Original tutorial and reference implementation"
- type: course
title: "Crash Course: Kubernetes controllers"
url: "https://fwdays.com/event/kubernetes-controllers-course"
notes: "Course by Denis Vasyliev (Principal SRE) and Alex Sudom (Senior Platform Engineer)"
GitHub Events
Total
- Watch event: 1
- Delete event: 7
- Issue comment event: 19
- Push event: 31
- Pull request review comment event: 3
- Pull request review event: 8
- Pull request event: 11
- Create event: 11
Last Year
- Watch event: 1
- Delete event: 7
- Issue comment event: 19
- Push event: 31
- Pull request review comment event: 3
- Pull request review event: 8
- Pull request event: 11
- Create event: 11
Committers
Last synced: 8 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Searge | s****e@d****m | 53 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 0
- Total pull requests: 6
- Average time to close issues: N/A
- Average time to close pull requests: 2 days
- Total issue authors: 0
- Total pull request authors: 3
- Average comments per issue: 0
- Average comments per pull request: 2.67
- Merged pull requests: 5
- Bot issues: 0
- Bot pull requests: 3
Past Year
- Issues: 0
- Pull requests: 6
- Average time to close issues: N/A
- Average time to close pull requests: 2 days
- Issue authors: 0
- Pull request authors: 3
- Average comments per issue: 0
- Average comments per pull request: 2.67
- Merged pull requests: 5
- Bot issues: 0
- Bot pull requests: 3
Top Authors
Issue Authors
Pull Request Authors
- searge (2)
- dependabot[bot] (2)
- Searge (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 2
- Total downloads: unknown
-
Total dependent packages: 0
(may contain duplicates) -
Total dependent repositories: 0
(may contain duplicates) - Total versions: 16
proxy.golang.org: github.com/Searge/k8s-controller
- Documentation: https://pkg.go.dev/github.com/Searge/k8s-controller#section-documentation
- License: gpl-3.0
-
Latest release: v0.5.0
published 8 months ago
Rankings
proxy.golang.org: github.com/searge/k8s-controller
- Documentation: https://pkg.go.dev/github.com/searge/k8s-controller#section-documentation
- License: gpl-3.0
-
Latest release: v0.5.0
published 8 months ago
Rankings
Dependencies
- actions/checkout v4 composite
- actions/setup-go v5 composite
- gwatts/go-coverage-action v2 composite
- github.com/inconshreveable/mousetrap v1.1.0
- github.com/spf13/cobra v1.9.1
- github.com/spf13/pflag v1.0.6
- github.com/cpuguy83/go-md2man/v2 v2.0.6
- github.com/inconshreveable/mousetrap v1.1.0
- github.com/russross/blackfriday/v2 v2.1.0
- github.com/spf13/cobra v1.9.1
- github.com/spf13/pflag v1.0.6
- gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405
- gopkg.in/yaml.v3 v3.0.1