Docker Kubernete For Training
Docker Kubernete For Training
DOCKER : DEFINE
Docker is a tool that allows developers, sys-admins etc. to easily deploy their
applications in a sandbox (called containers) to run on the host operating system i.e.
Linux.
The key benefit of Docker is that it allows users to package an application with all
of its dependencies into a standardized unit for software development.
Unlike virtual machines, containers do not have high overhead and hence enable
more efficient usage of the underlying system and resources.
Docker is a tool designed to make it easier to create, deploy, and run
applications by using containers.
CONTAINERS : DEFINE
Containers allow a developer to package up an application with all of the parts it needs,
such as libraries and other dependencies, and ship it all out as one package.
Create self-contained development environments inside Docker containers.
So we share an environment already configured.
IMAGE : DOCKER
An image is a lightweight, stand-alone, executable package that includes
everything needed to run a piece of software, including the code, a runtime,
libraries, environment variables, and config files.
So an existing fellow developer will create an image of his environment and share it
with the new developer.
The new developer will just have to run the image as a docker container.
IMAGE & CONTAINER : DOCKER
CASE STUDY: DOCKER
A container is a runtime instance of an image what the image becomes in memory when
actually executed.
It runs completely isolated from the host environment by default, only accessing host files
and ports if configured to do so.
DOCKER : CASE STUDY
DEPLOYING MULTIPLE SPRING BOOT
MICROSERVICES TO DOCKER USING
DOCKER NETWORKING
DEPLOYING MULTIPLE SPRING BOOT
MICROSERVICES TO DOCKER USING
DOCKER NETWORKING
A Docker Container should have only a
single service running.
Deploying two microservices employee-
producer and employee-consumer to two
different containers and then have them
interact with each other.
DOCKER COMPOSE
Docker Compose is a tool for defining and running multi-container Docker applications.
With Compose, you use a YAML file to configure your application's services.
Then, with a single command, you create and start all the services from your
configuration.
Nodes host the containers; in-fact these Containers are grouped logically to form Pods.
Each node can run multiple such Pods, which are a group of containers, that interact with each other, for a
deployment.
Replication Controller is Master’s resource to ensure that the requested no. of pods are
always running on nodes.
Service is an object on Master that provides load balancing across a replicated group of
Pods.
KUBERNETES ARCHITECTURE
Kubernetes Architecture
has the following main components:
Master nodes
Worker/Slave nodes
Distributed key-value store
KUBERNETES CASE-STUDY
Solution:
container workflow
OpenStack instances are used, with Docker, Kubernetes, Calico, etcd on top of it to perform
various operations like Container Networking, Container Registry, and so on.
SETTING UP KUBERNETES
(K8S) ON WINDOWS
Install Cygwin
Install MiniKube
Install Kubectl
Install Oracle Virtual box
VIEWING PODS AND NODES
Kubernetes Pods
Pods are the atomic unit on the Kubernetes platform.
When we create a Deployment on Kubernetes, that Deployment creates Pods with containers inside
them (as opposed to creating containers directly).
Each Pod is tied to the Node where it is scheduled, and remains there until termination (according
to restart policy) or deletion.
In case of a Node failure, identical Pods are scheduled on other available Nodes in the cluster.
VIEWING PODS AND NODES
Nodes
A Pod always runs on a Node.
A Node is a worker machine in Kubernetes and may be either a virtual or a physical machine,
depending on the cluster.
Each Node is managed by the Master. A Node can have multiple pods, and the Kubernetes master
automatically handles scheduling the pods across the Nodes in the cluster.
The Master's automatic scheduling takes into account the available resources on each Node.
VIEWING PODS AND NODES
Nodes
Every Kubernetes Node runs at least:
Kubelet, a process responsible for communication
between the Kubernetes Master and the Node; it
manages the Pods and the containers running on a
machine.
A container runtime (like Docker, rkt) responsible
for pulling the container image from a registry,
unpacking the container, and running the
application.
TUTORIAL TO RUN A
SAMPLE APP ON
KUBERNETES
If you installed Minikube locally, run :
USING
MINIKUBE
minikube start
check :
minikube status
minikube dashboard
TUTORIAL TO RUN A
SAMPLE APP ON
KUBERNETES USING
Create a Deployment
MINIKUBE
--------------------------------
A Kubernetes Pod is a group of one or more Containers, tied together for the purposes of administration and
networking.
The Pod here has only one Container.
A Kubernetes Deployment checks on the health of your Pod and restarts the Pod's Container if it terminates.
Use the kubectl create command to create a Deployment that manages a Pod.
The Pod runs a Container based on the provided Docker image.