Skip to content

Conversation

@devantler
Copy link
Collaborator

Add support for kubelet certificate rotation in Talos to enhance security and ensure proper functioning with metrics-server.

Fixes #1612

Type of change

  • 🧹 Refactor
  • πŸͺ² Bug fix
  • πŸš€ New feature
  • ⛓️‍πŸ’₯ Breaking change
  • πŸ“š Documentation update

…server

Signed-off-by: Nikolai Emil Damm <nikolaiemildamm@icloud.com>
@github-project-automation github-project-automation bot moved this to πŸƒπŸ»β€β™‚οΈ In Progress in 🌊 Project Board Dec 28, 2025
@devantler devantler self-assigned this Dec 28, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 28, 2025

@codecov
Copy link

codecov bot commented Dec 28, 2025

Codecov Report

❌ Patch coverage is 69.13580% with 25 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/cluster/create.go 30.76% 9 Missing ⚠️
pkg/io/generator/talos/generator.go 70.00% 3 Missing and 3 partials ⚠️
pkg/io/scaffolder/scaffolder.go 79.31% 5 Missing and 1 partial ⚠️
pkg/io/config-manager/talos/configs.go 78.94% 2 Missing and 2 partials ⚠️

πŸ“’ Thoughts on this report? Let us know!

devantler and others added 4 commits December 28, 2025 19:33
@devantler devantler marked this pull request as ready for review December 28, 2025 18:41
Copilot AI review requested due to automatic review settings December 28, 2025 18:41
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds kubelet certificate rotation support for Talos clusters when metrics-server is enabled, fixing issue #1612. The change ensures that metrics-server can scrape kubelet metrics over HTTPS without TLS errors by automatically enabling the rotate-server-certificates flag.

Key changes:

  • Introduces automatic kubelet certificate rotation configuration for Talos when metrics-server is enabled
  • Refactors notification methods in the scaffolder for better code organization and maintainability
  • Adds comprehensive test coverage for the Talos generator with new certificate rotation scenarios

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pkg/io/scaffolder/scaffolder.go Adds enableKubeletCertRotation logic and refactors notification methods into smaller, reusable functions
pkg/io/generator/talos/generator.go Implements kubelet certificate rotation patch generation with new config field and patch file creation
pkg/io/generator/talos/generator_test.go Adds comprehensive test coverage for kubelet cert rotation scenarios including standalone and combined configurations
pkg/io/config-manager/talos/configs.go Implements ApplyKubeletCertRotation method and introduces helper function applyPatchToBothConfigs to reduce code duplication
pkg/io/config-manager/talos/configs_test.go Adds tests for kubelet cert rotation application and idempotency
cmd/cluster/create.go Adds setupTalosKubeletCertRotation function to apply cert rotation at cluster creation time
docs/configuration/index.md Fixes markdown table alignment formatting
docs/configuration/declarative-configuration.md Fixes markdown table alignment formatting across multiple tables

…for config application

Signed-off-by: Nikolai Emil Damm <nikolaiemildamm@icloud.com>
@botantler botantler bot enabled auto-merge (squash) December 28, 2025 18:58
@github-project-automation github-project-automation bot moved this from πŸƒπŸ»β€β™‚οΈ In Progress to πŸš€ In Finalization in 🌊 Project Board Dec 28, 2025
@devantler devantler requested a review from Copilot December 28, 2025 19:15
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

devantler and others added 2 commits December 28, 2025 20:34
Copilot AI review requested due to automatic review settings December 28, 2025 19:37
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

@devantler devantler force-pushed the feat/add-kubelet-cert-rotation-patch-to-talos-with-metrics-server branch from dde395e to fff3f05 Compare December 28, 2025 19:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

@devantler
Copy link
Collaborator Author

devantler commented Dec 28, 2025

We need to revisit this implementation as rotating server certificates is something we do to support metrics server WITH https. So we need to do something like the below when metrics server on Talos clusters:

  1. Deploy metrics server as a helm chart where we do not use insecure http.
  2. Deploy alex1989hu/kubelet-serving-cert-approver (preferably also as a helm chart) to ensure that new certificates for the kubelets are approved automatically.

Talos docs describe it here: https://docs.siderolabs.com/kubernetes-guides/monitoring-and-observability/deploy-metrics-server

If this works for Talos, it might also work for other distributions minus the Talos cluster-wide patch. We should consider migrating all installations of metrics-server to this approach, as it is superior because it does not rely on http as the current approach does.

@devantler devantler marked this pull request as draft December 28, 2025 21:23
auto-merge was automatically disabled December 28, 2025 21:23

Pull request was converted to draft

@devantler devantler moved this from πŸš€ In Finalization to πŸƒπŸ»β€β™‚οΈ In Progress in 🌊 Project Board Dec 28, 2025
@devantler devantler closed this Jan 5, 2026
@github-project-automation github-project-automation bot moved this from πŸƒπŸ»β€β™‚οΈ In Progress to βœ… Done in 🌊 Project Board Jan 5, 2026
@devantler devantler deleted the feat/add-kubelet-cert-rotation-patch-to-talos-with-metrics-server branch January 5, 2026 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: βœ… Done

Development

Successfully merging this pull request may close these issues.

[feature]: Secure metrics-server with HTTPS across all distributions

2 participants