Skip to content
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

Auto cert rotation support #119

Open
nasusoba opened this issue May 20, 2024 · 6 comments
Open

Auto cert rotation support #119

nasusoba opened this issue May 20, 2024 · 6 comments

Comments

@nasusoba
Copy link
Contributor

For now, CAPI supports auto cert rotation by setting .rolloutBefore.certificatesExpiryDays(capi doc). It will rollout a machine by creating a new replace if the old machine has a certificate near-expiry.

For k3s, leaf certificates will expired in 365 days, and the leaf cert will automatically being rotated when k3s restarts and the certificate is within 90 days of expiring (ref). But there would be no gaurantee and it might results in downtime. It would be good if we also introduce .rolloutBefore.certificatesExpiryDays to give the auto cert rotation option.

@brandond
Copy link
Member

Creating a new machine and deleting the old one seems more disruptive than just restarting the service. Does CAPI have no way to handle renewing certs on existing machines?

@nasusoba
Copy link
Contributor Author

Creating a new machine and deleting the old one seems more disruptive than just restarting the service. Does CAPI have no way to handle renewing certs on existing machines?

For now, what CAPI could support is this creating and deleting flow for cert renewal, because CAPI assumed a machine is immutable after creation (see relevant issue). This flow is also the standard flow for machine upgrade/ remediation when CAPI manages the cluster. There is work for in-place upgrade but it is still undergoing.

Before inplace-upgrade is ready, I think .rolloutBefore.certificatesExpiryDays could provide an option if the user thinks this creating and updating flow is acceptable compared to manual cert rotation.

@nasusoba
Copy link
Contributor Author

@brandond I find that k3s is exporting CertificateExpirationWarning and CACertificateExpirationWarning event on the k8s node if the cert is close to expire. Could k3scapi relies on this warning for checking how soon the cert is expiring? Thanks!

@brandond
Copy link
Member

The events are a good indicator; there are also metrics available but those would require enabling an agent metrics endpoint that is disabled by default.

@nasusoba
Copy link
Contributor Author

The events are a good indicator; there are also metrics available but those would require enabling an agent metrics endpoint that is disabled by default.

I think we are not enabling those metrics endpoint. Should we enable the metrics endpoint or is ok to just read the events?

@brandond
Copy link
Member

Events are probably fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants