Developed a basic spring boot application and pushed the images to the docker repo.
Steps to follow to create the containers locally and perform CRUD operations on the book table of the Books database.
Make sure you modify the version of the image which is being pulled based on the architecture of the system. If you are using ARM architecture use tag (v1) and if you are using AMD architecture use tag (v2).
- Clone the git repository using
git clone https://github.com/VSNSAINIVAS/Books.git
. - Make sure minikube and kubectl are installed by using commands
minikube version
&kubectl version
. - Start the minikube by using
minikube start --driver=<driver_name>
(Driver name should be replaced by the name of the driver examples: docker, hyperv etc.) - Replace MYSQL_ROOT_PASSWORD, MYSQL_PASSWORD values in mysql-secret with base64 encoded value of the original value.
- Replace SPRING_DATASOURCE_PASSWORD valuues in springboot-secret with base64 encoded value of the original value.
- Apply configmaps for mysql and secrets for it using the commands
kubectl create -f mysql-config-map.yaml
&&kubectl create -f mysql-secret.yaml
- Apply configmaps for springboot and secrets for it using the command
kubectl create -f springboot-config-map.yaml
&&kubectl create -f springboot-secret.yaml
- Apply the mysql deployment using
kubectl create -f mysql.yaml
. - Apply the spring-boot deployment using
kubectl create -f springboot.yaml
. - Get the url of the spring-boot service using
minikube service <service_name> --url
. - Copy the url and this is needed for testing.
- Use this documentation to perform CRUD operations locally https://documenter.getpostman.com/view/32443384/2sA2r82jLB. (Make sure to replace the first url part from http://127.0.0.1/ with the url of service which you obtained in above step.)
- Make sure you add the helm repo with the command
helm repo add books-springboot https://vsnsainivas.github.io/springboot-books-helm
. - Then install the helm chart using
helm install books-springboot/springboot
.