Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
NUS-ISS Learning Day 2018- Deploying a microservices app using docker and kubernetes
1. Deploy and Manage Containers
on K8S
http://bit.ly/docker_k8s_talk
Prasanna Veerapandi (bala)
bala@nus.edu.sg
2. About me
Now
- Lecturer at Institute of System Science
- Creates and teaches
- Python For Data, Ops and Things
- Cloud DevOps Foundation
- Containers for Deploying and Scaling Apps
Past
- Application consultant - Web Application development & DevOps
- Mobile Application Developer
5. Virtual Machines
Server
Host OS
Hypervisor (type 2)
Guest
OS
Run
time
App
#0
Guest
OS
Run
time
App
#0
Guest
OS
Run
time
App
#1
Virtualmachines
VMs virtualizes the hardware
7. LXC Enabling Technologies
Namespaces - isolation
- Virtualizes Linux resources (process, network, filesystem, etc) for one or
more processes
- Analogy: Java packages, XML namespaces
CGroups - resource limits
- Hard and soft limit on resources eg. CPU shares, memory, bandwidth, etc
Overlay filesystem - bottom of the well view
- Provides a unified view of multiple directories by transparently
overlaying and merging them
11. Cloning and Customizing the App
- Create an application directory
- Copy the files over to the new directory
- package.json - application manifest
- Files and directories
- (Re)Install the required libraries
- Customize the content
15. Space and Volumes
- Containers are ephemeral
- Any files you create in the container will be gone once you remove
the container
- Mapping host directory into the container
- Sharing of common data
- Creating and saving artifacts
- Mapping a container’s volume into another container
- Data only container eg database
- Mapping storages into a container
- Data from NFS, other drives
18. Growing Big
The picture can't be displayed.
Servers with Docker Loadbalancer
The picture can't be displayed. The picture can't be displayed. The picture can't be displayed.
19. But…
Need to setup environment
Deal with hardware and software failures
Keeping services up and monitoring them
Build a infrastructure framework to deal with deployments
…
20. The picture can't be displayed.
The picture can't be displayed.
The picture can't be displayed.
The picture can't be displayed.
The picture can't be displayed.
“Ops”
Servers
“Dev”
Applications
The picture can't be displayed.
22. What is Kubernetes?
A container cluster management system
- Manage Docker, rkt
Support applications by providing the following
- scaling/replication, load balancing, rolling updates,
health checks, services discovery, etc.
Alternatives
- Docker Swarm, Mesos Marathon, Fleet
23. Kubernetes Architecture (vastly simplified)The picture can't be displayed.
The picture can't be displayed.
The picture can't be displayed.
Kubernetesnodes
Kuberneres
Master
Kublet
kubectl
24. POD - a deployable unit of container(s)
localhost:3306
MySQL
database
Payara
Application Server
NodeJS
25. Deployment
kubectl run deployment/kapps --image=chukmunnlee/kapps:latest
--port=3000
Creates and schedules a pod
onto a node in the cluster
The picture can't be displayed.The picture can't be displayed. The picture can't be displayed.
3000
27. Services
kubectl expose deployment/kapps --port=8080 --target-port=3000
Provides location and
referential transparency by
providing a stable IP address
The picture can't be displayed.The picture can't be displayed. The picture can't be displayed.
3000
8080
28. Scaling
kubectl scale deployment/kapps --replicas=3
Replication controller resolves
differences between declared
and actual
The picture can't be displayed.The picture can't be displayed. The picture can't be displayed.
3000
8080
3000 3000