Skip to content

Certificate rotation #234

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

Closed
garloff opened this issue Aug 11, 2022 · 10 comments
Closed

Certificate rotation #234

garloff opened this issue Aug 11, 2022 · 10 comments
Assignees
Labels
bug Something isn't working Container Issues or pull requests relevant for Team 2: Container Infra and Tooling on hold Is on hold Sprint Montreal Sprint Montreal (2023, cwk 40+41)

Comments

@garloff
Copy link
Member

garloff commented Aug 11, 2022

We need to ensure we rotate all certificates to avoid expiration.
This is tracked in SovereignCloudStack/issues#155

@garloff garloff added bug Something isn't working Container Issues or pull requests relevant for Team 2: Container Infra and Tooling labels Aug 11, 2022
@garloff garloff added this to the v4.0.0 milestone Aug 11, 2022
@garloff garloff moved this to Backlog in Sovereign Cloud Stack Aug 11, 2022
@garloff
Copy link
Member Author

garloff commented Aug 26, 2022

Tracked here now.
I see three places where to enable kubelet client certificate rotation:
configmap kube-system/kubelet-config-1.xx:

data:
  kubelet: |
    rotateCertificates: true

and in KubeadmControlPlane in cluster-template.yaml

spec:
  kubeadmConfigSpec:
    initConfiguration:
      nodeRegistration:
        name: '{{ local_hostname }}'
        kubeletExtraArgs:
          cloud-provider: external
          rotateCertificates: true
    joinConfiguration:
      nodeRegistration:
        name: '{{ local_hostname }}'
        kubeletExtraArgs:
          cloud-provider: external
          rotateCertificates: true

which I believe will be propagated to /var/lib/kubelet/kubeadm-flags.env on the deployed nodes.
Do we need to tweak both places?
The setting in the configmap already seems to be there in newer versions, will need to research where it was added.

@garloff
Copy link
Member Author

garloff commented Aug 26, 2022

Passing --rotate-certificates as command line parameter is deprecated in favor of using rotateCertificates: true in the kubelet config file (/var/lib/kubelet/config.yaml). This is already enabled by default (thanks to upstream changes I assume, which I still need to track down and identify).
This issue may be non-existing for reasonably recent setups.

@garloff
Copy link
Member Author

garloff commented Aug 26, 2022

According to kubelet documentation the rotateCertificates: flag defaults to false, so we're lucky that it is set to true explicitly.
Looking through kubeadm, I can not find where this would be set. Nor do I see it in cluster-api, where some of the plumbing for kubeadm happens.

@garloff
Copy link
Member Author

garloff commented Aug 29, 2022

TODO:

  • Need to test it really works (does really rotate the certs)
  • Identify where it was implemented

@garloff garloff moved this from Backlog to Doing in Sovereign Cloud Stack Aug 29, 2022
@batistein
Copy link
Contributor

In KCP & KCT you need to write rotate-certificates: true under the kubeletExtraArgs. The notation of commandline flags is always used there.

@batistein
Copy link
Contributor

Currently, certificates are not automatically rotated in place. When using CAPBK, the CA certificate is copied to the node and kubeadm then creates new certificates.
Currently, the client certificate rotation is simply solved by exchanging the machines within one year. See more information here in the upstream tracking issue (this is also about serving certs): kubernetes-sigs/cluster-api#6529

@batistein batistein removed their assignment Aug 29, 2022
@garloff
Copy link
Member Author

garloff commented Sep 5, 2022

OK, we will need to document this!

@garloff
Copy link
Member Author

garloff commented Sep 14, 2022

Andrej has a good text proposal in in issues/#155:
SovereignCloudStack/issues#155 (comment)

@garloff garloff moved this from Doing to Blocked / On hold in Sovereign Cloud Stack Dec 5, 2022
@jschoone
Copy link
Contributor

jschoone commented Apr 3, 2023

As discussed in container meeting on april 3 it could depend on the clusterapi version which needs to be researched

@jschoone jschoone moved this from Blocked / On hold to Doing in Sovereign Cloud Stack Apr 3, 2023
@jschoone jschoone assigned batistein and unassigned curx, mxmxchere, garloff and fynluk Apr 3, 2023
@jschoone
Copy link
Contributor

Hi @batistein, since this is still in status Doing, will you be able to address this next week?

@jschoone jschoone removed this from the R3 (v4.0.0) milestone Apr 21, 2023
@jschoone jschoone moved this from Doing to Refined Stories in Sovereign Cloud Stack Apr 24, 2023
@jschoone jschoone added the on hold Is on hold label Oct 10, 2023
@github-project-automation github-project-automation bot moved this from Refined Stories to Done in Sovereign Cloud Stack Oct 10, 2023
@jschoone jschoone reopened this Oct 11, 2023
@jschoone jschoone closed this as not planned Won't fix, can't repro, duplicate, stale Oct 11, 2023
@github-project-automation github-project-automation bot moved this from Done to Backlog in Sovereign Cloud Stack Oct 11, 2023
@github-project-automation github-project-automation bot moved this from Backlog to Done in Sovereign Cloud Stack Oct 11, 2023
@jschoone jschoone added the Sprint Montreal Sprint Montreal (2023, cwk 40+41) label Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Container Issues or pull requests relevant for Team 2: Container Infra and Tooling on hold Is on hold Sprint Montreal Sprint Montreal (2023, cwk 40+41)
Projects
Archived in project
Development

No branches or pull requests

6 participants