helm-guide

An opinionated guide for the Helm system
git clone git://archive.git.mtrnord.blog/MTRNord/helm-guide.git
Log | Files | Refs | LICENSE

root.tex (4496B)


      1 % arara: lualatex: { shell: yes }
      2 % arara: biber
      3 % arara: makeglossaries if found('aux', '@istfilename')
      4 % arara: lualatex: { shell: yes}
      5 % arara: lualatex: { shell: yes }
      6 \documentclass[english,10pt,a4paper]{scrreprt}
      7 \usepackage{style}
      8 \usepackage{lipsum} 
      9 
     10 \addbibresource{bibliography.bib}
     11 
     12 % Title Page
     13 \title{Helm - A Quickstart Guide and Styleguide}
     14 \subtitle{An opinionated starter to Helm Charts}
     15 \author{Marcel Radzio}
     16 
     17 % Glossary definitions
     18 \newglossaryentry{k8sResources}{
     19 	name={Kubernetes Resource},
     20 	description={A Kubernetes Resource is a YAML document defining a thing inside of a Kubernetes Cluster. This for example can be a Pod}
     21 }
     22 \newglossaryentry{pod}{
     23 	name={Kubernetes Pod},
     24 	description={A kubernetes Pod  is the smallest deployable unit of computing which can be created and managed in Kubernetes. It is defining a group of one or more containers (see Docker/Podman containers) with shared storage and network resources. See \url{https://kubernetes.io/docs/concepts/workloads/pods/} for more details.}
     25 }
     26 \newacronym{k8s}{k8s}{Kubernetes}
     27 \newacronym{oci}{OCI}{Open Container Initiative}
     28 \newacronym{ux}{UX}{User Experience}
     29 \newacronym{values}{values file}{values.yaml}
     30 \newacronym[description={A resource which describes how a volume should be allocated and how it is usable by pods or other resources}]{pvc}{pvc}{Persistent Volume Claim}
     31 \newglossaryentry{deployment resource}{
     32 	name={Deployment resource},
     33 	description={A resource which allows replication of pods and rolling updates.}
     34 }
     35 % Make it
     36 \makeglossaries
     37 
     38 \begin{document}
     39 \maketitle
     40 \tableofcontents
     41 
     42 \chapter{What is Helm?}
     43 \include{pages/chapter1}
     44 
     45 \chapter{Structure of a Helm Package}
     46 \include{pages/chapter2}
     47 
     48 \chapter{Usage of a Helm Package}
     49 
     50 \section{Atomic mode}
     51 One of the less mentioned things Helm can do is that it can atomically deploy things to a cluster.
     52 
     53 What does atomically mean here?
     54 Specifically it means that an application will (if the Helm chart was configured correctly) never let the application get stuck in a broken state on upgrades.
     55 
     56 To do that it provides the \mintinline[breaklines]{bash}{--atomic} flag usable on \mintinline[breaklines]{bash}{helm upgrade}.
     57 When the flag is provided Helm will wait until the application entered a successful state where all pods report being ready in \Gls{k8s}.
     58 If this is not achieved Helm will automatically roll back to the last successful deployment version.
     59 It also ensures that the old application still is running while trying this by utilizing the way Deployments in \Gls{k8s} work.
     60 A deployment with rolling update will spawn a new pod, wait for it to get into the \enquote{Ready} state on the cluster and only then stop the old pod.
     61 The default timeout for Helm's atomic deployment is at 5m.
     62 It is generally a good idea to use this however tools like argocd generally do not expose this mode to the users.
     63 
     64 \section{Listing deployments and rollback of deployments}
     65 Helm automatically records a list of deployments done to each Helm chart.
     66 This allows for 2 great things:
     67 \begin{enumerate}
     68   \item Your application is deployed in a way which can be audited
     69   \item Your application can be rolled back easily to a previous state even if you do not know the values anymore
     70 \end{enumerate}
     71 
     72 To view the history of a specific Helm chart deployment you can use \mintinline[breaklines]{bash}{helm history <release_name> -n <namespace>}.
     73 Note however that unless you add the `--max` flag only the last 256 revisions will be displayed.
     74 
     75 When you end up in a broken deployment or need to downgrade the application version this information can be coupled with \mintinline[breaklines]{bash}{helm rollback}.
     76 You can either use \mintinline[breaklines]{bash}{helm rollback <release_name>} to roll back to the previous revision or \mintinline[breaklines]{bash}{helm rollback <release_name> <revision>} to rollback to a specific revision.
     77 
     78 Important to note is that this does not handle database migrations.
     79 
     80 \section{Linting}
     81 Apart from operational commands Helm also allows you to lint a package.
     82 To do that there is the \mintinline[breaklines]{bash}{helm lint <PATH>} subcommand available which provides a relatively small linter for the Helm chart.
     83 It is generally a good idea to use this.
     84 You can find more information on this at \url{https://helm.sh/docs/helm/helm_lint/}.
     85 
     86 %%%%%%%%%%%%%%%%%%%%%%%%
     87 \cleardoublepage
     88 \appendix
     89 \printglossaries
     90 
     91 \nocite{*}
     92 \printbibliography[heading=bibintoc,title={Sources}]
     93 
     94 \listoffigures
     95 \end{document}