Creating a Helm chart to deploy a Flask web-app on the Kubernetes cluster.

What is Helm?
In simple terms, Helm is a package manager for Kubernetes. Helm is the K8s equivalent of yum or apt. Helm deploys charts, which you can think of like a packaged application. It is a collection of all your versioned, pre-configured application resources which can be deployed as one unit. You can then deploy another version of the chart with a different set of configurations.
Helm helps in three key ways:
- Improves productivity
- Reduces the complexity of deployments of microservices
- Enables the adaptation of cloud-native applications
Task-Description:
Today, We are Going to Deploy a Flask Application which is Just a Riddle Game Application.
We will be using Knowledge of Ansible, Kubernetes and Flask to Overcome all the tackles.
Requirements:
a. Local/Remote (any) System with Ansible configured
b. Aws AccessKey and Secret Key(AWS Account)
c. Helm Knowledge
d. And Stable Internet Connectivity
Let’s Get started…….
STEP-1: Launching the AWS EC2 Instances using Ansible Role
# ansible-playbook /ansible_arth/prov1.yml
>> Download and Edit the Prov1.yml according to your AWS configuration
>> Download prov1.yml and cluster.yml on my GitHub (link in last of the Article)

STEP-2: Setting Up the K8s Cluster on AWS Ec2 Instance
# ansible-playbook /arth_ansible/cluster.yml
>>>> Download prov1.yml and cluster.yml on my GitHub (link in last of the Article)


STEP-3: Download and Installing Helm on K8s Mater running on Ec2 Instance!
# wget https://get.helm.sh/helm-v3.5.4-linux-amd64.tar.gz (For Linux OS)
# tar -xvzf helm-v3.5.4-linux-amd64.tar.gz
# cp linux-amd64/helm /usr/bin (Indirectly adding a Path)


STEP-4: Creating a Helm Package and a Chart.
# helm create myriddle
>> here Instead of “myriddle” we can use any-name

>> To check helm Verison
# helm version (Can Be used for good Use cases)

STEP-5: Editing the Files Inside Helm
>> Editing the “Chart.yaml” (One of the Important file)
>> We also remove the Non-required .yaml files
>> We only need [“service.yaml”, “deployment.yaml”]

>> Creating a deployment.yaml according to our Requirement
# vim templates/deployment.yaml

>> Creating a service.yaml according to our Requirement
# vim templates/service.yaml

STEP-5: Installing my helm under the name of “myflaskapp”
# helm install myflaskapp myriddle/
>> In above command we should provide pour helm chart directory

>> Listing the deployed helm
# helm list

STEP-6: Finally Running the flask app using any Browser
>> we will be using Node Public Ip
>> And our Application Port 5000 is Binded to NodePod Port:30001


Hope you Guys Enjoyed and Learned a lot
Keep on Learning…All the Best
All The Codes and Files are Uploaded to my github
GitHub: https://github.com/Rishbah-76/myflask-riddle-app.git
**Note**
>> All the Files must be in a Single Directory
>> To use the Ansible role:
a. System Must have ansible configured
b. you should initialize the role
c. And, must update the ansible.cfg file to set default ansible_roles path.
>> If Facing Any error:
Contact me through Linkedin: https://www.linkedin.com/in/rishabh-465a85185/