kops icon indicating copy to clipboard operation
kops copied to clipboard

Reduce boilerplate in AWS LaunchTemplate

Open djablonski-moia opened this issue 6 years ago • 18 comments

1. Describe IN DETAIL the feature/behavior/change you would like to see.

In Kops 1.19.0-alpha.5, we can't start a new cluster anymore because of the size limitation of user data in AWS launch templates, which is 16k. We have approximately 3k of our own user data, and for the master nodes, deployment fails with

error running task "LaunchTemplate/master-eu-central-1b.masters.cluster.<domain>" (26s remaining to succeed): error creating LaunchTemplate: InvalidUserData.Malformed: User data is limited to 16384 bytes.

Looking into the Launch templates for the non-master instance groups, I see that Kops own part already takes up 10k for them, and most likely even more than 13k for masters, since our own user data is the same for them.

I'd like to see the boilerplate in the user data being reduces as much as possible, leaving more space for custom user data. For example, just the license header in the embedded nodeup.sh is taking up 607 bytes. Additionally, the documentation should warn about the limited space for custom user data, so users can mitigate before running into this issue.

2. Feel free to provide a design supporting your feature request.

E.g. remove the license header from the embedded nodeup.sh script, and also other comments, unccessary blank lines etc.

djablonski-moia avatar Nov 09 '20 08:11 djablonski-moia

After removing most of our custom user data, I can confirm that Kops already uses up 15k of the user data on master nodes! 😳

djablonski-moia avatar Nov 09 '20 09:11 djablonski-moia

The typical master user data should be around 12-13k. But since user data contains the cluster spec and the spec also contains additionalUserData, 3k will result in 6k added data.

3k of additional user data is quite sizeable though. Maybe some of this could be moved to a hook instead?

olemarkus avatar Nov 09 '20 09:11 olemarkus

@olemarkus Sorry, I was talking about just the userData in the cluster spec, there is no duplication of our userData I can see (after reducing it significantly). But our list of fileAssets is also adding 1.5k. I'll try to reduce our userData and fileAssets as much as possible by shifting stuff into the AMI, but I still think the Kops part should also be minimized.

djablonski-moia avatar Nov 09 '20 09:11 djablonski-moia

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale

fejta-bot avatar Feb 07 '21 09:02 fejta-bot

We also can't update kops in clusters from 1.18 to 1.19 because of file assets. Can user-data be decreased?

DOboznyi avatar Feb 16 '21 13:02 DOboznyi

Stale issues rot after 30d of inactivity. Mark the issue as fresh with /remove-lifecycle rotten. Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten

fejta-bot avatar Mar 18 '21 14:03 fejta-bot

Rotten issues close after 30d of inactivity. Reopen the issue with /reopen. Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-contributor-experience at kubernetes/community. /close

fejta-bot avatar Apr 17 '21 14:04 fejta-bot

@fejta-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity. Reopen the issue with /reopen. Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-contributor-experience at kubernetes/community. /close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Apr 17 '21 14:04 k8s-ci-robot

We are experiencing the same issues trying to create a new cluster via kops-1.21-alpha-3.

Nilubkal avatar Apr 19 '21 15:04 Nilubkal

I'm also running into this updating a cluster from 1.19 to 1.20

d-m avatar Apr 19 '21 21:04 d-m

@Nilubkal: You can't reopen an issue/PR unless you authored it or you are a collaborator.

In response to this:

/reopen

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Apr 19 '21 21:04 k8s-ci-robot

/reopen

rifelpet avatar Apr 19 '21 22:04 rifelpet

@rifelpet: Reopened this issue.

In response to this:

/reopen

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Apr 19 '21 22:04 k8s-ci-robot

We are experiencing the same issues trying to create a new cluster via kops-1.21-alpha-3.

just applying exactly the same template ( the same size/length ) with kops-1.20.0 and KOPS_RUN_TOO_NEW_VERSION=1 creates a kubernetes 1.21.0 cluster without any complains about "User data is limited to 16384 bytes"

Nilubkal avatar Apr 20 '21 07:04 Nilubkal

Another workaround is using the setting for the InstanceGroup:

spec:
  compressUserData: true

introduced by this PR

Nilubkal avatar Apr 20 '21 08:04 Nilubkal

This isn't a workaround. This is the solution for those who depend on extending the user data. Often, hooks is a better mechanism for manipulating the instance during boot. But it depends on what you are putting into user data.

olemarkus avatar Apr 20 '21 08:04 olemarkus

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale

fejta-bot avatar Jul 19 '21 09:07 fejta-bot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot avatar Aug 18 '21 09:08 k8s-triage-robot