HELM CHART FOR WORDPRESS PHP APPLICATION AND MYSQL DATABASE ON K8S:-
WHAT IS HELM CHART?
Helm is the tool for package manager i.e. chart just like roles in ansible. We can put all the resources i.e. YAML template files organized into a specific directory structure. A Helm chart can contain any number of Kubernetes or any other technological objects, all of which are deployed as part of the chart.
There are two ways to create chart:-
1) Repository
2) Custom Chart
There are two versions i.e. v2 and v3:-
1) v2 includes tiller program to connect client with server.
2) v3 not includes tiller program to connect client with server.
Task Description:-
📌 Create a Helm chart on any Technology learnt.
Let's start...
STEP 1:- Configure Multi-Node K8s Cluster on AWS EC2 Instances having 1 Master and 2 Worker Nodes.
STEP 2:- Install helm.
wget https://get.helm.sh/helm-v3.5.2-linux-amd64.tar.gz tar -xvzf helm-v3.5.2-linux-amd64.tar.gz cp linux-amd64/helm /usr/bin/ helm helm version cd .kube/ should contain config file.
STEP 3:- Create workspace /ws and then create helm chart myapp in it.
vim Chart.yaml
mkdir templates
kubectl run mywp --image=wordpress:5.1.1-php7.3-apache --dry-run -o yaml > wordpress.yaml
kubectl run mydb --image=mysql:5.7 --dry-run -o yaml > mysql.yaml
kubectl expose pod mywp --port=80 --type=NodePort --dry-run -o yaml > service.yaml
vim values.yaml
STEP 4:- Install helm providing name myapp.
Note that myapp is the name of the helm chart and /ws/myapp/ is the directory name inside which helm chart has been put.
helm install myapp /ws/myapp/
STEP 5:- Check that mywp and mydb pod has been launched and mywp has been exposed.
kubectl get pods -o wide kubectl get svc helm list
STEP 6:- Access the WordPress PHP Application having MySQL Database connected.
Using public IP and exposed port no. of K8s-Master we can see that WordPress connected with MySQL has been launched.
Thanks to read this article: