Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ashutoshsahoo/spring-boot-kubernetes-mysql
Demo project for Spring Boot,Kubernetes, MySQL with PVC
https://github.com/ashutoshsahoo/spring-boot-kubernetes-mysql
dockerfile gradle java kubernetes mysql mysql-database mysql-replication palantir-docker pvc spring spring-boot spring-boot-3 spring-boot-kubernetes
Last synced: 4 days ago
JSON representation
Demo project for Spring Boot,Kubernetes, MySQL with PVC
- Host: GitHub
- URL: https://github.com/ashutoshsahoo/spring-boot-kubernetes-mysql
- Owner: ashutoshsahoo
- Created: 2017-12-03T19:46:36.000Z (about 7 years ago)
- Default Branch: main
- Last Pushed: 2024-06-14T08:33:10.000Z (6 months ago)
- Last Synced: 2024-12-09T20:54:14.498Z (13 days ago)
- Topics: dockerfile, gradle, java, kubernetes, mysql, mysql-database, mysql-replication, palantir-docker, pvc, spring, spring-boot, spring-boot-3, spring-boot-kubernetes
- Language: Java
- Homepage: https://ashutoshsahoo.github.io/spring-boot-kubernetes-mysql/
- Size: 36.1 KB
- Stars: 21
- Watchers: 1
- Forks: 48
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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
```sh
kubectl apply -f deployment/secrets.yaml
kubectl apply -f deployment/mysql-deployment.yaml```
- Build application and deploy in kubernetes
```sh
gradle clean dockerTag
kubectl apply -f deployment/app-k8s.yaml```
- Test application :
```curl
curl -X GET \
http://localhost:31371/api/v1/pets \
-H 'Accept: application/json' \
-H 'Content-Type: application/json'
```Response should be :
```json
[
{
"name": "Puffball",
"owner": "Diane",
"species": "hamster",
"sex": "f",
"birth": "1999-03-30",
"death": null
}
]
```### Delete deployment, service, secret and pvc
```sh
kubectl delete -f deployment/app-k8s.yaml
kubectl delete -f deployment/mysql-deployment.yaml
kubectl delete -f deployment/secrets.yaml```
### Reference- [Spring Boot](https://spring.io/projects/spring-boot)
- [Gradle Docker image build plugin](https://plugins.gradle.org/plugin/com.palantir.docker)
- [OpenJDK Docker](https://hub.docker.com/_/openjdk)
- [MySQL Docker](https://hub.docker.com/_/mysql)