GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - VividcodeIO/java-microservice-helm-example: Manage Java Microservice using Helm and Helmfile

BranchesTags
Open more actions menu

Latest commit

 

History

15 Commits
15 Commits

Folders and files

NameName
Last commit message
Last commit date
.mvn/wrapper
.mvn/wrapper
 
 
k8s
k8s
 
 
src
src
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
db.env
db.env
 
 
docker-compose.yaml
docker-compose.yaml
 
 
mvnw
mvnw
 
 
mvnw.cmd
mvnw.cmd
 
 
pom.xml
pom.xml
 
 
start_dev_db.sh
start_dev_db.sh
 
 

Repository files navigation

Java Microservice Example with Helm Chart

A microservice app created with Spring Boot 2.6.3 which accesses a PostgreSQL database and exposes a REST API.

See the video below:

Video

Helm Chart

k8s/charts/simple-service is the Helm chart to install this microservice.

Below are some key points of this Helm chart.

Spring Boot Actuator is used to expose endpoints for liveness and readiness probes.

ports:
  - name: http
    containerPort: 8080
    protocol: TCP
livenessProbe:
  httpGet:
    path: /actuator/health/liveness
    port: http
  failureThreshold: 3
readinessProbe:
  httpGet:
    path: /actuator/health/readiness
    port: http
  failureThreshold: 3

Database configurations are passed using environment variables. These environment variables will be used by Spring, see application.yaml file.

env:
  - name: DB_HOST
    value: {{ .Values.app.db.host | quote }}
  - name: DB_PORT
    value: {{ .Values.app.db.port | quote }}
  - name: DB_USER
    value: {{ .Values.app.db.username | quote }}
  - name: DB_PASSWORD
    value: {{ .Values.app.db.password | quote }}
  - name: DB_NAME
    value: {{ .Values.app.db.database | quote }}

Helmfile

The k8s/helmfile.yaml file is used to install microservice and PostgreSQL.

The k8s/dev.yaml file contains the configuration values for the default environment.

In the helmfile.yaml, configurations like postgres.username are passed to the microservice and PostgreSQL.

How to Use

  1. Start Minikube.

  2. Use minikube docker-env to print out the instructions on how to configure Docker client in the current terminal to use Docker runtime in Minikube.

  3. Build container image using mvn package.

  4. Go to k8s directory and run helmfile apply to install service and PostgreSQL.

After installation is done, use minikube service --url simple-service-simpleservice to get the URL to access the service, then use curl or HTTPie to test the API.

http <service_url>/api/v1/user/1

About

Manage Java Microservice using Helm and Helmfile

Resources

Readme
MIT license
Activity
Custom properties

Stars

2 stars

Watchers

1 watching

Forks

2 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.