/k8s-3tier-webapp

Sample web application based on k8s

Primary LanguageJavaMIT LicenseMIT

🦌 k8s-3tier-webapp

Java CI Docker Image CI Yaml Validator Minikube CI Minikube Stress CI Minikube Security CI Check for Update Dockerfile Lint Check for CI Target Cypress CI Codacy Badge Codacy Badge CodeFactor Maintainability codebeat badge codecov Quality Gate Status GuardRails badge Renovate enabled BCH compliance Support JVM Version Support Quarkus Version Support Kubernetes Version Support Minikube Version Cypress Dashboard Gitpod ready-to-code MDDocs ready MIT License


This is a sample web application based on k8s with a focuse on connecting components, setting up k8s resources, and deploying microservices. This is for PoC only and not for use in a production environment.


Tier Name Description
1 Frontend Web page, Application logic, Static file
2 Backend Database, Cache, Messaging
3 Management Monitoring, CI/CD, Tracing

LayardArchitecturalOverview.png

Concepts

  • k8s resources defined with yaml manifests
  • Test automation utilizing Github Actions
  • Automated unit, end-to-end, performance, recovery, & security tests
  • Provide monitoring services for observability
  • Improve application quality using public CI services

Features

  • All docker components run on k8s
  • Utilizes Quarkus, a full-stack, Kubernetes-native, Java App Framework tailored for OpenJDK & GraalVM to ensure a small memory footprint and reduced boot time.
  • k8s resources defined in yaml manifests
  • Utilizes only public, non commercial software
  • Utilizes Github Actions for build, test, release

Requirements

Installed CLI commands.

  • 💻 docker
  • 💻 kubectl
  • 💻 minikube

Run on Minikube

Mac

minikube config set memory 121288
minikube config set cpus 6
minikube config set disk-size 80g
minikube start
minikube addons enable ingress
kubectl delete -A ValidatingWebhookConfiguration ingress-nginx-admission

eval $(minikube docker-env)

Windows

minikube config set memory 121288
minikube config set cpus 6
minikube config set disk-size 80g
minikube start
minikube addons enable ingress
kubectl delete -A ValidatingWebhookConfiguration ingress-nginx-admission

minikube docker-env --shell powershell | Invoke-Expression

Build & Apply

apply.sh supports kubectl apply to k8s clusters.

./kubernetes/bin/apply.sh

Web Console Access

Add hosts

Add IP, domain in /etc/hosts

echo `minikube ip` k8s.3tier.webapp openliberty.minikube spring.minikube api.server.minikube \
rabbitmq.management.minikube jenkins.minikube alertmanager.minikube prometheus.minikube \
grafana.minikube jupyter.minikube hazelcast.manager.minikube activemq.management.minikube \
jaeger.minikube argo.minikube >> /etc/hosts

Web Console list

Service URL
Top Page http://k8s.3tier.webapp/
Open Liberty http://openliberty.minikube
Spring Boot http://spring.minikube
Rabbitmq Management Console http://rabbitmq.management.minikube
Activemq Management Console http://activemq.management.minikube

top.png

Component

Application

Java based web application for application

Kubernetes

Yaml based kubernetes manifests for kubernetes

Monitoring

Set up monitoring for Tier 3

Contribution

  1. Fork this repo
  2. Create a feature branch named like feature/enhancement from master branch
  3. Commit your changes
  4. Rebase your local changes against the master branch
  5. Create new Pull Request