9

DEPLOYING A WORDPRESS APPLICATION WITH MYSQL DATABASE IN K8S Cluster USING HELM...

 3 years ago
source link: https://dev.to/hackcoderr/deploying-a-wordpress-application-with-mysql-database-in-k8s-cluster-using-helm-on-aws-4lpn
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Welcome to back in my another article. You will see all about the integration of WordPress, MySQL, Helm etc, in this article. So let's get started without delay.

Pre-requisite

To perform this scenario you will need mentioned tools and platform.

Kubernetes Setup

To demonstrate this scenario, first of all we have to install the Kubernetes setup then we can move ahead for farther part. I am installing the Kubernetes Kubernetes cluster on the top of AWS. So launch the instance with mentioned configuration.

  • Ubuntu Server 18.04 LTS (HVM), SSD Volume Type
  • t2.xlarge Instance type
  • Minimum Storage 30 GiB

After launching AWS Instance, connect with it with the help of any remote software eg. putty etc or ssh protocol and then run the following commands.

  • login with root power.
sudo su -
Enter fullscreen modeExit fullscreen mode
  • Install kubectl.
curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
Enter fullscreen modeExit fullscreen mode
  • Update the instance and install docker.
sudo apt-get update -y
sudo apt-get install docker.io -y
Enter fullscreen modeExit fullscreen mode
  • Install curl software to install Minikube.
sudo apt-get install curl -y
Enter fullscreen modeExit fullscreen mode

What's Minikube ?

Minikube is a utility you can use to run Kubernetes (k8s) on your local machine. It creates a single node cluster contained in a virtual machine (VM). This cluster lets you demo Kubernetes operations without requiring the time and resource-consuming installation of full-blown K8s.

  • Install Minikube
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo chmod +x minikube
sudo mv minikube /usr/local/bin/
sudo apt install conntrack
Enter fullscreen modeExit fullscreen mode
  • Go into sudo if not gone.
sudo -i
Enter fullscreen modeExit fullscreen mode
  • Start the Minikube
minikube start --vm-driver=none
Enter fullscreen modeExit fullscreen mode
  • Now our single node cluster is ready to use and you can use with below command.
minikube status
Enter fullscreen modeExit fullscreen mode

and you will get output such as;

root@ip-172-31-39-130:~# minikube status
minikube
type: Control Plane
host: Running
kubelet: Running
apiserver: Running
kubeconfig: Configured
Enter fullscreen modeExit fullscreen mode

What's Helm ?

So let's try to understand what helm is?

  • Helm is package manager for Kubernetes
  • Helm packages are called Charts.
  • Helm Charts help define, install and upgrade complex Kubernetes application.
  • Helm Charts can be versioned, shared, and published.
  • Helm Charts can accept input parameter.

    • Kubectl need template engine to do this (Kubernetes, jinja etc)
  • Popular packages already available.

What's Grafana ?

Grafana is a multi-platform open source analytics and interactive visualization web application. It provides charts, graphs, and alerts for the web when connected to supported data sources. A licensed Grafana Enterprise version with additional capabilities is also available as a self-hosted installation or an account on the Grafana Labs cloud service. It is expandable through a plug-in system. End users can create complex monitoring dashboards using interactive query builders. Grafana is divided into a front end and back end, written in TypeScript and Go, respectively.

Dockerfile for grafana


minikube status


clone the repo

git clone https://github.com/hackcoderr/Grafana.git

go inside the Grafana then install

wget https://get.helm.sh/helm-v3.5.2-linux-amd64.tar.gz

then run

tar -xvzf helm-v3.5.2-linux-amd64.tar.gz

then copy

cp linux-amd64/helm /usr/bin/

then run helm

cd


curl https://baltocdn.com/helm/signing.asc | sudo apt-key add -
sudo apt-get install apt-transport-https --yes
echo "deb https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list
sudo apt-get update
sudo apt-get install helm


root@ip-172-31-47-112:~# helm install grafana Grafana/
NAME: grafana
LAST DEPLOYED: Sun Apr 18 14:25:28 2021
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None

root@ip-172-31-47-112:~# kubectl get pods
NAME READY STATUS RESTARTS AGE
graf-7f76fcd8b6-fxvwl 1/1 Running 0 71s

root@ip-172-31-47-112:~# kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
graf NodePort 10.107.249.248 3000:30683/TCP 2m17s
kubernetes ClusterIP 10.96.0.1 443/TCP 11m
``

root@ip-172-31-47-112:~# kubectl get service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
graf NodePort 10.107.249.248 3000:30683/TCP 4m1s
kubernetes ClusterIP 10.96.0.1 443/TCP 13m
root@ip-172-31-47-112:~#


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK