Skip to content

Instantly share code, notes, and snippets.

@vfarcic
Created April 5, 2021 21:25
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save vfarcic/2e55fb81a22ca1d715d9abb33b26d1fe to your computer and use it in GitHub Desktop.
Save vfarcic/2e55fb81a22ca1d715d9abb33b26d1fe to your computer and use it in GitHub Desktop.
##########################################
# Helmfile #
# How to manage Kubernetes Helm releases #
# https://youtu.be/qIJt8Iq8Zb0 #
##########################################
# Referenced videos:
# - K3d - How to run Kubernetes cluster locally using Rancher k3s: https://youtu.be/mCesuGk-Fks
#########
# Setup #
#########
git clone https://github.com/vfarcic/helmfile-demo
cd helmfile-demo
# Please watch https://youtu.be/mCesuGk-Fks if you are not familiar with k3d
# It could be any other k8s cluster with an Ingress controller
k3d cluster create --config k3d.yaml
# Install Helm
# Install `helmfile` from https://github.com/roboll/helmfile#installation
helm plugin install https://github.com/databus23/helm-diff
helm plugin install https://github.com/aslafy-z/helm-git
helm plugin install https://github.com/jkroepke/helm-secrets
##############################
# Defining a simple Helmfile #
##############################
cat helmfile-prometheus.yaml
helmfile \
--file helmfile-prometheus.yaml \
apply \
--wait
#####################
# Updating releases #
#####################
cat helmfile-prometheus-rbac.yaml
helmfile \
--interactive \
--file helmfile-prometheus-rbac.yaml \
apply \
--wait
helmfile \
--interactive \
--file helmfile-prometheus-rbac.yaml \
destroy
##############################
# Defining multiple-releases #
##############################
cat helmfile-multi.yaml
helmfile \
--file helmfile-multi.yaml \
apply \
--wait
# If not using k3d, change the value to whatever is the base host
export BASE_HOST=localhost
helmfile \
--file helmfile-multi.yaml \
--interactive \
apply \
--wait
kubectl --namespace production \
get ingresses
# Open devops-toolkit host
######################
# Applying templates #
######################
cat helmfile-multi.yaml
cat helmfile.yaml
helmfile --interactive apply --wait
#######################
# Destroying releases #
#######################
helmfile destroy
k3d cluster delete helmfile-demo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment