Posts

Showing posts from October, 2020

Resource Request/Limit in Kubernetes

Image
 Hello There , Welcome back again on new post on Kubernetes tutorial. In todays article, we will focus on configuring resource requests and resource limits.   Each Pod requires certain amount of memory and cpu to function but some unusual circumstances Pod can behave weirdly and may consume entire cluster resource causing application and node failures. This behaviour can be controlled by below two configuration in Pod. Requests : It is minimum amount of resource require for Pod to function. Kubernetes will look for available nodes to schedule pod based on requested resource. Limits : It is maximum amount of resource required by Pod can consume. In this article , we will accomplish following points. Create a Pod without Resource Configuration Perform CPU Stress on Container  Observe Resource Utilisation of Pod and Nodes. Enable Resource Configuration in Pod Observe Resource Utilisation of Pod and Nodes again. Pre-requisite : Minikube Cluster  Do cker Image :  progrium/stress  Let

Access Kubernetes ConfigMap in Spring Boot Application

Image
 Hello There, Welcome back to our new post on Kubernetes tutorials. In this example we will see how can we configure and access ConfigMap in Spring boot application. ConfigMaps are helpful where you have multiple environment (Dev,Test Prod etc) and you want to promote your container with different environment configuration. There are three ways Pods can access ConfigMap in containers. For todays Demo , we will use Environment Variable approach. Pre-requisite : MiniKube Cluster   For Demo Purpose I have created Spring Boot application which will expose below end point.  curl localhost:8080/configMap Docker Image : shashivish123/springboot  Below is how Controller class looks like and value is being autowired from application.properties. Remember CONFIG_KEY value will be coming from Kubernetes ConfigMap Environment Configuration. Now Let's Begin , We will start by Creating firs ConfigMap in Kubernetes. Step 1: Create a namespace where we will deploy container and

Kubernetes Hello World Example with Spring Boot Application

Image
Hey There , Today we will learn , how can we deploy our first spring boot demo application via Kubernetes. As a pre-requisite , I have already created a spring boot application and uploaded on public docker hub. Docker Image Name : shashivish123/exploration Pre-requisite : MiniKube Cluster  Step 1: Start Your Kubernetes cluster if not running . In below example ,we will be using Minikube cluster for development purpose. If you do not know , how to install minikube cluster , please follow official kubernetes documentation. Step 2: Now since our cluster is running fine , we will start by create a namespace where we will deploy our Kubernetes Pods and Services.   #Create Namespace kubectl create namespace casdemo Step 3: Next step is to create manifest file which will be used for creating pods and services. #Create Manifest Files kubectl create deployment casdemo --image=shashivish123/casexploration : latest --dry-run -o=yaml > deployment.yaml kubectl create s