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

add support for kubelet in standalone mode and TLS auth #1338

Merged
merged 4 commits into from
Feb 22, 2021

Conversation

bcressey
Copy link
Contributor

Issue number:
N/A

Description of changes:
Refactored handling of kubelet args so they can be templated. Added support for "standalone" mode, where the kubelet is started without a kubeconfig file and does not connect to an API server.

Testing done:
Verified that 1.18 and 1.19 nodes came up with the expected defaults: standalone mode off, AWS authentication on.

Launched 1.15, 1.16, 1.17, 1.18, and 1.19 in standalone mode running a static redis pod. Confirmed that kubelet started correctly and brought up redis.

[settings.kubernetes]
standalone-mode = true

[settings.kubernetes.static-pods.redis]
manifest = "YXBpVmVyc2lvbjogdjEKa2luZDogUG9kCm1ldGFkYXRhOgogIG5hbWU6IHJlZGlzCnNwZWM6CiAgaG9zdE5ldHdvcms6IHRydWUKICBjb250YWluZXJzOgogIC0gbmFtZTogcmVkaXMKICAgIGltYWdlOiByZWRpczpsYXRlc3QKICAgIHBvcnRzOgogICAgLSBjb250YWluZXJQb3J0OiA2Mzc5CiAgICByZXNvdXJjZXM6CiAgICAgIGxpbWl0czoKICAgICAgICBjcHU6ICIwLjEiCg=="
enabled = true

Launched 1.15, 1.16, 1.17, 1.18, and 1.19 in TLS authentication mode with a bootstrap token to join a cluster provisioned by the Cluster API Provider for AWS (CAPA). All nodes joined.

❯ kubectl --kubeconfig snowflake.kubeconfig get nodes
NAME                                         STATUS     ROLES    AGE     VERSION
ip-10-0-116-63.us-west-2.compute.internal    NotReady   <none>   3m37s   v1.17.16
ip-10-0-121-4.us-west-2.compute.internal     NotReady   <none>   2m12s   v1.15.12
ip-10-0-123-129.us-west-2.compute.internal   NotReady   <none>   11m     v1.18.14
ip-10-0-73-82.us-west-2.compute.internal     NotReady   <none>   3m43s   v1.16.15
ip-10-0-81-70.us-west-2.compute.internal     NotReady   <none>   73s     v1.19.6

(Nodes are in NotReady status because I haven't set up a CNI plugin.)

Tested upgrade and downgrade from 1.0.5 into 1.0.6 with the migrations. Verified that new settings were removed and old lists restored on downgrade.

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.

By using a systemd drop-in file for the kubelet args, we can control
them using a template, while leaving the main service unit in place
for dependency resolution.

Signed-off-by: Ben Cressey <[email protected]>
@webern
Copy link
Contributor

webern commented Feb 22, 2021

Now I see why you knew about the ~ to avoid a newline. I was like wut? @bcressey is a mustache expert?

@zmrow
Copy link
Contributor

zmrow commented Feb 22, 2021

He does grow a pretty healthy mustache.... 🤔

Copy link
Contributor

@zmrow zmrow left a comment

Choose a reason for hiding this comment

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

sources/models/src/lib.rs Outdated Show resolved Hide resolved
This also makes the API server, cluster name, and cluster certificate
settings optional, since the kubelet does not need these values when
running in standalone mode.

Signed-off-by: Ben Cressey <[email protected]>
This enables the kubelet to use TLS for authentication instead of AWS
role credentials. If a bootstrap token is provided, the kubelet will
use it to perform TLS bootstrapping.

Signed-off-by: Ben Cressey <[email protected]>
@bcressey bcressey merged commit 6b21873 into bottlerocket-os:develop Feb 22, 2021
@bcressey bcressey deleted the standalone-mode branch February 23, 2021 05:09
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

Successfully merging this pull request may close these issues.

5 participants