How to create the Helm chart from scratch Streamline Kubernetes Deployments with Helm

                                                    ⛵ 𝗦𝘁𝗿𝗲𝗮𝗺𝗹𝗶𝗻𝗲 𝗞𝘂𝗯𝗲𝗿𝗻𝗲𝘁𝗲𝘀 𝗗𝗲𝗽𝗹𝗼𝘆𝗺𝗲𝗻𝘁𝘀 𝘄𝗶𝘁𝗵 𝗛𝗲𝗹𝗺 🎛️...


                                                    ⛵ 𝗦𝘁𝗿𝗲𝗮𝗺𝗹𝗶𝗻𝗲 𝗞𝘂𝗯𝗲𝗿𝗻𝗲𝘁𝗲𝘀 𝗗𝗲𝗽𝗹𝗼𝘆𝗺𝗲𝗻𝘁𝘀 𝘄𝗶𝘁𝗵 𝗛𝗲𝗹𝗺 🎛️

Deploying applications in Kubernetes can be complex, especially with managing configurations and ensuring repeatability. Enter Helm, the Kubernetes package manager that makes life easier for DevOps and developers.

Helm uses Charts, which are collections of files that define the resources needed to run an application, similar to DEB or RPM packages in Linux.

Here's why Helm is a game-changer:

🎯 𝗦𝗶𝗺𝗽𝗹𝗶𝗳𝗶𝗲𝗱 𝗔𝗽𝗽𝗹𝗶𝗰𝗮𝘁𝗶𝗼𝗻 𝗠𝗮𝗻𝗮𝗴𝗲𝗺𝗲𝗻𝘁🎯: Package your Kubernetes resources into a single "chart" for easy deployment and sharing.

🔄 𝗩𝗲𝗿𝘀𝗶𝗼𝗻 𝗖𝗼𝗻𝘁𝗿𝗼𝗹🔄: Roll back to previous releases effortlessly if something goes wrong.

⚡ 𝗦𝗽𝗲𝗲𝗱 𝗨𝗽 𝗗𝗲𝗽𝗹𝗼𝘆𝗺𝗲𝗻𝘁𝘀⚡: Reduce repetitive YAML management with reusable Helm charts.

🤝 𝗖𝗼𝗺𝗺𝘂𝗻𝗶𝘁𝘆-𝗗𝗿𝗶𝘃𝗲𝗻🤝: Access thousands of pre-built charts from the Helm Hub to accelerate your projects.

🌐 𝗣𝗼𝗿𝘁𝗮𝗯𝗶𝗹𝗶𝘁𝘆🌐: Share your Helm charts to ensure consistent deployments across environments.

Creating a Helm chart from scratch involves defining a directory structure and adding configuration files to describe your Kubernetes application. Here’s a step-by-step guide

1. Install Helm (if not already installed)
    Ensure you have Helm installed. You can download it from the Helm website.
Command: helm version

2.Create a New Chart
    Use Helm’s CLI command to generate the basic structure of a Helm chart.
command: helm create <chart-name>

For example: helm create my-chart
This will create a directory structure like below

my-chart/
├── Chart.yaml        # Metadata about the chart
├── values.yaml       # Default configuration values
├── templates/        # Kubernetes resource templates
│   ├── deployment.yaml
│   ├── service.yaml
│   ├── ingress.yaml
│   └── _helpers.tpl  # Template helpers
└── charts/           # Subcharts (if needed)


3. Understand the Chart Structure
    Chart.yaml: Contains metadata about the Helm chart. here you can change the version and app version depends on your work.

apiVersion: v2
name: my-chart
description: A Helm chart for Kubernetes
version: 0.1.0
appVersion: "1.0.0"

values.yaml: Stores default values for the templates. These values can be overridden during deployment.

templates/: Contains Kubernetes YAML templates with placeholders for dynamic values.

4. Modify Templates
    Edit the files in the templates/ directory to define the Kubernetes resources required for your application.

Example: deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ .Release.Name }}-app
  labels:
    app: {{ .Chart.Name }}
spec:
  replicas: {{ .Values.replicaCount }}
  selector:
    matchLabels:
      app: {{ .Chart.Name }}
  template:
    metadata:
      labels:
        app: {{ .Chart.Name }}
    spec:
      containers:
        - name: {{ .Chart.Name }}
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
          ports:
            - containerPort: {{ .Values.service.port }}

Example: service.yaml

apiVersion: v1
kind: Service
metadata:
  name: {{ .Release.Name }}-service
  labels:
    app: {{ .Chart.Name }}
spec:
  type: {{ .Values.service.type }}
  ports:
    - port: {{ .Values.service.port }}
      targetPort: {{ .Values.service.port }}
  selector:
    app: {{ .Chart.Name }}

5. Update values.yaml
    Customize the values.yaml file with default values for the placeholders in your templates.

replicaCount: 2

image:
  repository: nginx
  tag: "1.21.6"

service:
  type: ClusterIP
  port: 80

6. Lint the Chart
    Run Helm’s linter to check for any syntax errors.

Command: helm lint my-chart

7. Package the Chart (Optional)
    Package your chart into a .tgz file to distribute it.

Command: helm package my-chart

8. Install the Chart
    Install the chart in a Kubernetes cluster.

command: helm install <release-name> ./my-chart

For example:
Command: helm install my-app ./my-chart

9. Verify the Deployment
    Check if the resources have been created successfully

Command: kubectl get all

10. Customize as Needed
  • Add Ingress rules in templates/ingress.yaml for external access.
  • Include ConfigMaps or Secrets for application configuration.
  • Use Helm hooks for pre- and post-install tasks.

As a CNCF-graduated project, Helm is trusted by the global Kubernetes community to improve efficiency and scalability.

----------------------------------------!!!! Happy Learning with Techiev !!!!!!!!----------------------------------

-------------------------Subscribe our Youtube Channel by clicking the below link----------------------  - -------------------!!https://www.youtube.com/@techieview729!!------------------------------------














Name

AWS,19,CNCF,18,Devops,48,linux,11,
ltr
item
Techie View: How to create the Helm chart from scratch Streamline Kubernetes Deployments with Helm
How to create the Helm chart from scratch Streamline Kubernetes Deployments with Helm
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6A46yfkc0ZllUuZGbz-AYfzEyKuEyLJ4NPSpRtPZwqItxdL-CDRf2HrgaNKuXrMy-gCOHipdaIYQY7kT_qFvaUZ8NDPbv8Na_HNsv8M0m_Jg9nUPELIpZOhfflprJ-rrWcB1AEe2nQsiupstyj3Ag3nNnPsL1AvqfgHURo0AG3eKoF7n2Iph4ho2jV_1W/w640-h345/What-is-helm-charts.jpg
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6A46yfkc0ZllUuZGbz-AYfzEyKuEyLJ4NPSpRtPZwqItxdL-CDRf2HrgaNKuXrMy-gCOHipdaIYQY7kT_qFvaUZ8NDPbv8Na_HNsv8M0m_Jg9nUPELIpZOhfflprJ-rrWcB1AEe2nQsiupstyj3Ag3nNnPsL1AvqfgHURo0AG3eKoF7n2Iph4ho2jV_1W/s72-w640-c-h345/What-is-helm-charts.jpg
Techie View
https://www.techiev.com/2024/12/how-to-create-helm-chart-from-scratch.html
https://www.techiev.com/
https://www.techiev.com/
https://www.techiev.com/2024/12/how-to-create-helm-chart-from-scratch.html
true
7013663511659419322
UTF-8
Loaded All Posts Not found any posts VIEW ALL View Full Article Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy