Posts

Showing posts from January, 2020

Deploying a Spring Boot App on Kubernetes

Image
OverviewIn this post, I will be explaining how to deploy a simple Spring Boot Application onto Kubernetes. I will be using MicroK8s for the Kubernetes environment. For a quick guide on how setup MicroK8s refer here.
Spring Boot App Docker Image:Let us create a simple Spring Boot application and dockerize it. The source could be downloaded from github repo here. Build the jar file and then dockerize it. I will be using the docker image from local, we can also push/pull this image from a Docker Repository. Docker command to dockerize the app is:
docker build -t basic-microservice:local .
Run the command 'docker images' and you should be able to see the docker image 'basic-microservice:local'. I have tagged the image as 'local' and not as latest. This is because, since we are using local images for Kubernetes, MicroK8s has a workaround for using local images.
Follow the instructions here, to upload docker image to MicroK8s cache.
Create Deployment in Kubernetes:Let us cr…

Kubernetes Basics

Image
Overview:Kubernetes has become the leader in Container Orchestration and a working knowledge of Kubernetes is essential for every developer.
In this post I am going to cover some very basic concepts of Kubernetes.




Concepts:Pod is a logical unit containing one or more containers (if you use a side car). It is the smallest execution unit. Replica Set represents number of instances of pods which are running. Used for scaling of pods. Stateful Set represents unique pods which retain state while running. We use Stateful Set while working with stateful workloads like a database cluster or a master slave configuration of workload. Deployment represents abstraction used to represent and update Pods and ReplicaSets. We use deployment as a "kind" in the yaml files while deploying an app in Kubernetes. Service is used for defining how we expose/access an application within a Pod.
Generally when we expose an application in Kubernetes using Service, there are four options: Cluster IP - Apps are …