Run kubelet outside container#2584
Conversation
There was a problem hiding this comment.
TODO: adapt kubelet start for coreos filepath
There was a problem hiding this comment.
We can shorten this to /bin/chmod a+x /usr/local/bin/kubelet /usr/local/bin/kubectl (the build of chmod on ubuntu hosts accepts a list of file targets to apply the mode changes against). Verified:
azureuser@k8s-master-18440544-0:/tmp$ ls -la test*
-rw-rw-r-- 1 azureuser azureuser 0 Apr 3 23:08 test1
-rw-rw-r-- 1 azureuser azureuser 0 Apr 3 23:08 test2
azureuser@k8s-master-18440544-0:/tmp$ /bin/chmod a+x test1 test2
azureuser@k8s-master-18440544-0:/tmp$ ls -la test*
-rwxrwxr-x 1 azureuser azureuser 0 Apr 3 23:08 test1
-rwxrwxr-x 1 azureuser azureuser 0 Apr 3 23:08 test2
There was a problem hiding this comment.
Yes good catch, thanks
There was a problem hiding this comment.
See below. Didn't verify on a coreos host, but I'm confident this is a standard pattern.
There was a problem hiding this comment.
ditto above about chmod command
jackfrancis
left a comment
There was a problem hiding this comment.
In the systemd extract definition, I think we want a ConditionPathExists=!/usr/local/bin/kubelet as well. (and the CoreOS flavor also)
jackfrancis
left a comment
There was a problem hiding this comment.
Let's change the directory name kubectldir (under /tmp on the host OS and /opt inside the container) to something more general, like hyperkubedir or something.
There was a problem hiding this comment.
Let's do this in one line to make it a little clearer that we are copying the same file to two different places. One example:
for dest in /usr/local/bin/kubelet /usr/local/bin/kubectl ; do cp /tmp/kubectldir/hyperkube $dest; done
And then just add a cleanup line after, like:
rm -Rf /tmp/kubectldir
(but replace kubectldir with the new, general name in both instances :) )
There was a problem hiding this comment.
I don't really find that
ExecStartPre=for dest in /usr/local/bin/kubelet /usr/local/bin/kubectl ; do /bin/cp /tmp/hyperkube/hyperkube $dest; done
ExecStartPre=rm -Rf /tmp/kubectldir
is much more readable than
ExecStartPre=/bin/cp /tmp/hyperkubedir/hyperkube /usr/local/bin/kubelet
ExecStartPre=/bin/mv /tmp/hyperkubedir/hyperkube /usr/local/bin/kubectl
How about:
ExecStartPre=/bin/mv /tmp/hyperkubedir/hyperkube /usr/local/bin/kubelet
ExecStartPre=/bin/cp /usr/local/bin/kubelet /usr/local/bin/kubectl
?
There was a problem hiding this comment.
I mean I see where you're coming from in terms of logic, I just find that it makes the syntax more complex to have a for loop for only two files. Please feel free to disagree with me :)
|
@jackfrancis re: |
There was a problem hiding this comment.
Besides the extraction, dependencies should also be installed. e.g. on ubuntu, kubelet depends on iptables (>= 1.4.21), kubernetes-cni (= 0.6.0), iproute2, socat, util-linux, mount, ebtables, ethtool, init-system-helpers (>= 1.18~)
There was a problem hiding this comment.
Thanks @feiskyer. Just checked and all of these are already being installed except for socat. I will add a step to install them if they are missing so we are safe. I can't find a package kubernetes-cni however, do you have more info on that one?
There was a problem hiding this comment.
For the cni plugin, I think we are already installing it at
There was a problem hiding this comment.
Removed the 1.5 version since k8s 1.5 was deprecated in #2394 and it's not in use anymore
There was a problem hiding this comment.
Ensure dependencies are installed on agents
There was a problem hiding this comment.
Ensure dependencies are installed on masters
There was a problem hiding this comment.
Are we confident that all of these packages will reliably install in under 2 mins? (speaking to the 120 second timeout)
There was a problem hiding this comment.
Yes most of them should already be there so it's very quick. In my tests it took under 10 seconds. I can increase the timeout if we want to be sure.
There was a problem hiding this comment.
Oh yeah I just moved it out because I moved out apt_get_update so I thought might as well but we should generalize it in another PR
There was a problem hiding this comment.
I increased it to 5 minutes... Should be plenty enough
jackfrancis
left a comment
There was a problem hiding this comment.
lgtm if we feel good about the 2 minute timeout for apt-get install for kubelet deps
What this PR does / why we need it: In current (v0.14.6) acs-engine implementation, kubelet starts in a Docker container.
There are a lot of regressions of containerized kubelet reported in Kubernetes v1.10 (kubernetes/kubernetes#61456) . Since there are no full e2e tests for this, it may also happen in future releases (thanks @feiskyer for reporting). This PR moves kubelet to run outside the container, which is expected to be more stable.
Which issue this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)format, will close that issue when PR gets merged): fixes #Special notes for your reviewer:
If applicable:
Release note: