Spring Application Deployed with Kubernetes
Step by step building an application using Spring Boot and deployed via Docker on Kubernetes with Helm
full course- Setup: IDE and New Project
- Create the Data Repository
- Building a Service Layer
- Create a REST Controller
- Logging, Tracing and Error Handling
- Documentation and Code Coverage
- Database as a Service
- Containerize the Service With Docker
- Docker Registry
- Automated Build Pipeline
- Helm for Deployment
- Setting up a Kubernetes Cluster
- Automating Deployment (for CICD)
- System Design
- Messaging and Event Driven Design
- Web UI with React
- Containerizing our UI
- UI Build Pipeline
- Put the UI in to Helm
- Creating an Ingress in Kubernetes
- Simplify Deployment
- Conclusion and Review
Now that we have multiple components lets simplify our deployment so that we can deploy our complete application in one step.
Create an Umbrella Chart
Create a new git repository called medium-application
. This is the repository that will house the helm umbrella chart. Create a directory called helm
and run helm create medium-application
in that directory. Again, we’re not going to need hardly any of this so lets remove any files that are unnecessary.
we only need a Chart.yaml
apiVersion: v1
name: medium-application
description: A Helm chart for Kubernetes
type: application
version: 0.1.0
appVersion: 1.16.0
dependencies:
- name: medium-customer
version: 11
repository: alias:codefresh
- name: medium-customer-manager
version: 6
repository: alias:codefresh
- name: medium-ingress
version: 1
repository: alias:codefresh
Lets go ahead and make a new pipeline to package and index this chart into our helm repo.
version: "1.0"
stages:
- "clone"
- "helmpublish"
steps:
Clone:
title: "Cloning repository"
type: "git-clone"
repo: "https://github.com/brianrook/medium-application"
revision: "master"
stage: "clone"
HelmChartGetVersion:
title: Get Helm Chart Version
stage: helmpublish
image: codefresh/cfstep-helm
working_directory: '/codefresh/volume/medium-application'
environment:
- CHART_PATH=helm/medium-application
- CHART_NAME=medium-application
commands:
- export ACTION=auth
- source /opt/bin/release_chart
- helm repo add default ${{CF_CTX_CF_HELM_DEFAULT_URL}}
- yq .version ${CHART_PATH}/Chart.yaml
- export CURRENT_CHART_VERSION=`helm search default/${CHART_NAME} | awk 'FNR==2{print $2}' || yq .version ${CHART_PATH}/Chart.yaml`
- echo $CURRENT_CHART_VERSION
- cf_export NEW_CHART_VERSION=`echo "${CURRENT_CHART_VERSION}" | awk -F. '{$NF = $NF + 1;} 1' | sed 's/ /./g'`
- echo $NEW_CHART_VERSION
HelmChartUpdate:
title: Update Helm Chart Version
stage: helmpublish
image: gksoftware/yq
working_directory: '/codefresh/volume/medium-application'
environment:
- CHART_PATH=helm/medium-application
- YAML_PATH=image.tag
commands:
- echo $NEW_CHART_VERSION
- yq w -i ${CHART_PATH}/Chart.yaml version ${NEW_CHART_VERSION}
- echo $CF_SHORT_REVISION
- yq w -i ${CHART_PATH}/values.yaml ${YAML_PATH} '"${{CF_SHORT_REVISION}}"'
HelmChartPush:
title: Push Helm Chart to Chart Repository
stage: helmpublish
image: codefresh/cfstep-helm
working_directory: '/codefresh/volume/medium-application'
environment:
- CHART_REF=helm/medium-application/
- ACTION=push
Make sure to change your trigger to kick off from a master commit. Also make sure to add the shared configuration for the helm registry so our pipeline can access it.
Commit and Build
git checkout -b helm
git add .
git commit -m "helm chart"
git push
git checkout master
git merge helm
git push
Our pipeline should now detect that change and put our umbrella chart in the helm registry. Lets pull it down and try to deploy it.
helm repo update
helm search repo codefresh
helm delete medium
helm install medium codefresh/medium-application
Hit your endpoint and you should see the deployed application at http://medium-example.com/
0 comments on “Simplify Deployment”Add yours →