Sobes.tech
Junior

Millised on Helm'i kasutamise eelised Kuberneteses?

sobes.tech AI

Vastus AI-lt

  • Complexity management: Allows describing and deploying even complex applications consisting of many microservices and dependencies as a single entity.
  • Templating: Uses Go templates to create dynamic Kubernetes manifests, making it easy to customize deployments for different environments (dev, staging, prod) without manual editing of YAML files.
  • Reusability: Enables creating and sharing application packages (charts) that can be easily installed and configured across different clusters.
  • Versioning: Manages versions of deployed applications, facilitating rollback to previous states in case of issues.
  • Updates and rollbacks: Provides a standardized and reliable way to update applications and automatically rollback in case of failures.
  • Dependencies: Manages dependencies between application components, ensuring correct deployment order.
  • Ecosystem: A large collection of ready-made charts in repositories (e.g., Artifact Hub), allowing quick deployment of popular applications.

Example structure of a Helm chart:

# Chart.yaml - metadata about the chart
apiVersion: v2
name: my-app
version: 1.0.0
description: A Helm chart for my application
# values.yaml - default values for templating
replicaCount: 1
image:
  repository: my-dockerhub/my-app
  tag: latest
  pullPolicy: IfNotPresent
service:
  type: ClusterIP
  port: 80
# templates/deployment.yaml - deployment manifest template
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "my-app.fullname" . }}
  labels:
    {{- include "my-app.labels" . | nindent 4 }}
spec:
  replicas: {{ .Values.replicaCount }}
  selector:
    matchLabels:
      {{- include "my-app.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        {{- include "my-app.selectorLabels" . | nindent 8 }}
    spec:
      containers:
        - name: {{ .Chart.Name }}
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          ports:
            - name: http
              containerPort: 80
              protocol: TCP