Kubernetes: від знайомства до використання у CI/CD
Олександр Занічковський
Technical Lead у компанії SoftServe
14+ років досвіду розробки різноманітного програмного забезпечення, як для десктопа, так і для веб
Працював фріланс-програмістом та в команді
Цікавиться архітектурою ПЗ, автоматизацією процесів інтеграції та доставки нових версій продукту, хмарними технологіями
Віднедавна займається менторінгом майбутніх техлідів
У вільний від роботи час грає на гітарі і мріє про велику сцену
Олександр поділиться власним досвідом роботи з Kubernetes:
ознайомить з базовими поняттями та примітивами K8S
опише можливі сценарії використання Kubernetes для CI/CD на прикладі GitLab
покаже, як можна використовувати постійне сховище, збирати метрики контейнерів, використовувати Ingress для роутинга запитів за певними правилами
покаже, як можна самому встановити K8S для ознайомлення чи локальної роботи
2. Oleksandr Zanichkovskyi
PHP Technical Lead with 14+ years of experience.
Interested in clean code, good architecture, cloud
computing, development processes automation and
playing the guitar of course
Email: eternity.lviv@gmail.com
Skype: olexandr.zanichkovsky
FB: https://www.facebook.com/ozanichkovskyi
3. Why should containers be used?
What is Kubernetes
Kubernetes Architecture
Kubernetes Primitives
Installing Kubernetes
Additional Tools
Automating DevOps with Kubernetes
GitLab and Kubernetes integration
Agenda
7. What is container?
“A container image is a lightweight, stand-alone, executable package
of a piece of software that includes everything needed to run it: code,
runtime, system tools, system libraries, settings. … containerized
software will always run the same, regardless of the environment.
Containers isolate software from its surroundings, for example
differences between development and staging environments and help
reduce conflicts between teams running different software on the
same infrastructure.”
https://docker.com/what-container
27. Origins
• First announced by Google in mid-2014
• Kubernetes v1.0 was released in mid-2015
• Written in Go/Golang
• https://github.com/kubernetes/kubernetes
• Often shortened to k8s
28. What is Kubernetes?
• We treat cluster of number of servers as single computer
• We do not want to decide what server to put each app part on
• We just want to let the cluster know the desired state in simple
unified format
• Up to:
• 5000 nodes
• 150000 total pods
• 300000 total containers
• 100 pods per node
29. Benefits
• Agile application creation and deployment: Increased ease and efficiency of container image creation compared to VM image use.
• Continuous development, integration, and deployment: Provides for reliable and frequent container image build and deployment with quick
and easy rollbacks (due to image immutability).
• Dev and Ops separation of concerns: Create application container images at build/release time rather than deployment time, thereby decoupling
applications from infrastructure.
• Environmental consistency across development, testing, and production: Runs the same on a laptop as it does in the cloud.
• Cloud and OS distribution portability: Runs on Ubuntu, RHEL, CoreOS, on-prem, Google Kubernetes Engine, and anywhere else.
• Application-centric management: Raises the level of abstraction from running an OS on virtual hardware to run an application on an OS using
logical resources.
• Loosely coupled, distributed, elastic, liberated micro-services: Applications are broken into smaller, independent pieces and can be deployed
and managed dynamically – not a fat monolithic stack running on one big single-purpose machine.
• Resource isolation: Predictable application performance.
• Resource utilization: High efficiency and density.
30. Do I need Kubernetes?
• Health checks
• Replicating instances
• Rolling updates
• Accessing container logs
• Service discovery
• Load balancing
31. Is it difficult to use?
• Different kinds of
resources
• Descriptive YAML
• Easy to use API
• Custom resources
• Helm as package
installer
34. Master
API Server
Component on the master that exposes the
Kubernetes API. It is the front-end for the Kubernetes
control plane.
etcd Consistent and highly-available key value store used
as Kubernetes’ backing store for all cluster data.
kube-scheduler
Component on the master that watches newly created
pods that have no node assigned, and selects a node
for them to run on.
kube-controller-manager Component on the master that runs controllers.
35. Node
Kubelet
An agent that runs on each node in the cluster. It
ensures that the containers on particular Node are
running and healthy.
Container Engine
The container runtime is the software that is
responsible for running containers. Kubernetes
supports several runtimes: Docker, rkt, runc
kube-proxy
Enables the Kubernetes service abstraction by
maintaining network rules on the host and performing
connection forwarding.