k8s-controller-ops
Installation
SKILL.md
Controller Operations
Operational patterns for running Kubernetes controllers in production. Covers leader election, RBAC management, finalizer safety, Server-Side Apply, extension points, credential rotation, and drift detection.
Leader Election
Lease-Based Election
Use Lease objects (not ConfigMaps) for leader election:
mgr, err := ctrl.NewManager(cfg, ctrl.Options{
LeaderElection: true,
LeaderElectionID: "my-controller-leader",
LeaderElectionNamespace: "my-system",
// Graceful shutdown: release lease when stopping
LeaderElectionReleaseOnCancel: true,
})