Skip to content

Instantly share code, notes, and snippets.

@abhi2495
Last active July 19, 2020 20:28
Show Gist options
  • Save abhi2495/88a991f0b9ac75427e49c4f7302b5c45 to your computer and use it in GitHub Desktop.
Save abhi2495/88a991f0b9ac75427e49c4f7302b5c45 to your computer and use it in GitHub Desktop.
##################################################################################
##################################################################################
######### IF YOU FOUND THIS GIST USEFUL, PLEASE LEAVE A STAR. THANKS. ############
##################################################################################
##################################################################################
apiVersion: v2
name: base-microservice
description: A sample base helm chart for deploying a microservice in Kubernetes
type: application
version: 0.1.6
appVersion: 1
dependencies:
- name: nginx-ingress
version: "~1.39.1"
repository: "alias:stable"
condition: nginx-ingress.enabled

This gist describes usage of helm umbrella charts to manage deployment of multiple micro-services to kubernetes

Developers can maintain a separate Github repo for base helm charts.

A base-microservice chart will have all sorts of kubernetes templates like HPA,ConfigMap,Secrets,Deployment,Service,Ingress etc , each having the option to be enabled or disabled.

And the base chart can even contain other public charts as dependency.

Now in each microservice, we will have a dedicated chart defining a dependency of this base-microservice chart and a values file with overriding values defined.

When commit happens in the base-charts repo, as part of CI process, (along with other things) we can do

  • Check if Helm index already exists in charts repository
  • If exists, then download the existing index and merge currently generated index with existing one -> helm repo index --merge oldindex/index.yaml .
  • If it does not exist, then we create new Helm index ->( helm repo index . ) Then upload the archived charts and index yaml to our charts repository.

And during Continuous Deployment of each microservice, we can have these steps (among others):

  • Fetch helm dependencies (helm dependency update ./charts/my-service-A)
  • Deploy my release to kubernetes (helm upgrade --install my-service-a ./charts/my-service-A)
apiVersion: v2
name: my-service-A
description: Chart for my-service-A
type: application
version: 0.1.0
appVersion: 1
dependencies:
- name: base-microservice
version: "0.1.6"
repository: "alias:azure" #using azure blob storage as chart repository. can be anything else.
base-microservice:
nameOverride: my-service-A
image:
repository: myDockerRepo/my-service-A
resources:
limits:
cpu: 1000m
memory: 1024Mi
requests:
cpu: 300m
memory: 500Mi
probe:
initialDelaySeconds: 120
nginx-ingress:
enabled: true
ingress:
enabled: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment