-
Notifications
You must be signed in to change notification settings - Fork 716
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
Make kubeadm start controlling kubelet Config via a versioned file #822
Make kubeadm start controlling kubelet Config via a versioned file #822
Comments
I have comments written down for today which I'll discuss during the sig call. |
Is this going to go through https://github.com/kubernetes/features/blob/master/EXCEPTIONS.md since we're past feature freeze? Ie: content for this release was supposed to be defined, with implementations solidifying by the code freeze coming up. See https://github.com/kubernetes/sig-release/blob/master/releases/release-1.11/release-1.11.md |
@tpepper I'd argue this goes under kubernetes/enhancements#356. This is about that configuration. If you strongly think an exception have to be made, I can handle the communications. |
@luxas I'm ok with that assessment though that feature then should be updated as it's currently v1.9 milestone |
Yeah, sorry about that. Now fixed. |
Reference: |
Or just a path to a file that contains the Kubelet's component config yaml, which might make the beta to GA transition (or any scenario where multiple versions are available) easier to handle? |
Why wouldn't we just write the config prior to the first attempt to start the Kubelet? |
I assume kubeadm has its own identity and is already authorized to create/read this ConfigMap? |
Why isn't the name of this ConfigMap versioned too? |
This is TBD still, but in
The user might/should start it before running
At node join time, the Bootstrap Token is the identity that kubeadm created for the user to use, which means we'll use this BT to download the config for the kubelet that is about to be joined to the cluster.
It's a singleton, which describes the cluster's desired state (eventually, our config isn't that good yet 😄). Compared to that you have kubelets of all flavors (versions, configs, roles, etc) |
Automatic merge from submit-queue (batch tested with PRs 63914, 63887, 64116, 64026, 62933). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. kubeadm: Write kubelet config file to disk and persist in-cluster **What this PR does / why we need it**: In order to make configuration flow from the cluster level to node level, we need a way for kubeadm to tell the kubelet what config to use. As of v1.10 (I think) the kubelet can read `--config` using the kubelet Beta ComponentConfiguration API, so now we have an interface to talk to the kubelet properly. This PR: - Writes the kubelet ComponentConfig to `/var/lib/kubelet/config.yaml` on init and join - Writes an environment file to source in the kubelet systemd dropin `/var/lib/kubelet/kubeadm-flags.env`. This file contain runtime flags that should be passed to the kubelet. - Uploads a ConfigMap with the name `kubelet-config-1.X` - Patches the node object so that it starts using the ConfigMap with updates using Dynamic Kubelet Configuration, **only if the feature gate is set** (currently alpha and off by default, not intended to be switched on in v1.11) - Updates the phase commands to reflect this new flow The kubelet dropin file I used now looks like this: ``` # v1.11.x dropin as-is at HEAD # /etc/systemd/system/kubelet.service.d/10-kubeadm.conf --- [Service] Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf" Environment="KUBELET_CONFIG_ARGS=--config=/var/lib/kubelet/config.yaml" EnvironmentFile-=/var/lib/kubelet/kubeadm-flags.env # Should default to 0 in v1.11: #63881, and hence not be here in the real v1.11 manifest Environment="KUBELET_CADVISOR_ARGS=--cadvisor-port=0" # Should be configurable via the config file: #63878, and hence be configured using the file in v1.11 Environment="KUBELET_CERTIFICATE_ARGS=--rotate-certificates=true" ExecStart= ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_CADVISOR_ARGS $KUBELET_CERTIFICATE_ARGS $KUBELET_EXTRA_ARGS --- # v1.11.x dropin end goal # /etc/systemd/system/kubelet.service.d/10-kubeadm.conf --- [Service] Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf" Environment="KUBELET_CONFIG_ARGS=--config=/var/lib/kubelet/config.yaml" EnvironmentFile-=/var/lib/kubelet/kubeadm-flags.env ExecStart= ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS --- # Environment file dynamically created at runtime by "kubeadm init" # /var/lib/kubelet/kubeadm-flags.env KUBELET_KUBEADM_ARGS=--cni-bin-dir=/opt/cni/bin --cni-conf-dir=/etc/cni/net.d --network-plugin=cni ``` **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes kubernetes/kubeadm#822 Fixes kubernetes/kubeadm#571 **Special notes for your reviewer**: **Release note**: ```release-note "kubeadm init" now writes a structured and versioned kubelet ComponentConfiguration file to `/var/lib/kubelet/config.yaml` and an environment file with runtime flags (you can source this file in the systemd kubelet dropin) to `/var/lib/kubelet/kubeadm-flags.env`. ``` @kubernetes/sig-cluster-lifecycle-pr-reviews @mtaufen
Yeah, true there's always a few crashes while we wait for certs. I guess it depends on how long kubeadm takes and how much extra noise will be in the Kubelet logs as a result. |
Automatic merge from submit-queue (batch tested with PRs 64322, 64210, 64458, 64232, 64370). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. kubeadm: Move .NodeName and .CRISocket to a common sub-struct **What this PR does / why we need it**: Regroups some common fields for `kubeadm init` and `kubeadm join` only used for the initial node registration. Lets the user specify ExtraArgs to the kubelet. Now also runs the dynamic env file creation for `kubeadm join`. **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes kubernetes/kubeadm#847 Follows-up kubernetes#63887 Related to kubernetes/kubeadm#822 **Special notes for your reviewer**: WIP, but please review so we can finalize the direction of the PR **Release note**: ```release-note [action required] `.NodeName` and `.CRISocket` in the `MasterConfiguration` and `NodeConfiguration` v1alpha1 API objects are now `.NodeRegistration.Name` and `.NodeRegistration.CRISocket` respectively in the v1alpha2 API. The `.NoTaintMaster` field has been removed in the v1alpha2 API. ``` @kubernetes/sig-cluster-lifecycle-pr-reviews @liztio
Reopening this momentarily to track the merge of the final PRs related to this |
Automatic merge from submit-queue (batch tested with PRs 64009, 64780, 64354, 64727, 63650). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. kubeadm: Update the dropin for the kubelet in v1.11 **What this PR does / why we need it**: One of the final pieces of kubernetes/kubeadm#851, kubernetes/kubeadm#847 and kubernetes/kubeadm#822 **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: (partially) Fixes kubernetes/kubeadm#822 **Special notes for your reviewer**: Please check whether this release note makes sense to you. **Release note**: ```release-note [action required] The structure of the kubelet dropin in the kubeadm deb package has changed significantly. Instead of hard-coding the parameters for the kubelet in the dropin, a structured configuration file for the kubelet is used, and is expected to be present in `/var/lib/kubelet/config.yaml`. For runtime-detected, instance-specific configuration values, a environment file with dynamically-generated flags at `kubeadm init` or `kubeadm join` run time is used. Finally, if the user wants to override something specific for the kubelet that can't be done via the kubeadm Configuration file (which is preferred), they might add flags to the `KUBELET_EXTRA_ARGS` environment variable in either `/etc/default/kubelet` or `/etc/sysconfig/kubelet`, depending on the system you're running on. ``` @kubernetes/sig-cluster-lifecycle-pr-reviews
Problem statement
Currently kubeadm (the CLI) assumes a running (or actually, crashlooping) kubelet, with the right configuration for the right kubeadm version. This is currently achieved by packaging a kubelet dropin file together with the kubeadm debian package. So we have two different kubeadm entities with different responsibilities: the kubeadm CLI binary and the kubeadm deb package.
This solutions includes a number of problems:
cluster.global
(silly example but anyway)--cadvisor-port=0
flag to be secure in v1.11, but Kubernetes evolved to remove the flag in v1.12 and always turn it off. In other words, if we tried to set--cadvisor-port=0
v1.12 the kubelet would crash.apt-get upgrade
as that would download a newer kubelet than the API server, which is not supported (TODO reference).apt-get install kubeadm
to only upgrade the kubeadm deb package either, as that would include a newer manifest than supported.curl
.kubeadm upgrade apply v1.12.0
=> Both kubeadm and k8s version is now v1.12.0kubectl cordon $NODE && kubectl drain $NODE && apt-get upgrade
--config
option, but our API group is at the time of writing still alpha.Reference kubelet dropin created by the kubeadm deb package for v1.10.x
Proposal
Let kubeadm the CLI flow down configuration to the kubelet via a well-versioned interface. This interface will make it possible to not rely on the dropin for configuring the kubelet by neither kubeadm the CLI nor the user. Both will use the kubelet's ComponentConfiguration to configure it. kubeadm will embed the
v1beta1
ComponentConfiguration (akaKubeletConfiguration
) of the kubelet inside of kubeadm's own Configuration file.Reference kubelet dropin created by the kubeadm deb package for v1.11.x
kubeadm init flow
systemctl start kubelet
if it's not already running. The kubelet starts crashlooping as it hasn't got the configuration or a KubeConfig file to talk to the API server.--config
and unmarshals it to a struct internally if specified. If not specified, it sets a couple of well-known defaults.KubeletConfiguration
(e.g. securing the kubelet API endpoint, disabling the readonly and cAdvisor ports, etc.) in its defaultingKubeletConfiguration
and writes the bytes down to disk in the file/var/lib/kubelet/config.yaml
.kubelet --version
is>= v1.11.0
, when this feature was introduced./etc/kubernetes/kubelet.conf
), so it can now start cleanly vs. crashlooping in systemd.MasterConfiguration
object is stored in thekubeadm-config
ConfigMap in the cluster, etc.KubeletConfiguration
bytes to a ConfigMap in the cluster calledkubelet-config-1.X
, whereX
is the minor version of the API Server running currently.>= v1.11.0
, when this feature was introduced.kubeadm join flow
systemctl start kubelet
if it's not already running. The kubelet starts crashlooping as it hasn't got the configuration or a KubeConfig file to talk to the API server./etc/kubernetes/kubelet-bootstrap.conf
.KubeletConfiguration
to/var/lib/kubelet/config.yaml
.kubelet --version
is>= v1.11.0
, when this feature was introduced./etc/kubernetes/bootstrap-kubelet.conf
), so it can now start cleanly vs. crashlooping in systemd./etc/kubernetes/kubelet.conf
.v1.10 -> v1.11 upgrades
v1.10.2
, but now wants to upgrade tov1.11.0
. Thev1.10.2
kubeadm kubelet dropin exists locally.v1.11.0
is different thanv1.10.2
due to that now it references--config=/var/lib/kubelet/config.yaml
apt-get upgrade
in order to upgrade the kubelet and get the newv1.11.0
dropin at the right time.kubeadm upgrade apply v1.11.0
do?kubeadm-config
ConfigMap.kubelet-config-1.11
ConfigMap with the desired configuration forv1.11.x
kubelets.KubeletConfiguration
bytes down to disk in the/var/lib/kubelet/config.yaml
file, so the kubelet later can pick up the desired configuration when upgraded.kubeadm alpha phase kubelet write-config-to-disk
to fetch the desired v1.11 configuration down to disk.apt-get upgrade
which upgrades the kubeadm CLI binary and the kubelet itselfv1.11 -> upgrades
curl
-ing down of the standalone kubeadm binary in the master upgrade flow, and instead tell the user to runapt-get install kubeadm=1.11.0-00
Open questions
KubeletConfiguration
in thekubeadm-config
ConfigMap as well, or set it tonil
before uploading as it's storedkubeadm upgrade node config
?PR to implement this is available to look at kubernetes/kubernetes#63887
The text was updated successfully, but these errors were encountered: