This project is a Go-based application that dynamically watches Kubernetes resources in a cluster using informers. It automatically discovers available API resources and sets up watchers for them, logging add, update, and delete events.
- Dynamically discovers and watches all available Kubernetes API resources.
- Skips deprecated API versions in favor of preferred versions (configurable in the code).
- Logs
Add,Update, andDeleteevents for each watched resource. - Uses the Kubernetes dynamic client and informer factory.
- A running Kubernetes cluster.
- The application should be deployed inside the cluster (uses in-cluster configuration).
- Go 1.19+ installed for local development.
-
Cluster Configuration:
- Uses Kubernetes' in-cluster configuration to authenticate with the API server.
-
API Resource Discovery:
- Retrieves all available API resources using the discovery client.
-
Dynamic Informers:
- Sets up informers for all watchable resources, skipping deprecated API versions if a preferred version is specified.
-
Event Handling:
- Logs
Add,Update, andDeleteevents for each resource.
- Logs
- Build the Application:
go build -o k8s-resource-watcher