Azure DevOps Helm Deployment πŸš€

SAITEJA IRRINKI
3 min readApr 2, 2024

Are you diving into the world of Kubernetes deployments and feeling a bit lost at sea? Don’t worry, Helm is here to rescue you! Let’s sail through Helm and make your Kubernetes journey smoother.

πŸ€” What is Helm?

Helm is a package manager for Kubernetes applications, designed to simplify the process of deploying, managing, and scaling containerized applications. Think of it as your go-to tool for streamlining the management of complex Kubernetes resources.

πŸ—οΈ Helm Structure:

The Helm structure consists of:

  1. Charts: Bundles of pre-configured Kubernetes resources that define the structure of an application.
  2. Templates: Dynamic YAML files within charts, allowing parameterization and customization.
  3. Values: Configuration options that can be customized during deployment.
  4. Charts Repository: A centralized location for sharing and discovering Helm charts.

🧩 Components in a Helm Chart:

When you crack open a Helm chart, you’ll find several key components

my-chart/
β”œβ”€β”€ charts/
β”œβ”€β”€ templates/
β”‚ β”œβ”€β”€ NOTES.txt
β”‚ β”œβ”€β”€ deployment.yaml
β”‚ β”œβ”€β”€ service.yaml
β”‚ └── ... (other k8s manifest files)
β”œβ”€β”€ Chart.yaml
β”œβ”€β”€ values.yaml
└── README.md
  1. Chart.yaml: Metadata about the chart, including name, version, and dependencies.
  2. Templates: Kubernetes manifest files with placeholders for dynamic values.
  3. Values.yaml: Default configuration values for the chart.
  4. Charts: Subcharts or dependencies required by the main chart.
  5. README.md: Documentation providing instructions and guidance on using the chart.
  6. NOTES.txt: Helpful information and post-installation notes for users.

βš™οΈ Helm Basic Commands:

Getting started with Helm is a breeze thanks to its intuitive command-line interface. Here are some essential commands:

  • helm create <chart_name>: Create a new chart.
  • helm install <release_name> <chart_name>: Install a chart.
  • helm upgrade <release_name> <chart_name>: Upgrade a deployed release.
  • helm list: List deployed releases.
  • helm uninstall <release_name>: Uninstall a release.

πŸš€ Sample Helm Project Files:

Now, let’s dive into a sample Helm project to see how these concepts come together:

#Azure Pipeline Code: Helm Upgrade/Install πŸš€
- task: HelmDeploy@0
displayName: 'helm upgrade for [Component]'
inputs:
connectionType: 'Kubernetes Service Connection'
kubernetesServiceConnection: $(KubernetesServiceConnection)
namespace: $(Namespace)
command: upgrade
chartType: FilePath
chartPath: '$(System.DefaultWorkingDirectory)/[PathToChart]'
releaseName: $(ReleaseName)
valueFile: '$(System.DefaultWorkingDirectory)/[PathToValuesFile]'
arguments: '--timeout 30m'
#Deployment Template File
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.deploymentname }} # πŸš€ Name of the Deployment
spec:
replicas: 1 # 🚢 Number of desired replicas
selector:
matchLabels:
app: {{ .Values.appname }} # 🏷️ Selector to match pods with the label "app: wavecafe"
template:
metadata:
labels:
app: {{ .Values.appname }} # 🏷️ Labels applied to pods created by this template
spec:
containers:
- name: my-app-container # πŸ“¦ Name of the container
image: "{{ .Values.image.name }}:{{ .Values.image.tag }}" # 🐳 Docker image to use
ports:
- name: cafe-port # 🌐 Name of the port
containerPort: 80 # πŸšͺ Port that the container listens on
#Service Template File
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.servicename }} # β˜• Name of the Service
spec:
selector:
app: {{ .Values.appname }} # 🏷️ Select pods with the label "app: wavecafe"
ports:
- protocol: TCP # 🌐 Protocol for the port
port: 80 # πŸšͺ Port on the Service
targetPort: cafe-port # πŸš€ Port on the pods to forward traffic to
type: LoadBalancer
#Values File
appname: wavecafe
deploymentname: wavecafe
servicename: wave-cafe

image:
name: saitejairrinki/wavecafe
tag: v1

Additional Features 🧩

In this Helm repository, I have added Horizontal Pod Autoscaling (HPA) and Kubernetes probes to ensure high availability and improved reliability.

Happy Helming! βš“πŸŒŸ

--

--

SAITEJA IRRINKI

I’m SAITEJA IRRINKI Working as a Senior DevOps Engineer in Build & Release. Experienced in Provisioning and Managing Cloud Infrastructure.