Skip to content

Instantly share code, notes, and snippets.

@teebu
Forked from vfarcic/02-07-helmfile.sh
Created April 27, 2022 23:35
Show Gist options
  • Save teebu/04044ffc504173652df06264c0cb279a to your computer and use it in GitHub Desktop.
Save teebu/04044ffc504173652df06264c0cb279a 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