This repository has been archived by the owner on Jun 29, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: implement automatic certificate rotation while updating cluster
This commit is a WIP version of automated certificate rotation implementation, which right now occurs on every cluster update, but as we discussed, this functionality needs to be moved into separate subcommand. Some highlights: - Added config checksum to kube-apiserver and kube-controller-manager to trigger automatic recreation of pods when secrets are updated. - Added ca-syncer init container to kubelet which ensures that bootstrap kubeconfig and one generated by TLS bootstrapping used by kubelet and client-ca certificate are always up to date, as kubelet seems to be not capable of updating them themselve. - Temporarily force kube-controller-manager to sign certificates with only 45 minutes duration to make sure certificate rotation works as expected and all used certificates are rotated. - When any of certificates used by etcd is changed, trigger copy-controller-secrets null_resource to copy etcd certificates on all controller nodes and then restart etcd to ensure it picks up new certificates, as it can only automatically pick up new client certificates and private key, but not CA certificate. - Temporarily switch certificate validity hours on AWS to 1 hour to enforce running 'lokoctl cluster apply' every hour to keep cluster alive to make sure certificate rotation works as expected. - 'lokoctl cluster apply' now taints all certificate resources on cluster update and after cluster is updated, it waits for all service account token secrets to be updated with the new CA certificate, then triggers a restart on all system deployments to make sure they pick up new CA certificate. This is core of certificate rotation logic. TODO: - Split into multiple commits. - Add support for platforms other than AWS. - Add support for single controller node clusters. - Move rotation code to separate subcommand. - Refactor code to avoid large functions. - Refactor logic for waiting for Deployment and DaemonSet to converge, so it can also be re-used in testing framework. Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
- Loading branch information
Showing
15 changed files
with
450 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.