Code Monkey home page Code Monkey logo

spring-boot-kubernetes-mysql's Introduction

Spring Boot Kubernetes and MySQL

Sample project to test and deploy spring boot application with mysql database in kubernetes.

Prerequisite

  • Docker with kubernetes enabled
  • Kubernetes command-line tool(kubectl)
  • JDK 21 LTS
  • Gradle 8

Start application

  • Create secrets and start mysql database
kubectl apply -f deployment/secrets.yaml
kubectl apply -f deployment/mysql-deployment.yaml
  • Build application and deploy in kubernetes
gradle clean dockerTag
kubectl apply -f deployment/app-k8s.yaml
  • Test application :
curl -X GET \
  http://localhost:31371/api/v1/pets \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json'
  

Response should be :

[
  {
    "name": "Puffball",
    "owner": "Diane",
    "species": "hamster",
    "sex": "f",
    "birth": "1999-03-30",
    "death": null
  }
]

Delete deployment, service, secret and pvc

kubectl delete -f deployment/app-k8s.yaml
kubectl delete -f deployment/mysql-deployment.yaml
kubectl delete -f deployment/secrets.yaml

Reference

spring-boot-kubernetes-mysql's People

Contributors

ashutoshsahoo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

spring-boot-kubernetes-mysql's Issues

pod has unbound immediate PersistentVolumeClaims

Bug

i cloned the repo and follow the step
kubectl create -f deployment/mysql-deployment.yaml

Pod remain in pending state

pod has unbound immediate PersistentVolumeClaims

Env
kubernetes v13
ubuntu v18.04 LTS

Test the application

Hi Ashutosh Sahoo! Great job with this demo repository!
Btw I had to do 2 changes in order to properly test the application - you might consider adding this to the README:

  • From the PetController I removed consumes = MediaType.APPLICATION_JSON_VALUE, from the @RequestMapping at the top. Because in the GET request we don't need any input anyway. And it was giving me error 415 when I try to execute the GET request in the browser.
  • In order to run the application in the browser I had to do minikube service spring-boot-kubernetes-mysql

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.