Posts

Showing posts from April, 2020

Spring Session

Spring Session provides an API and implementation for managing a user's session information. It also support clustered sessions without being tied to an application container-specific solution. Spring session support  integration with the HttpSession, WebSocket and WebSession. HttpSession : HttpSession replace HttpSession in application container with support of providing sessionId in header to work with RESTFUL APIS . WebSocket : It keeps alive HttpSession when receiving webSocket message. WebSession : WebSession replace Spring WebFlux's WebSession in an application container neutral way. Above thing can be  achieved using Spring Session Core, Spring Session Data Redis, Spring Session JDBC, Spring Session HazelCast. Spring Session Core provides core Spring Session functionality and API. Spring Session Data Redis provides SessionRepository and ReactiveSesssionRepository implementation backed by Redis and Configuration support. Spring Session JDBC provides Sess

Spring Security Authentication

Image
Spring Security   provides comprehensive support for Authentication. Spring security Authentication has various section like, SecurityContextHolder Object Overview SecurityContextHolder: Spring Security Stores the details of who is authenticated. SecurityContextHolder uses a ThreadLocal to store authenticated user and authenticated principal. SecurityContextHolder uses ThreadLocal. Hence, We can access its details across the method. SecurityContext: It contains the Authentication of the currently authenticated user. Spring Security does not care how the securityContextHolder is populated. If it contains a value, then it is used as the currently authenticated user. The SecurityContext is obtained from the SecurityContextHolder. Authetication: Can be put input to AuthenicationManager to provide the credentials a user has provided to authenticate or the current user from the SecurityContext. The Authentication contains: principal, credentials and authorities.Principal ide

Spring Security Filter

Spring Security is a framework that provides key security mechanism authentication, authorization and and protect application against attack. Spring security 5.3.2 requires a Java 8 or higher Run-time Environment. There is not any need to configure a special Java Authentication and Authorization Service (JAAS) policy file or place Spring Security into common classpath locations. All required files are contained within your application. Filter in Spring Security Spring Security Servlet support is based on Servlet Filters. The behavior of Filter is like, Client sends a request to the application and the container creates a FilterChain. FilterChain contains the Filter and Servlet that should processes the HttpServletReques based on path of RequestURI. One Servlet can handle a single HttpServletRequest and HttpServletResponse. More than one filter can prevent downstream Filter or the Servlet from being invoked. Filter can also modify the HttpServletRequest or HttpServletResponse use

Maven Setting Mirror

Maven Mirror specify from where dependencies should be downloaded. There is already repository tag is available but maven mirror used in specific condition. Let's see that. Geographically closer mirror to get dependencies You want to represent repository which have better control of dependencies Need to provide local cache to repository manager In the organisation, to avoid external traffic we can use mirror. Let's see the working of mirror. The scenario is like, we have two repository first, Maven Central and second, Custom We have declared dependencies to an  artifact. Maven will look into Custom repository. Dependencies is not found into the Custom repository.  Maven will go to central repository. Maven will notice that mirror was configured for that repository. Maven will not go to central but it will go to mirror URL. Following way we can declare, Mirror in settings.xml <settings> ... <mirrors> <mirror> <id&

Kubernetes Vs Docker

Image
                  Kubernetes and Docker both are used in Cloud Computing. Kubernetes and Docker are used in line with one another.  Using containerization technology, Kubernetes allows running containers across several compute nodes. Depending on the requirements, Kubernetes can make the containers spun up or torn down.                    Docker is a light weight VM for software packaging and delivery platform. Before Kubernetes there is concept of   Docker Swarm. Docker Swarm is an open-source container orchestration platform. It is the native clustering engine for Docker. Kubernetes vs Docker Conclusion:              Kubernetes provides container orchestration and Docker provides Operating System level virtualization. 

Kubernetes Service

Image
               Why Service needs?             Kubernetes Pods are born and when they die, they are not resurrected. Using deployment, we can assign desired state of the pod. Deployment can create and destroy Pods dynamically. In cluster, If some set of Pods (call them "backends") provides functionality to other Pods (call them "frontends"). Frontends Pods find out and keeep track of which IP address to connect to, so that the frontend can use backend part of the the Pods.            In Kubernetes, a Service  defines a logical set of Pods and a Policy by which we can access them. A service in kubernetes is a REST object, similar to object. We can create POST service to create a new instance. The set of Pods targeted by a service is determined by a selector. Frontends Pods do not care which backend they use. While the actual Pods that compose the backend set may change, the frontend clients should not need to be aware of that, nor should they need to k

Kubernetes API Overview

Image
                 Kubernetes API facilitate communication and operation between kubernetes component and external users. Most operation can be performed using the kubectl command line interface or other command line tool such as kubeadm.                 Kubernetes version, The version is set at API level rather then at the resource or field level. Kubernetes support multiple versions, each at different API path. for example, /api/v1 or /apis/extensions/vbeta1. Kubernetes API version has various levels like, Development level, Aplha lebevel, Beta level and Stable level. The naming convention to access this API is different on API level.                   Kubernetes API is specified by using /api/{apiVersion}. ApiVersion is anything mention as above.  Here, The term API group introduce to specify specific version. We can also enable and disable api version using the apiServer. Conclusion:  Kubernetes API version can be specified in URL. We can use API using command

Kubernetes Components

Kubernetes Node: It is a worker machine. Kubernetes node may be vm machine and physical machine. The service on a node includes container runtime, kubelet and kube-proxy. Each node contains the services necessary to run  pods   and is managed by the master components. Kubernetes Cluster:   I t is a set of node machines for running applications. Kubernetes cluster consists of a set of worker machines, called nodes , that run containerized applications.   When you deploy Kubernetes, you get a cluster.   If you’re running Kubernetes, you’re running a cluster. Cl uster contains a worker node and a master node.    Worker nodes actually run the applications and workloads. M aster node is responsible for maintaining the desired state of the cluster. Kubernetes Container:   It is a packaged code along with dependencies needs at run time. Each container run is repeatable manner that means you get the same behavior wherever you run it. Container makes application decouple from underlying in

Kubernetes Pod

                Pod is the smallest deployable object in the kubernetes object model. Pod represents processes running on cluster. Pod is the basic execution unit of a kubernetes application. A pod is the basic execution unit. It is smallest and simplest unit in the kubernetes object model that we can create or deploy.                 A Pod encapsulates an application container, storage resources, a unique network IP and options how the containers should run. Pod contains either a single container or a small number of containers. Pods can be used two ways. 1. One-container-per-pod  2. Multiple-container-per-node. One-container-per-pod: Pods that run a single container is most common kubernetes use cases. Pod as a wrapper around a single container and kubernetes manages the pods rather than the containers directly. Multiple-container-per-pod: Pod might encapsulate an application composed of multiple container. These multiple container are tightly coupled and need to share reso

Kubernetes objects

Image
         Kubernetes object use to represent the state of the cluster. Kubernetes object uses to represent the state of the cluster, what containerized application is running , the state of the running application, resource available for the running application. In brief, It represent the persistent entity in the kubernetes system.         Kubernetes object creation and state is achieved using the kubernetes API. kubectl command line interface is used to call kubernetes API. Kubernetes object uses to represent the desired state,       Object state is managed by using the control plane. Control plane continually and actively manage actual state to the desired state. The .yaml file provides information regarding object desired state and other information. This yaml file specify using kubectl command line interface.  When you use the Kubernetes API to create the object (either directly or via  kubectl ), that API request must include object state information as JSON in the req

What Why and How Kubernetes

Introduction What is kubernetes ? Why need kubernetes ? How do I use kubernetes ?       1. Introduction.        It is basically container orchestration engine for automating deployment , scaling and management of containerized application. This project is hosted by the cloud native computing foundation.        Kubernetes provides different solution for managing life-cycle of container, especially in large environment. Kubernetes is being used, Provisioning and deployment of container Scaling up and removing container to spread application load evenly   Redundancy and availability of container  Movement of container from one host to another resource  Allocation of resource between container Configuration of application in relation to the container running on it. Health monitoring of container and host     2. What is kubernetes ?     Kubernetes is a portable, extensible, open source platform for managing container workload and  services, that facilities both

Kubernetes basic Concepts

Image
This basic concepts helps you to obtain deeper understanding of how kubernetes works. To get better understanding need knowledge of kubernetes API . Kubernetes APIS help to understand the below thing of cluster desired state like, what applications or other workloads you want to run what container images they use the number of replicas what network and disk resources you want to make available This thing achieved by creating kubernetes object using the kubernetes APIS. Object creation is achieved by using the command line interface kubectl. Once we set desired state, the Kubernetes Control Plane makes the cluster's current state match the desired state via the Pod  Life-cycle Event Generator. Kubernetes perform variety of task in Pod Life-cycle generation. Pod Life-cycle Event generation contains tasks. Starting and restarting the containers Scaling the number of given replicas Kubernetes consists of collection of process running on cluster. Kubernetes