Deploy Applications on Kubernetes through Helm

IntVerse.io
8 min readJul 9, 2023

Helm simplifies and standardizes the deployment process for Kubernetes applications, making it an effective tool for managing complex application deployments and promoting collaboration within the Kubernetes ecosystem.

Helm is a package manager for Kubernetes that allows you to streamline the deployment and management of applications on a Kubernetes cluster. It provides a way to define, install, and upgrade complex Kubernetes applications using a single configuration file called a Helm chart.

Here are some reasons why Helm-based deployment is commonly used on Kubernetes:

  1. Simplified Application Packaging: Helm allows you to package all the necessary Kubernetes resources (such as deployments, services, config maps, and secrets) into a single, version-controlled package called a Helm chart. This makes it easier to manage and distribute complex applications as a single unit.
  2. Reproducible Deployments: With Helm, you can define the desired state of your application using a declarative Helm chart. This chart can be versioned and shared with others, ensuring that the same application can be deployed and reproduced consistently across different environments.
  3. Templating and Configuration Management: Helm provides a powerful templating engine that allows you to parameterize and customize your Kubernetes manifests. You can define variables and templates within the Helm chart, enabling dynamic configuration based on different environments or user-defined values.
  4. Simplified Deployment Lifecycle: Helm simplifies the deployment and management of applications by providing commands to install, upgrade, roll back, and delete Helm charts. It abstracts away the complexities of managing individual Kubernetes resources, making it easier to perform these operations with a single command.
  5. Community and Ecosystem: Helm has a vibrant community and a vast ecosystem of pre-built Helm charts available for popular applications and services. This allows you to leverage existing Helm charts to deploy applications quickly without reinventing the wheel.
  6. Versioning and Rollbacks: Helm supports versioning of Helm charts, enabling you to track and manage different versions of your application deployments. If an upgrade doesn’t go as planned, Helm allows you to roll back to a previous version of the application easily.
  7. Collaboration and Reusability: Helm charts can be shared and reused across teams, organizations, and the wider Kubernetes community. This fosters collaboration, standardization, and code reuse, making it easier to adopt best practices and share application deployment patterns.

Helm architecture combines the Helm client, Helm charts, the Kubernetes API server, and the Kubernetes cluster to provide a powerful and flexible tool for managing application deployments on Kubernetes.

Helm Architecture

It simplifies the process of packaging, deploying, and managing applications, promoting consistency and collaboration within the Kubernetes ecosystem.

  1. Helm Client: The Helm client is the command-line interface (CLI) tool that developers and operators interact with to manage Helm charts and deployments. It provides commands to package, install, upgrade, roll back, and manage Helm charts on a Kubernetes cluster.
  2. Helm Chart: A Helm chart is a package format used by Helm to define and distribute Kubernetes applications. It contains a collection of files, including templates for Kubernetes manifests, default configuration values, and metadata about the chart. Helm charts provide a convenient way to package and distribute applications, making it easier to deploy and manage them consistently.
  3. Kubernetes API Server: The Kubernetes API server is a core component of Kubernetes responsible for handling API requests and managing the state of the cluster. Helm interacts with the Kubernetes API server to create and manage Kubernetes resources, such as deployments, services, config maps, and secrets, based on the instructions provided in the Helm charts.
  4. Kubernetes Cluster: The Kubernetes cluster is the underlying infrastructure where the applications are deployed and managed. It consists of multiple nodes that run containerized applications and are managed by the Kubernetes control plane. Helm leverages the Kubernetes cluster’s capabilities to deploy and manage applications, ensuring scalability, high availability, and fault tolerance.
  5. Helm Repository: A Helm repository is a centralized location where Helm charts are stored and can be accessed by the Helm client. It can be a public repository or a private repository hosted on a web server or a cloud storage service. Helm charts can be published to a repository, making it easier for users to discover and install them. Helm also supports the creation of local repositories, which are useful for sharing charts within an organization or development team.
  6. Helm Plugins: Helm provides a plugin system that allows extending its functionality beyond the core features. Helm plugins can be developed to add new commands, perform custom logic, integrate with external systems, or enhance the Helm client’s capabilities. Users can install Helm plugins to extend Helm’s functionality according to their specific needs.

Prerequisites:-

1. Docker Images

2. Kubernetes

This blog clearly explains

What HELM … ? Why HELM … ? HOW HELM …?

What is HELM … ?
HELM is a package manager for Kubernetes Applications.

Why HELM…?
Through HELM we can easily maintain the Kubernetes deployments by separating blueprints and data of Kubernetes objects.

HOW HELM … ?
To explain this will see with and without HELM deploying apps to Kubernetes.

I. Deploying Application Without HELM

hello-world-node-app.yaml

---  
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: hello-world-node-app
name: hello-world-node-app
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: hello-world-node-app
template:
metadata:
labels:
app: hello-world-node-app
spec:
containers:
- image: gcr.io/google-samples/node-hello:1.0
name: hello-world
ports:
- containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
labels:
app: hello-world-node-app
name: hello-world-node-app
namespace: default
spec:
ports:
- port: 8080
protocol: TCP
targetPort: 8080
selector:
app: hello-world-node-app

hello-world-java-app.yaml

---  
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: hello-world-java-app
name: hello-world-java-app
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: hello-world-java-app
template:
metadata:
labels:
app: hello-world-java-app
spec:
containers:
- image: gcr.io/google-samples/java-hello:1.0
name: hello-world
ports:
- containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
labels:
app: hello-world-java-app
name: hello-world-java-app
namespace: default
spec:
ports:
- port: 8080
protocol: TCP
targetPort: 8080
selector:
app: hello-world-java-app

To deploy the above applications on to Kubernetes

kubectl apply -f hello-world-node-app.yaml

kubectl apply -f hello-world-java-app.yaml

These files consist of both templates and data. Let's say if we need to deploy more applications, then for each application we need to end up writing the same kind of duplicate files all the time.

How about if there is one common template and all applications use that template to deploy …? Will that be cool … ? That’s exactly what HELM offers.

II. Deploying Application With HELM:-

Create a Helm chart:

$ helm create mychart

This command generates a directory structure for your Helm chart named mychart with the following files:

  • mychart/Chart.yaml: Contains metadata about the chart, such as the chart name, version, and description.
  • mychart/values.yaml: Default configuration values for your chart.
  • mychart/templates/: Directory where you'll place your Kubernetes manifest templates.
  • mychart/templates/deployment.yaml: Example deployment template file.
  • mychart/templates/service.yaml: Example service template file.

deployment.yaml — template for deployment object of Kubernetes

apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.app.name }}
labels:
app: {{ .Values.app.name }}
group: {{ .Values.app.group }}
spec:
replicas: {{ .Values.app.replicaCount }}
selector:
matchLabels:
app: {{ .Values.app.name }}
template:
metadata:
labels:
app: {{ .Values.app.name }}
group: {{ .Values.app.group }}
spec:
containers:
- name: {{ .Values.app.name }}
image: {{ .Values.app.container.image }}
imagePullPolicy: {{ .Values.app.container.imagePullPolicy }}
ports:
- containerPort: {{ .Values.app.container.port }}

service.yaml — template for service object of Kubernetes

apiVersion: v1
kind: Service
metadata:
name: {{ .Values.app.name }}
labels:
group: {{ .Values.app.group }}
annotations:
konghq.com/plugins: {{ .Values.app.kongplugins }}
spec:
type: {{ .Values.app.service.type }}
selector:
app: {{ .Values.app.name }}
ports:
- port: {{ .Values.app.service.port }}
targetPort: {{ .Values.app.container.port }}
protocol: {{ .Values.app.container.protocol }}

values.yaml — default values injected to templates while deploying to kubernetes

app:
name: app
group: app
replicaCount: 1
container:
image: add-image-here
port: 8080
config: []
env:
- key: key
value: value
service:
type: ClusterIP
port: 8080

hello-world-node-app.yaml — application-specific values overrides the default values of values.yaml while deploying to Kubernetes

app:
name: hello-world-node-app
group: backend
container:
image: gcr.io/google-samples/node-hello:1.0
port: 8080
imagePullPolicy: Always
protocol: TCP

hello-world-java-app.yaml- application-specific values override the default values of values.yaml while deploying to Kubernetes

app:
name: hello-world-java-app
group: backend
container:
image: gcr.io/google-samples/java-hello:1.0
port: 8080
imagePullPolicy: Always
protocol: TCP

The coolest part is we do not need to create all these templates and data files manually. HELM offers basic commands to manage the package structure.

brew install helm
helm create app

Remove all the unnecessary files and add the above files by following the below directory

Deploy the application onto Kubernetes through HEML using the following commands

helm install -f hello-world-java-app.yaml hello-world-java-app ./app

helm install -f hello-world-node-app.yaml hello-world-node-app ./app

Clear Description of the above commands:-

1.) helm install => describes install a helm chart
2.) -f hello-world-java-app.yaml => describes overrides values from values.yaml
3.) hello-world-node-app => describes release name
4.) ./app => describes base chart name

We can clearly see the services, deployments, pods, and replicas deployed in Kubernetes through HELM below

So this is how we can easily maintain and deploy multiple applications onto Kubernetes by segregating the templates and the real data of the applications using HELM :)

IntVerse.io is a professional services company that offers a wide range of services, including consulting, technology solutions and managed services. Here are some common Kubernetes platform service offerings that we offer:

  1. Kubernetes Consulting and Strategy: We offer consulting services to help organizations assess their requirements, define Kubernetes adoption strategies, and develop a roadmap for implementing Kubernetes-based solutions. This could involve evaluating existing infrastructure, identifying application candidates for Kubernetes deployment, and designing the overall Kubernetes architecture.
  2. Kubernetes Implementation and Deployment: We lead the implementation and deployment of Kubernetes clusters, ensuring proper configuration, scalability, and security. This may include infrastructure setup, cluster provisioning, network configuration, and integration with existing systems.
  3. Kubernetes Application Modernization: We help organizations modernize their applications by migrating them to Kubernetes and container-based architectures. This involves containerizing applications, designing Kubernetes manifests, and deploying applications on Kubernetes clusters.
  4. Managed Kubernetes Services: We offer managed services for Kubernetes clusters, handling ongoing cluster management, monitoring, scaling, and operational tasks. This includes managing infrastructure resources, ensuring high availability, applying security patches, and optimizing cluster performance.
  5. Kubernetes Security and Compliance: We provide services to enhance the security and compliance posture of Kubernetes environments. This could involve implementing access controls, network policies, encryption, vulnerability scanning, and auditing to meet regulatory and compliance requirements.
  6. Kubernetes Continuous Integration/Continuous Deployment (CI/CD): We help set up CI/CD pipelines for Kubernetes-based applications. This involves automating the build, test, and deployment processes, integrating with container registries, and configuring deployment strategies such as blue-green or canary deployments.
  7. Kubernetes Training and Enablement: We offer training and enablement programs to upskill teams on Kubernetes concepts, best practices, and tools. This includes workshops, hands-on labs, and mentoring to help organizations build internal expertise in managing and operating Kubernetes environments.

We provide customized services that can be tailored based on your specific needs, such as multi-cloud deployments, hybrid environments, or specific industry regulations.

--

--

IntVerse.io

We Solve Platform & Integration Problems in the UniVerse