-
Notifications
You must be signed in to change notification settings - Fork 521
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
feature: Enable configuration of Kubelet TLS certs #2536
Conversation
9707c9f
to
cdbab0e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're missing a migration for the newly added settings. We need to migrate with the AddSettingsMigration
helper.
sources/api/migration/migrations/v1.11.0/kubelet-tls-config/Cargo.toml
Outdated
Show resolved
Hide resolved
cdbab0e
to
735bccb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⛵
sources/api/migration/migrations/v1.11.0/kubelet-tls-config-files/src/main.rs
Outdated
Show resolved
Hide resolved
install -m 0644 %{S:11} %{buildroot}%{_cross_templatedir}/kubernetes-tls-crt | ||
install -m 0644 %{S:12} %{buildroot}%{_cross_templatedir}/kubernetes-tls-private-crt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might also consider rendering both the certificate and the key to a single templated file, e.g. /etc/kubernetes/pki/kubelet-server-current.pem
, the way that the combined client / server files are today under /var/lib/kubelet/pki
.
7d184a4
to
cbc16f3
Compare
@@ -113,7 +113,12 @@ featureGates: | |||
CSIMigration: false | |||
protectKernelDefaults: true | |||
serializeImagePulls: false | |||
{{#if (and (default "" settings.kubernetes.tls-certificate) (default "" settings.kubernetes.tls-private-key))}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not too happy about this, but without the default
s in there the rendering of the file blows up with a handlebars error:
helper: Couldn't read parameter x
If anyone knows of a better way, please let me know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could also do nested unless
, e.g.
{{#if (and (default "" settings.kubernetes.tls-certificate) (default "" settings.kubernetes.tls-private-key))}} | |
{{#unless settings.kubernetes.tls-certificate}} | |
{{#unless settings.kubernetes.tls-private-key}} | |
serverTLSBootstrap: {{settings.kubernetes.server-tls-bootstrap}} | |
{{/unless}} | |
{{/unless}} |
I wouldn't call it "better", just "different" - and reminiscent of C ifdef
nesting, which is probably why it comes to mind.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We would still need the if
conditional to determine whether to write out of the tlsCert
and tlsPrivateKeyFile
though, right? So the double unless
would work to determine if we need to write out serverTLSBootstrap
, but we also need to know when to do the inverse.
cbc16f3
to
67ce51f
Compare
Rebased on |
67ce51f
to
f599289
Compare
This enables the ability to provide a TLS public and private key to be used by the kubelet process for HTTPS communication. This corresponds to the `--tls-cert-file` and `--tls-key-file` arguments (or the `tlsCertFile` and `tlsPrivateKeyFile` config settings). Signed-off-by: Sean McGinnis <stmcg@amazon.com>
f599289
to
e7b18d6
Compare
Issue number:
Closes #2481
Description of changes:
This enables the ability to provide a TLS public and private key to be used by the kubelet process for HTTPS communication.
It adds
settings.kubernetes.server-certificate
andsettings.kubernetes.server-key
.This corresponds to the
--tls-cert-file
and--tls-key-file
arguments (or thetlsCertFile
andtlsPrivateKeyFile
config settings).Testing done:
Generated an x509 public and private pair.
Used sample eksctl yaml and added the two new settings with the base64 contents of the generated certs.
Deployed cluster and verified creation successful.
Checked contents of generated
/etc/kubernetes/kubelet/config
file were correct.cat
'd contents of the two certificate files written out and made sure they matched my local copies of them.Checked
systemctl status kubelet
and verified service was running and happy.Checked
journalctl -u kubelet
to check if there were any errors.Checked output from
kubectl get pods -A
andkubectl get nodes
to make sure cluster was functional.Terms of contribution:
By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.