-
Couldn't load subscription status.
- Fork 83
Track Kubernetes Channels for latest versions #351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
d006aae
53b21f5
c574db5
bcca8e3
e33bb7e
09f0a0f
ae1ad29
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -110,19 +110,36 @@ func NewCommand(ctx context.Context) *cobra.Command { | |
| return fmt.Errorf("failed to setup image registry clients: %s", err) | ||
| } | ||
|
|
||
| c := controller.NewPodReconciler(opts.CacheTimeout, | ||
| _ = client | ||
|
|
||
| podController := controller.NewPodReconciler(opts.CacheTimeout, | ||
| metricsServer, | ||
| client, | ||
| mgr.GetClient(), | ||
| log, | ||
| opts.RequeueDuration, | ||
| opts.DefaultTestAll, | ||
| ) | ||
|
|
||
| if err := c.SetupWithManager(mgr); err != nil { | ||
| if err := podController.SetupWithManager(mgr); err != nil { | ||
| return err | ||
| } | ||
|
|
||
| kubeController := controller.NewKubeReconciler( | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was thinking, if it's worth checking ig |
||
| log, | ||
| mgr.GetConfig(), | ||
| metricsServer, | ||
| opts.KubeInterval, | ||
| opts.KubeChannel, | ||
| ) | ||
|
|
||
| // Only add to manager if controller was created (channel was specified) | ||
| if kubeController != nil { | ||
| if err := mgr.Add(kubeController); err != nil { | ||
| return err | ||
| } | ||
| log.WithField("channel", opts.KubeChannel).Info("Kubernetes version checking enabled") | ||
| } | ||
|
|
||
| // Start the manager and all controllers | ||
| log.Info("Starting controller manager") | ||
| if err := mgr.Start(ctx); err != nil { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| # Kubernetes Version Monitoring | ||
|
|
||
| version-checker now includes built-in Kubernetes cluster version monitoring capabilities. This feature automatically compares your cluster's current Kubernetes version against the latest available versions from official Kubernetes release channels. | ||
|
|
||
| ### How It Works | ||
|
|
||
| The Kubernetes version checker: | ||
| - Fetches the current cluster version using the Kubernetes Discovery API | ||
| - Compares it against the latest version from the configured Kubernetes release channel (using official `https://dl.k8s.io/release/` endpoints) | ||
| - Exposes the comparison as Prometheus metrics for monitoring and alerting | ||
| - Strips metadata from versions for accurate semantic version comparison (e.g., `v1.28.2-gke.1` becomes `v1.28.2`) | ||
|
|
||
| ### Configuration | ||
|
|
||
| You can configure the Kubernetes version checking behavior using the following CLI flags: | ||
|
|
||
| - `--kube-channel`: Specifies which Kubernetes release channel to check against (default: `"stable"`) | ||
| - Examples: `stable`, `latest`, `stable-1.28`, `latest-1.29` | ||
| - `--kube-interval`: How often to check for Kubernetes version updates (default: same as `--cache-sync-period`, 5 hours) | ||
|
|
||
| ### Metrics | ||
|
|
||
| The Kubernetes version monitoring exposes the following Prometheus metric: | ||
|
|
||
| ``` | ||
| version_checker_is_latest_kube_version{current_version="1.28.2", latest_version="1.29.1", channel="stable"} 0 | ||
| ``` | ||
|
|
||
| - Value `1`: Cluster is running the latest version from the specified channel | ||
| - Value `0`: Cluster is not running the latest version (update available) | ||
|
|
||
| ### Supported Channels | ||
|
|
||
| version-checker uses official Kubernetes release channels: | ||
|
|
||
| - `stable` - Latest stable Kubernetes release (recommended) | ||
| - `latest` - Latest Kubernetes release (including pre-releases) | ||
| - `latest-1.28` - Latest patch for Kubernetes 1.28.x | ||
| - `latest-1.27` - Latest patch for Kubernetes 1.27.x | ||
|
|
||
| ### Examples | ||
|
|
||
| ```bash | ||
| # Check against latest stable Kubernetes | ||
| version-checker --kube-version-channel=stable | ||
|
|
||
| # Check against latest Kubernetes (including alpha/beta) | ||
| version-checker --kube-version-channel=latest | ||
|
|
||
| # Check against latest 1.28.x patch | ||
| version-checker --kube-version-channel=latest-1.28 | ||
|
|
||
| # Monitor against a specific version channel with custom interval | ||
| ./version-checker --kube-channel=stable-1.28 --kube-interval=1h | ||
| ``` | ||
|
|
||
| ### Managed Kubernetes Support | ||
|
|
||
| Works with all managed Kubernetes services: | ||
| - **Amazon EKS**: Compares `v1.28.2-eks-abc123` against upstream `v1.28.2` | ||
| - **Google GKE**: Compares `v1.28.2-gke.1034000` against upstream `v1.28.2` | ||
| - **Azure AKS**: Compares `v1.28.2-aks-xyz789` against upstream `v1.28.2` |
Uh oh!
There was an error while loading. Please reload this page.