jameskillo.blogg.se

Microservices deployment using docker and kubernetes
Microservices deployment using docker and kubernetes







microservices deployment using docker and kubernetes
  1. MICROSERVICES DEPLOYMENT USING DOCKER AND KUBERNETES CODE
  2. MICROSERVICES DEPLOYMENT USING DOCKER AND KUBERNETES DOWNLOAD

FROM openjdk:alpineĪDD target/account-service.jar account-service.jarĮNTRYPOINT Thanks to that our result image will have about ~120MB instead of ~650MB when using standard openjdk as a base image. It is based on the Spring Boot framework but doesn’t use any of Spring Cloud projects except the Feign client. It consists of two modules account-service and customer-service.

MICROSERVICES DEPLOYMENT USING DOCKER AND KUBERNETES CODE

Sample application source code is available on GitHub. We also configure Kubernetes Ingress which acts as a gateway for our microservices. Each pod is exposed as a service and can be searched by name on Kubernetes. Account and customer microservices have their own database where all data is stored. Each microservice’s pod consists of two containers: first with a microservice application and second with a Mongo database. Here’s the picture illustrating the architecture of the presented solution. We do not use the gateway (Zuul) and discovery (Eureka) Spring Boot services, because we have such mechanisms available on Kubernetes out of the box.

microservices deployment using docker and kubernetes

Customer service is interacting with account service while searching for customer accounts. We also have accounts and customer microservices. The concept of microservices architecture for our sample is pretty similar to the concept from my article about continuous delivery with Docker and Jenkins which I mentioned at the beginning of that article. Here’s the Kubernetes Dashboard with the list of deployments for our sample. We can create, update, or delete deployment from the UI dashboard, and also list and view a configuration of all pods, services, ingresses, replication controller,s etc. It can be launched by calling minikube dashboard command. An alternative for the command-line option is Kubernetes Dashboard. Then you can start it from command line using minikube start command and use almost all of Kubernetes features available by calling kubectl command.

microservices deployment using docker and kubernetes microservices deployment using docker and kubernetes

MICROSERVICES DEPLOYMENT USING DOCKER AND KUBERNETES DOWNLOAD

For example on Windows, you have to download minikube.exe and kubectl.exe and add them to PATH environment variable. It can run a single-node cluster inside a VM, which is really important for developers who want to try it out. Fortunately, there is a tool that makes it easy to run Kubernetes locally – Minikube. MinikubeĬonfiguration of highly available Kubernetes cluster is rather not easy task to perform. It is also responsible for pods replacement if the underlying node fails. It handles replication and scaling by running a specified number of copies of a pod across the cluster. Replication Controller – it is specific type of Kubernetes controllers. We can expose it using one of four available behaviors: ClusterIP, NodePort, LoadBalancer and ExternalName. By default, a service is exposed inside a cluster but it can also be exposed onto an external IP address outside your cluster. Service – is a set of pods that work together. Each pod has a unique IP address within the cluster All containers deployed inside the pod can see other containers via the localhost. It can consist of one or more containers that are guaranteed to be co-located on the host machine and share the same resources. There are several important concepts around Kubernetes we should know before going into the sample. It has many features especially useful for applications running in production like service naming and discovery, load balancing, application health checking, horizontal auto-scaling or rolling updates. Kubernetes is an open-source platform for automating deployment, scaling, and operations of application containers across clusters of hosts, providing container-centric infrastructure. Today I’m going to show you one the smart solution which helps us to avoid that problem – Kubernetes. That solution had one big disadvantage – we had to link all containers between each other to provide communication between microservices deployed inside those containers. It was a simple configuration where I decided to use only Docker Pipeline Plugin for building and running containers with microservices. In one of my previous posts, I described an example of a continuous delivery configuration for building microservices with Docker and Jenkins.









Microservices deployment using docker and kubernetes