It tries to solve the issue of having to manage a set of raw Kubernetes resources(deployment, secrets, hpa) and instead letting helm manage these resources. The chart is generic enough that it should be able to handle most 12-factor compliant app images.
Consider a simple app that I have here - https://github.com/bijukunjummen/sample-boot-knative, an image for this application is publicly available on dockerhub - https://hub.docker.com/r/bijukunjummen/sample-boot-knative-app/
If I wanted to deploy this app in a Kubernetes cluster, a set of specs to create a Kubernetes Deployment and a service is available here - https://github.com/bijukunjummen/sample-boot-knative/tree/master/kube. This is a simple enough deployment, however, the specs can get complicated once configuration, secrets are layered in and if features like Horizontal scaling is required.
Usage
There is a good documentation in the README of the chart, I will be mostly repeating that information here. I have hosted a version of the chart as a chart repository using github-pages, the first step to using the chart is to add this repo to your list of helm repos:
helm repo add bk-charts http://bijukunjummen.github.io/generic-app-chart helm repo update
The chart should now show up if searched for:
helm search generic-app-chart
The chart requires the details of the application that is being deployed, which can be provided as a yaml the following way:
app: healthCheckPath: /actuator/info environment: SERVER_PORT: "8080" ENV_NAME: ENV_VALUE secrets: SECRET1: SECRET_VALUE1 autoscaling: enabled: true maxReplicas: 2 minReplicas: 1 targetCPUUtilizationPercentage: 40 image: repository: bijukunjummen/sample-boot-knative-app tag: 0.0.3-SNAPSHOT ingress: enabled: true path: / annotations: kubernetes.io/ingress.class: nginx nginx.ingress.kubernetes.io/affinity: "cookie" nginx.ingress.kubernetes.io/session-cookie-name: "route" resources: constraints: enabled: true requests: cpu: 500m
At a minimum, the only details that are required are the application image and the tag, the rest of the details is just for illustration of what is feasible.
To deploy the app, run the following command:
helm install bk-charts/generic-app-chart --name my-app --values sample-values.yaml
and a bunch of Kubernetes resources should show up supporting this application.
App upgrades are simple, facilitated by helm:
helm upgrade my-app bk-charts/generic-app-chart -f sample-values.yaml
No comments:
Post a Comment