Helm is a package manager for Kubernetes that makes it easy to manage and deploy applications to a cluster. Helm charts are a way to package and distribute applications and their dependencies, making it easy to deploy and manage those applications on a cluster. In this article, we will go over how to create a Helm chart that deploys two application containers: a frontend app and its backend into a Kubernetes cluster.
1.Creating a Helm Chart
To create a Helm chart, we will first need to install Helm on our local machine. Once Helm is installed, we can use the Helm CLI to create a new chart. To do this, we will use the following command:
helm create mychart
This will create a new chart called "mychart" in the current directory. The chart will contain several files and directories that make up the structure of the chart. The most important files are the "Chart.yaml" file, which contains metadata about the chart, and the "values.yaml" file, which contains the default values for the chart's variables.The chart.yaml file seen in the picture above was the yaml file used in the project and available at my github repository
2.Deploying Two Application Containers
Once the chart is created, we can start adding our application containers to it. To do this, we will create two new directories in the chart, one for the frontend app and one for the backend app. In each of these directories, we will create a new file called "deployment.yaml", which will contain the Kubernetes deployment configuration for the corresponding app.
In the deployment.yaml file, we will specify the image for the container, the number of replicas, and the ports that the container will expose. We will also specify any environment variables or volumes that the container requires. Once the deployment.yaml file is created for both the frontend and backend, we will add them to the chart's templates directory.
3.Configuring Ingress
Once the chart is configured to deploy our two application containers, we will need to configure Ingress to access our applications. Ingress is a Kubernetes resource that allows external traffic to reach our applications. To configure Ingress, we will create a new file in the chart's templates directory called "ingress.yaml". This file will contain the configuration for the Ingress resource. example of an ingress file is seen below.
In the ingress.yaml file, we will specify the hostname and path for the Ingress resource, as well as the service that it should route traffic to. We will also specify any annotations or rules that are needed for the Ingress resource to work correctly. Once the ingress.yaml file is created, we will add it to the chart's templates directory. A diagram that illustrates the architecture of this solution could be drawn using draw.io
Once the chart is configured and all the necessary files are added, we can use Helm to deploy it to our Kubernetes cluster. To do this, we will use the following command:
helm install mychart
This will deploy our two application containers and configure Ingress to access them. With this configuration, we can now access our frontend and backend application . This post just shares the concept behind using helm. The complete files are available at my github profile. kindly view my github and star my repository.
Adesoji1 / Deploy-Web-App-Using-Helm
Create a helm chart ,.Your helm chart should deploy two application containers: a frontend app and it’s backend into your Kubernetes cluster
Deploy-Web-App-Using-Helm
Create a helm chart ,.Your helm chart should deploy two application containers: a frontend app and it’s backend into your Kubernetes cluster
Top comments (0)