Kubernetes Project

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Spring Boot Kubernetes

Kubernetes is an open-source system for automating the deployment, scaling, and


management of containerized applications. It groups containers that make up an application
into logical units for easy management and discovery. In this guide, we build and deploy a
simple Spring boot application.

You will need a Linux or Linux-like command line. Command line examples in this guide
work on Linux, a MacOS terminal with a shell, or WSL on Windows.

kubectl cluster-info

Kubernetes master is running at https://127.0.0.1:46253


KubeDNS is running at
https://127.0.0.1:46253/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.

kubectl cluster-info dump'

To get all the existing kubernetes objects run:

kubectl get all

Create a Spring Boot Application

First, we create a Spring Boot application. If you have one you prefer to use already in
github, you could clone it in the terminal (git and java are installed already). Alternatively, you
can create an application from scratch by using start.spring.io:

go to https://start.spring.io to generate the skeleton of the project:

Setting up the project


You should enter the Group and Name for your application:

GroupId: learnk8s.io
Name: knote-java
Next, go to the dependencies section and choose:

Web -> Spring Web Starter: basic web stack support in Spring Boot
Actuator -> Spring Boot Actuator: provide health endpoints for our application
FreeMarker -> Apache FreeMarker: templating engine for HTMLs
MongoDB -> Spring Data MongoDB: driver and implementation for Spring Data interfaces to
work with MongoDB
Lombok -> Lombok: library to avoid a lot of boilerplate code
Then click Generate the project to download a zip file containing the skeleton of your app.

Unzip the file and start a terminal session in that directory.

You will do the front-end stuff first.

Within knote-java application, there are two files in charge of rendering the Front End:

Tachyons CSS that needs to be placed inside src/main/resources/static/


Freemarker Template for our index view that needs to be placed inside
src/main/resources/templates/

You might also like