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

gci: decouple from the built-in kubelet version #31367

Merged
merged 1 commit into from
Aug 25, 2016

Conversation

Amey-D
Copy link
Contributor

@Amey-D Amey-D commented Aug 24, 2016

Fixed #31376

Prior to this change, configure.sh would:
(1) compare versions of built-in kubelet and downloaded kubelet, and
(2) bind-mount downloaded kubelet at /usr/bin/kubelet in case of
version mismatch

With this change, configure.sh:
(1) compares the two versions only on test clusters, and
(2) uses the actual file paths to start kubelet w/o any bind-mounting

To allow (2), this change also provides its own version of kubelet
systemd service file.

Effectively with this change we will always use the downloaded kubelet
binary along with its own systemd service file on non-test clusters. The
main advantage is this change does not rely on the kubelet being built in to
the OS image.

gci: decouple from the built-in kubelet version

@dchen1107 @wonderfly can you please review

cc/ @kubernetes/goog-image FYI


This change is Reviewable

@dchen1107 dchen1107 self-assigned this Aug 24, 2016
@k8s-github-robot k8s-github-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. release-note-label-needed labels Aug 24, 2016
@dchen1107
Copy link
Member

#31376

@dchen1107 dchen1107 added release-note-none Denotes a PR that doesn't merit a release note. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. and removed release-note-label-needed labels Aug 24, 2016
@dchen1107 dchen1107 added this to the v1.4 milestone Aug 24, 2016
@wonderfly
Copy link
Contributor

(1) compare the two versions (same as before), and
Curious, why still the check the builtin version? Isn't it more consistent to just use the downloaded version, and it's systemd config, no matter what? My concern is that as we go further this way, the builtin systemd config could diverge with upstream and trying to use it may cause unexpected problems.


Review status: 0 of 4 files reviewed at latest revision, 3 unresolved discussions.


cluster/gce/gci/configure-helper.sh, line 535 [r1] (raw file):

Write the systemd service file for kubelet.

cat </etc/systemd/system/kubelet.service
[Unit]
Description=Kubernetes kubelet
Requires=network-online.target
After=network-online.target
 
[Service]
Restart=always
RestartSec=10
ExecStart=${kubelet_bin} ${flags}
 
[Install]
WantedBy=multi-user.target
EOF

Many packages come with their own systemd service file as part of their distributions. Is it possible to have kubernetes do so too so that this doesn't need to be hard coded? Also, that will also make the service file versioned, which is good.

If not, can it at least be in one of the yaml configs?


cluster/gce/gci/configure-helper.sh, line 1099 [r1] (raw file):

"${KUBE_HOME}"
In your current logic, you compare the builtin version with the download one. If the same, you would use the builtin version, right? Then do you copy it from /usr/bin to $KUBE_HOME/bin?


cluster/gce/gci/configure.sh, line 174 [r1] (raw file):

"${kube_bin}
Is $KUBE_HOME in $PATH? Or is kubelet/kubectl always started with full path?


Comments from Reviewable

[Service]
Restart=always
RestartSec=10
ExecStart=${kubelet_bin} ${flags}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we continue use the /etc/default/kubelet for flags? What we currently have is:

[Service]
Restart=always
RestartSec=10
EnvironmentFile=/etc/default/kubelet
ExecStartPre=/bin/mkdir -p /etc/kubernetes/manifests
ExecStart=${kubelet_bin} $KUBELET_OPTS

Additionally, if you want, you can even do something like:

ExecStart=$KUBELET_BIN $KUBELET_OPTS

and set KUBELET_BIN also in /etc/default/kubelet. This can allow you to keep the kubelet.service file completely static.

Copy link
Member

Choose a reason for hiding this comment

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

+1

@Amey-D
Copy link
Contributor Author

Amey-D commented Aug 24, 2016

I added an additional check for TEST_CLUSTER, that is the version comparison happens only if TEST_CLUSTER is 'true'. On non-test clusters we will always use the downloaded kubelet and systemd service file.


Review status: 0 of 4 files reviewed at latest revision, 4 unresolved discussions.


cluster/gce/gci/configure-helper.sh, line 531 [r1] (raw file):

Previously, adityakali (Aditya Kali) wrote…

Can we continue use the /etc/default/kubelet for flags? What we currently have is:


[Service]

Restart=always

RestartSec=10

EnvironmentFile=/etc/default/kubelet

ExecStartPre=/bin/mkdir -p /etc/kubernetes/manifests

ExecStart=${kubelet_bin} $KUBELET_OPTS

Additionally, if you want, you can even do something like:


ExecStart=$KUBELET_BIN $KUBELET_OPTS

and set KUBELET_BIN also in /etc/default/kubelet. This can allow you to keep the kubelet.service file completely static.

If we specify the full systemd service file as part of configure-helper.sh, then I do not see any benefits of using /etc/default/kubelet. The /etc/default/kubelet would be useful if we put the service config in the yaml files, but in that case it would have to be duplicated in both master and node yaml. LMK if you have a strong preference to moving the service config to yaml files.

cluster/gce/gci/configure-helper.sh, line 535 [r1] (raw file):

Previously, wonderfly (Daniel Wang) wrote…

Write the systemd service file for kubelet.

cat </etc/systemd/system/kubelet.service
[Unit]
Description=Kubernetes kubelet
Requires=network-online.target
After=network-online.target
 
[Service]
Restart=always
RestartSec=10
ExecStart=${kubelet_bin} ${flags}
 
[Install]
WantedBy=multi-user.target
EOF

Many packages come with their own systemd service file as part of their distributions. Is it possible to have kubernetes do so too so that this doesn't need to be hard coded? Also, that will also make the service file versioned, which is good.

If not, can it at least be in one of the yaml configs?

It could be in the yaml file, but then it would have to be in both master and node yaml files and populating the binary file path and commandline args would be more work.

cluster/gce/gci/configure-helper.sh, line 1099 [r1] (raw file):

Previously, wonderfly (Daniel Wang) wrote…

"${KUBE_HOME}"
In your current logic, you compare the builtin version with the download one. If the same, you would use the builtin version, right? Then do you copy it from /usr/bin to $KUBE_HOME/bin?

If the versions match, I use the path /usr/bin/kubelet in the systemd service file. No copying is involved.

cluster/gce/gci/configure.sh, line 174 [r1] (raw file):

Previously, wonderfly (Daniel Wang) wrote…

"${kube_bin}
Is $KUBE_HOME in $PATH? Or is kubelet/kubectl always started with full path?

kubelet is started with full path through systemd service. kubectl is not run automatically -- users can run it manually if they wa

Comments from Reviewable

@adityakali
Copy link
Contributor

Review status: 0 of 4 files reviewed at latest revision, 3 unresolved discussions.


cluster/gce/gci/configure-helper.sh, line 531 [r1] (raw file):

Previously, dchen1107 (Dawn Chen) wrote…

+1

It doesn't have to be in yaml either. Just package it as-is into the release tar.gz as we do other manifest files (add an entry at https://github.com/kubernetes/kubernetes/blob/master/build/common.sh#L955).

Having the flags read from /etc/default/kubelet means that when debugging its easy to figure out what settings are in use and to changes. Otherwise even small changes like increasing log verbosity will require users (or system admins) to edit the systemd service file, do a systemd daemon reload, before restarting the service.

This is just for convenience though. So not strong preference.


cluster/gce/gci/configure-helper.sh, line 535 [r1] (raw file):


Comments from Reviewable

@wonderfly
Copy link
Contributor

Review status: 0 of 4 files reviewed at latest revision, 2 unresolved discussions.


cluster/gce/gci/configure-helper.sh, line 531 [r1] (raw file):

Previously, adityakali (Aditya Kali) wrote…

It doesn't have to be in yaml either. Just package it as-is into the release tar.gz as we do other manifest files (add an entry at https://github.com/kubernetes/kubernetes/blob/master/build/common.sh#L955).

Having the flags read from /etc/default/kubelet means that when debugging its easy to figure out what settings are in use and to changes. Otherwise even small changes like increasing log verbosity will require users (or system admins) to edit the systemd service file, do a systemd daemon reload, before restarting the service.

This is just for convenience though. So not strong preference.

nit: Can you all get a GitHub profile photo? Hard to tell which is who. :)

Comments from Reviewable

else
rm -f "${kube_bin}/kubelet"
fi
mv "${src_dir}/kubelet" "${kube_bin}"
Copy link
Contributor

Choose a reason for hiding this comment

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

So if the instance reboots, I think we end up re-doing the entire download and untar thing right?
It might be worth testing if this continues to work with even after a reboot.

@Amey-D
Copy link
Contributor Author

Amey-D commented Aug 24, 2016

Review status: 0 of 4 files reviewed at latest revision, 4 unresolved discussions.


cluster/gce/gci/configure-helper.sh, line 531 [r1] (raw file):

Previously, wonderfly (Daniel Wang) wrote…

nit: Can you all get a GitHub profile photo? Hard to tell which is who. :)

I'll keep the service file configuration how it is right now.

As for the photos I consider it beyond the scope of this CL :)


cluster/gce/gci/configure-helper.sh, line 1101 [r2] (raw file):

Previously, adityakali (Aditya Kali) wrote…

Does it make sense to also log the kubelet install location here? (i.e., whether its "${KUBE_HOME}"/bin/kubelet or /usr/bin/kubelet).

(again, only to avoid confusion).

Done.

cluster/gce/gci/configure.sh, line 131 [r2] (raw file):

Previously, adityakali (Aditya Kali) wrote…

So if the instance reboots, I think we end up re-doing the entire download and untar thing right?

It might be worth testing if this continues to work with even after a reboot.

Done. Verified the installation and configuration services finish successfully upon reboot on master and nodes. Besides I expect the e2e tests to test reboots.

Comments from Reviewable

@Amey-D
Copy link
Contributor Author

Amey-D commented Aug 25, 2016

Review status: 0 of 4 files reviewed at latest revision, 4 unresolved discussions.


cluster/gce/gci/configure-helper.sh, line 531 [r1] (raw file):

Previously, Amey-D (Amey Deshpande) wrote…

I'll keep the service file configuration how it is right now.

As for the photos I consider it beyond the scope of this CL :)

Added /etc/default/kubelet/service for KUBELET_OPTS. Turned out systemd does not allows reading the binary file name from the environment file.

Comments from Reviewable

@Amey-D
Copy link
Contributor Author

Amey-D commented Aug 25, 2016

Review status: 0 of 4 files reviewed at latest revision, 4 unresolved discussions.


cluster/gce/gci/configure-helper.sh, line 531 [r1] (raw file):

Previously, Amey-D (Amey Deshpande) wrote…

Added /etc/default/kubelet/service for KUBELET_OPTS. Turned out systemd does not allows reading the binary file name from the environment file.

Done.

Comments from Reviewable

@wonderfly
Copy link
Contributor

:lgtm:


Review status: 0 of 4 files reviewed at latest revision, 4 unresolved discussions, some commit checks failed.


Comments from Reviewable

@wonderfly
Copy link
Contributor

LGTM but @adityakali should take a further look...

Prior to this change, configure.sh would:
(1) compare versions of built-in kubelet and downloaded kubelet, and
(2) bind-mount downloaded kubelet at /usr/bin/kubelet in case of
version mismatch

With this change, configure.sh:
(1) compares the two versions only on test clusters, and
(2) uses the actual file paths to start kubelet w/o any bind-mounting

To allow (2), this change also provides its own version of kubelet
systemd service file.

Effectively with this change we will always use the downloaded kubelet
binary along with its own systemd service file on non-test clusters.  The
main advantage is this change does not rely on the kubelet being built in to
the OS image.
@k8s-bot
Copy link

k8s-bot commented Aug 25, 2016

GCE e2e build/test passed for commit 2939ebd.

@adityakali
Copy link
Contributor

LGTM
Thanks for the changes Amey!

@dchen1107
Copy link
Member

LGTM

@dchen1107 dchen1107 added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 25, 2016
@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@k8s-bot
Copy link

k8s-bot commented Aug 25, 2016

GCE e2e build/test passed for commit 2939ebd.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit f090fd1 into kubernetes:master Aug 25, 2016
@jessfraz jessfraz added cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels Oct 24, 2016
@jessfraz jessfraz removed this from the v1.4 milestone Oct 24, 2016
@k8s-cherrypick-bot
Copy link

Removing label cherrypick-candidate because no release milestone was set. This is an invalid state and thus this PR is not being considered for cherry-pick to any release branch. Please add an appropriate release milestone and then re-add the label.

fabioy added a commit that referenced this pull request Oct 31, 2016
…-upstream-release-1.3

Automated cherry pick of #31367
shyamjvs pushed a commit to shyamjvs/kubernetes that referenced this pull request Dec 1, 2016
…-of-#31367-upstream-release-1.3

Automated cherry pick of kubernetes#31367
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants