Deploy application to kubernetes cluster using command line
- mvn clean package
- Install Minikube
- Install Kubectl
- Install DockerDesktop
- minikube start
- minikube status
- kubectl cluster-info
minikube docker-env
@FOR /f "tokens=*" %i IN ('minikube -p minikube docker-env --shell cmd') DO @%i
docker build -t crud-k8s:2.0 .
docker images
kubectl apply -f mysql-configMap.yaml
kubectl get configmap
kubectl apply -f mysql-secrets.yaml
kubectl get secrets
kubectl apply -f db-deployment.yaml
kubectl get deployment
kubectl get pods
kubectl logs {pod-name}
kubectl exec -it {pod-name} /bin/bash
mysql -u root -p
enter password : root
show databases;
You will see the database with the name of order_management
kubectl apply -f app-deployment.yaml
kubectl get deployment
kubectl get service
or
kubectl get svc
To see the logs of spring boot with 3 pods
kubectl logs {pod-name}
kubectl port-forward {pod-name} 5000:8080
curl --location --request POST 'localhost:5000/orders' \
--header 'Content-Type: application/json' \
--data-raw '{
"name":"pizza",
"qty":2,
"price": 1000
}'
minikube ip
minikube dashboard
copy the url and see in the dashboard pods , replica set , jobs etc to see the health and delete pod etc.