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

[aws-eks] Support passing memory config to Kubectl Lambda layer #11248

Closed
jargelo opened this issue Nov 2, 2020 · 3 comments
Closed

[aws-eks] Support passing memory config to Kubectl Lambda layer #11248

jargelo opened this issue Nov 2, 2020 · 3 comments
Assignees
Labels
@aws-cdk/aws-eks Related to Amazon Elastic Kubernetes Service duplicate This issue is a duplicate. effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2

Comments

@jargelo
Copy link

jargelo commented Nov 2, 2020

Today the kubectl Lambda layer has a hardcoded value of 256MB as seen here: https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk/aws-eks/lib/kubectl-provider.ts#L78

The problem is that I install a helm chart (with version 1.70 and the Lambda exhausts its memory. It can go up to 370MB in a test run that I've done. So making this configurable, or if anything bump the hardcoded value to 512 instead of 256, will avoid failing of helm charts.

You can see helm dies prematurely because it logs the following message:

[ERROR] Exception: b'Release "kube2iam" does not exist. Installing it now.\n'
Traceback (most recent call last):
  File "/var/task/index.py", line 17, in handler
    return helm_handler(event, context)
  File "/var/task/helm/__init__.py", line 50, in helm_handler
    helm('upgrade', release, chart, repository, values_file, namespace, version, wait, timeout, create_namespace)
  File "/var/task/helm/__init__.py", line 94, in helm
    raise Exception(output)

And then the subprocess will fail with a non-zero exit code causing the CDK run to fail.

On a successful run the Lamba logs what you'd expect:

[INFO]	2020-11-02T10:53:46.961Z	9092fdbd-d940-46a0-a91f-29a2fbb28a46	b'Release "kube2iam" does not exist. Installing it now.\nNAME: kube2iam\nLAST DEPLOYED: Mon Nov  2 10:53:46 2020\nNAMESPACE: kube-system\nSTATUS: deployed\nREVISION: 1\nTEST SUITE: None\nNOTES:\nTo verify that kube2iam has started, run:\n\n  kubectl --namespace=kube-system get pods -l "app.kubernetes.io/name=kube2iam,app.kubernetes.io/instance=kube2iam"\n\nAdd an iam.amazonaws.com/role annotation to your pods with the role you want them to assume.\n\n  https://github.com/jtblin/kube2iam#kubernetes-annotation\n\nUse `curl` to verify the pod\'s role from within:\n\n  curl http://169.254.169.254/latest/meta-data/iam/security-credentials/\n'

And the last line of the Lambda run shows the memory usage well exceeding 256MB:

REPORT RequestId: 86fcc2d3-70e1-44e3-981b-b88bcf7b911d	Duration: 39642.92 ms	Billed Duration: 39700 ms	Memory Size: 256 MB	Max Memory Used: 257 MB

vs

REPORT RequestId: 9092fdbd-d940-46a0-a91f-29a2fbb28a46 Duration: 29602.47 ms Billed Duration: 29700 ms Memory Size: 384 MB Max Memory Used: 377 MB Init Duration: 126.99 ms

Environment

  • CLI Version : 1.70.0 (build c145314)
  • Framework Version: 1.70.0
  • Node.js Version: v12.16.1
  • OS : Linux
  • Language (Version): Python 3.7

This is 🐛 Bug Report

@jargelo jargelo added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Nov 2, 2020
@github-actions github-actions bot added the @aws-cdk/aws-eks Related to Amazon Elastic Kubernetes Service label Nov 2, 2020
@iliapolo iliapolo changed the title [aws-eks] Kubectl Lambda layer runs out of memory [aws-eks] Support passing memory config to Kubectl Lambda layer Nov 2, 2020
@iliapolo iliapolo added effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2 and removed bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Nov 2, 2020
@iliapolo
Copy link
Contributor

iliapolo commented Dec 1, 2020

Duplicate of #11787

@iliapolo iliapolo marked this as a duplicate of #11787 Dec 1, 2020
@iliapolo iliapolo added the duplicate This issue is a duplicate. label Dec 1, 2020
@eladb
Copy link
Contributor

eladb commented Dec 9, 2020

Closing as dup

@eladb eladb closed this as completed Dec 9, 2020
@github-actions
Copy link

github-actions bot commented Dec 9, 2020

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-eks Related to Amazon Elastic Kubernetes Service duplicate This issue is a duplicate. effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

No branches or pull requests

3 participants