-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
k3s Binary is too big #2205
Milestone
Comments
This was referenced Sep 4, 2020
Great! |
Validated binary pushed for recent commits and
|
Merged
brandond
added a commit
to brandond/k3s
that referenced
this issue
Nov 4, 2020
Related to k3s-io#2205 Signed-off-by: Brad Davidson <[email protected]>
brandond
added a commit
to brandond/k3s
that referenced
this issue
Nov 4, 2020
Related to k3s-io#2205 Signed-off-by: Brad Davidson <[email protected]>
brandond
added a commit
to brandond/k3s
that referenced
this issue
Nov 4, 2020
Related to k3s-io#2205 Signed-off-by: Brad Davidson <[email protected]>
brandond
added a commit
to brandond/k3s
that referenced
this issue
Nov 4, 2020
Related to k3s-io#2205 Signed-off-by: Brad Davidson <[email protected]>
brandond
added a commit
to brandond/k3s
that referenced
this issue
Nov 4, 2020
Related to k3s-io#2205 Signed-off-by: Brad Davidson <[email protected]>
brandond
added a commit
to brandond/k3s
that referenced
this issue
Nov 4, 2020
Related to k3s-io#2205 Signed-off-by: Brad Davidson <[email protected]>
brandond
added a commit
that referenced
this issue
Nov 5, 2020
Related to #2205 Signed-off-by: Brad Davidson <[email protected]>
briandowns
pushed a commit
to briandowns/k3s
that referenced
this issue
Jan 14, 2021
Related to k3s-io#2205 Signed-off-by: Brad Davidson <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Recently the k3s binary grew pretty significantly from 60960768 bytes to 84463616 bytes. See:
This is a problem because (according to @ibuildthecloud) the binary size correlates pretty closely to memory footprint.
This is the change that caused the size increase: #2146
Specifically, importing
"github.com/rancher/k3s/pkg/daemons/config"
in pkg/cli/cmds/server.go caused the k3s cli wrapper binary to pull in a ton of k8s dependencies.When I say the k3s cli wrapper binary, I mean the one built on this line:
https://github.com/rancher/k3s/blob/master/scripts/package-cli#L59
Notice how that is building
cmd/k3s/main.go
- This program is a thin wrapper around other fatter binaries likek3s-server
andk3s-agent
. By wrapper I mean it execs out to those binaries, it does not compile in their code.So, while those other binaries are already fat because they've pulled in all the k8s code, this wrapper binary hasn't. By importing
"github.com/rancher/k3s/pkg/daemons/config"
, it transitively pulled in a bunch of k8s code and got really fat.To fix this, we need to eliminate the import of
github.com/rancher/k3s/pkg/daemons/config
. I think the best way to do this is to define the function that is defined here:https://github.com/rancher/k3s/blob/master/pkg/server/types.go#L15
Instead of having config.Control as a parameter, let's just change it to the two field off of that struct that are currently in use by the hooks we setup in rke2. These would be
APIServerReady <-chan struct{}, KubeConfigAdmin string
.In addition to all this, let's also add a check in CI that will fail a PR i the binary size grows over 61000000 bytes
The text was updated successfully, but these errors were encountered: