/ Blog Details
By Evan Dangol
29 Jan 2024
09
35
This documentation shows you how you can configure a Minikube Container as kubernetes cluster to deploy 5 replicas of mariadb.
Install Minikube
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube
Start Docker with following command
sudo systemctl start docker
or
sudo service docker start
systemctl status docker
apiVersion: apps/v1
kind: Deployment
metadata:
name: mariadb-deployment
spec:
replicas: 5
selector:
matchLabels:
app: mariadb
template:
metadata:
labels:
app: mariadb
spec:
containers:
- name: mariadb
image: mariadb
resources:
limits:
memory: 512Mi
cpu: "1"
requests:
memory: 256Mi
cpu: "0.2"
ports:
- containerPort: 3306
env:
- name: MARIADB_ALLOW_EMPTY_ROOT_PASSWORD
value: "0" # if it is 1 and root_password is set, root_password takes precedance
- name: MARIADB_ROOT_PASSWORD
value: secret
minikube start
kubectl cluster-info
kubectl apply -f mariadb.yaml
kubectl get deployments
kubectl get pods -o wide | grep minikube
kubectl get pods
minikube dashboard
you need to forward the port 3306 before that
kubectl port-forward mariadb-deployment-695d57dc6d-blnns 3306:3306 #(mariadb-deployment-695d57dc6d-blnns is one of the 5 pod)
kubectl exec -it mariadb-deployment-695d57dc6d-blnns -- mariadb -u root -psecret
start workbench and click on new connection
use host as 127.0.0.1 and port as forwarded port in this case 3306 enter password and done.
Enter your email to receive our latest newsletter.
Don't worry, we don't spam
Comparasion of free tier AWS, Azure and Google cloud virtual machines -by Evan Dangol
How to Access local web api from mobile device -by Evan Dangol