Containers are changing development and deployment using technologies like Docker and Kubernetes. Containers leverage cgroups and namespaces in Linux kernels to isolate processes and share resources without full virtual machines. Docker popularized containers by making them easy to build, run and share. Kubernetes is the most popular container orchestrator, allowing containers to run together across clusters with services for load balancing, scaling and failover. Developers can now develop in containers for consistent environments, while operations teams can deploy containerized applications with automation and roll back updates if needed.
5. Virtualization
● Virtualization was around since decades
● But it got popular only in 2000s
● Lack of interest from hardware vendors
● Chip manufacturers saw the market opportunity
● Club that with cheapest OS platform adding support
6. Containers
● First available in Solaris and BSD
● Came to Linux somewhat later
● Docker made them really easy
● In a way, Linux and Docker made them popular
9. Linux Containers
● Linux Kernel provides cgroups and namespaces
● cgroups help limit the resource consumption without a VM
● namespaces help completely isolate the process
● Combination of these two helps create containers
● Containers have been around since a long time
● Google says it runs everything in containers since decade+
10. Containers vs. VMs
Containers
● Use kernel of the host
● Contains only application binaries
and dependencies
● Lesser attack surface
● Can be spun up and ready to use in
milliseconds
● Container images are generally of
smaller size (in MBs)
Virtual Machines
● Have a kernel of their own
● Contains entire OS along with
application binaries and deps
● Higher attack surface
● Takes seconds or minutes before
being fully usable
● ISOs are generally more than 1 GiB
in size
12. Docker
● Started out as “dotCloud” PaaS company
● Made the containers and related things easy-to-use
● De facto container runtime for a long time
● Now a tool to build images, manage containers, orchestrate, etc.
● Open-source project contributed to by many in the industry
● Open-source now under “Moby Project”
14. Why container orchestration?
● Say you have a web app with a database
● You’d want a container to be able to reliably talk with the other
● You’d want to have multiple replicas running
● You’d want to load balance it
● You’d want to distribute them across different systems
● One instance of some container shouldn’t take entire app down
16. Kubernetes (k8s)
● Started at Google and later open-sourced
● Most popular container orchestration tool
● Orchestration tool helps run containers in production
● Code contributions from most major organizations
● Very nice community
● Distributions for cloud, hybrid and on-prem deployments
● minikube for developers
17. Kubernetes Features
● Groups containers into pods
● Container auto-scaling
● Provides basic load balancing OOTB
● Canary deployments
● Health checks
● Documentation
18. Kubernetes Distributions
● Google Kubernetes Engine
● Amazon ECS
● CoreOS Tectonic
● OpenShift by Red Hat
● StackPoint
● … much more!
20. Development with Containers
● Pack binaries and artifacts in the container image
● Expose required functionality/ports of container
● Take the same image and run a container anywhere*
● Overruled “works on my laptop” argument to a great extent
● One container supposed to do only one thing (UNIX philosophy)
* physical/virtual machine, any distro, any cloud
21. Developer workflow
● Every dev is working on their fork of the code
● Before merging into main repo, it goes through automated tests
● Tests happen on environment similar to production
● Container images are created, tagged and pushed
● Quick feedback loop on the tests
● Also called Continuous Integration (CI of CI/CD)
● Great piece written by Martin Fowler
22. Deployment with Containers
● Automation FTW but one of the most critical part
● Ops teams deploy code multiple time a day
● Inter-container communication has to be smooth
● Blue-Green deployments becoming popular
● Rollback in case something blows up
● All these is easier said than done
24. Monoliths
● Single WAR file that runs everything
● Seems perfect initially till the time it becomes huge
● CI/CD can take long time as size increases
● Scaling can become an issue
● In short all issues you can imagine related with larger size
25. Microservices
● Break service down into pieces: database, API, front-end, etc.
● Specialized frameworks can be used for tasks
● Individual services can be scaled up/down
● APIs can be reused by other services
27. Tools
● Git for version controlling the code
● Jenkins, Travis for CI
● Docker, Buildah to create containers
● OpenShift for deployment and built-in CI/CD mechanism
● Elastic, Logstash, Kibana for logging aggregation
● Prometheus, Zabbix for monitoring
● … much more!
28. Learn more!
Join these and more
communities to learn and/or
share!
● Kubernetes Ahmedabad
● Docker Ahmedabad
● Ansible Ahmedabad
● DigitalOcean Ahmedabad
29. About Me
● Engineer @ Red Hat
● Love building tech
communities, sharing
knowledge and organizing
+ speaking at meetups
● Twitter: @dharm1t
Web: dharmitshah.com
30. Resources
● Google Borg
● Continuous Integration - Martin Fowler (ThoughtWorks)
● Continuous Deployment - Viktor Farcic (Cloudbees)
● Kubernetes Documentation
● Docker
● Buildah
● OpenShift by Red Hat
● All Kubernetes distributions
● Containers are Linux