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]: Deploy Helm chart to EKS via CDK #3748

Closed
zanhsieh opened this issue Aug 22, 2019 · 9 comments · Fixed by #5390
Closed

[aws-eks]: Deploy Helm chart to EKS via CDK #3748

zanhsieh opened this issue Aug 22, 2019 · 9 comments · Fixed by #5390
Assignees
Labels
@aws-cdk/aws-eks Related to Amazon Elastic Kubernetes Service feature-request A feature should be added or improved.

Comments

@zanhsieh
Copy link

zanhsieh commented Aug 22, 2019

🚀 Feature Request

General Information

NA

Description

Helm chart is a de facto solution while deploying 3rd party solutions into Kubernetes. In general, developers would like to have those solutions ready, otherwise they need to spend huge amount of time for mocking up those 3rd party solutions (a blackbox per se). If we could deploy 3rd party solutions into EKS with CDK, I feel it will attract even more developers to work on their solutions within AWS EKS.

CDK might consider this as a plugin to support since we all know Helm api is not maintained by CDK.

BTW, Terraform is able to deploy Helm chart.

@zanhsieh zanhsieh added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Aug 22, 2019
@pahud
Copy link
Contributor

pahud commented Aug 22, 2019

@zanhsieh I am the maintainer of aws-lambda-layer-kubectl, which has been the core component of @aws-cdk/aws-eks
https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk/aws-eks/lib/kubectl-layer.ts

I believe it's possible as long as we build the helm client into a standalone lambda layer so CDK can create yet another construct lib on top if it.

I'll look into it and any thoughts would be appreciated.

@zanhsieh
Copy link
Author

zanhsieh commented Aug 26, 2019

Got some idea from this repo:

https://github.com/microsoft/helm-web-api

The repo above still works today. So the basic workflow (although it might be a lot of steps) to make this work is:

  • Rip off tiller-deploy deployment and service yaml files and use CDK to deploy while creating the cluster (any existing cluster with helm shall have these two files)
  • Build docker image (on-demand-micro-services-deployment-k8s) and push to some repo (your own private or public repo like docker hub) according to helm-web-api README.md
  • Modify the chart values.yaml registry line, point to your repo.
  • Grep the yaml manifest files by calling --debug and --dry-run with:

helm install chart/on-demand-micro-services-deployment-k8s --name on-demand-micro-services-deployment-k8s --set rbac.create=true

  • Deploy previous steps yaml files with CDK while creating the cluster

After deployment, just follow the syntax as helm-web-api README.md to deploy any helm chart via code.

Yeah, it's messy and hacky, and it's neither M$ way nor AWS way ...

@eladb
Copy link
Contributor

eladb commented Aug 27, 2019

I think @pahud's approach makes senes. If he can add the Helm client in the kubectl layer, we could create a custom resource that interacts with the client and creates/updates/deletes Helm charts from your cluster.

@eladb eladb added the @aws-cdk/aws-eks Related to Amazon Elastic Kubernetes Service label Sep 2, 2019
@SomayaB SomayaB removed the needs-triage This issue or PR still needs to be triaged. label Sep 11, 2019
@abelmokadem
Copy link
Contributor

Saw that helm was recently added to the lambda layer. Thanks @pahud. Looking forward to see helm support in CDK so we can cleanup our bash scripts.

@eladb
Copy link
Contributor

eladb commented Dec 4, 2019

Yes this will be awesome to support.

@swe-ds
Copy link

swe-ds commented Dec 5, 2019

A clear example of supporting helm with a CDK deployment would be helpful. Thanks for all the awesome work!

@SomayaB SomayaB added the in-progress This issue is being actively worked on. label Dec 13, 2019
@mergify mergify bot closed this as completed in #5390 Dec 23, 2019
@farshadniayeshpour
Copy link

Hi @pahud, I get this error when trying to add helm to a kubernetes cluster in python with both the construct eks.helm_chart() and cluster.add_chart()

Failed to create resource. Error: b'Release "nonprodrptclusternonprodchartnginxingress0406e3cf6676" does not exist. Installing it now.\nError: create: failed to create: namespaces "nginx" not found\n' at invokeUserFunction (/var/task/framework.js:85:19) at process._tickCallback (internal/process/next_tick.js:68:7)

This is my code:

eks_cluster.add_chart(id="nginx-ingress-0406", chart="nginx-ingress", namespace="nginx", repository="https://kubernetes-charts.storage.googleapis.com", wait=True)

eks_cluster.add_chart(id="airflow-0406", chart="airflow", namespace="default", repository="https://kubernetes-charts.storage.googleapis.com", wait=True)

Any ideas?

@pahud
Copy link
Contributor

pahud commented Apr 7, 2020

@FarshadNiayesh

I am afraid the vended Helm3 will not create new namespace unless you specify --create-namespace?
helm/helm#5753
helm/helm#7648
helm/helm#6794

But it makes sense to bump the Helm3 version to the latest v3.1.2

Please watch aws-samples/aws-lambda-layer-kubectl#27 and I will bundle the latest Helm v3.1.2 in the kubectl layer before creating a PR for CDK to improve this.

@farshadniayeshpour
Copy link

Thank you so much for your response!

@iliapolo iliapolo changed the title Deploy Helm chart to EKS via CDK [aws-eks]: Deploy Helm chart to EKS via CDK Aug 16, 2020
@iliapolo iliapolo removed the in-progress This issue is being actively worked on. label Aug 16, 2020
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 feature-request A feature should be added or improved.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants