KUBERNETES
FOR DEVELOPERS
Denis Romaniuk
Denis Romaniuk
➔ Private and Public Cloud
➔ Dedicated and Managed servers
➔ Content Delivery Network (CDN)
➔ Servers management and Colocation
➔ DevOps as a service
➔ Managed Kubernetes (alpha-version)
➔ Managed Load Balancer (coming soon)
AdvancedHosting
Custom infrastructure for highload projects
We use modern equipment, apply cutting-edge
technologies, and ensure quality control to save
time on technical aspects when working on the
project.
We design, create, and support infrastructure
tailored to your specific needs, allowing you to
concentrate on your business development.
We help businesses cover all their needs in
infrastructure services: from servers to fast
content delivery worldwide.
Denis Romaniuk
Table of contents
Kubernetes for developers
1. Motivation
2. Evolution
3. Components
4. Helm
5. Installation
6. Local development
7. CRD and Operators
Denis Romaniuk
Motivation
Denis Romaniuk
DevOps
Development
Operations QA
Denis Romaniuk
Why do developers need Kubernetes?
● In-team relations
● Kubernetes is successor to Docker
● Kubernetes-native apps development
● Unified interface for any infrastructure
Denis Romaniuk
Evolution
Denis Romaniuk
Some project
Denis Romaniuk
Some project
Denis Romaniuk
Some project
Denis Romaniuk
Some project
Denis Romaniuk
Some project
Denis Romaniuk
Some project
Denis Romaniuk
Some project
Denis Romaniuk
Some project
Denis Romaniuk
Some project
Denis Romaniuk
Some project
Denis Romaniuk
Some project
Denis Romaniuk
Kubernetes
Kubernetes
Denis Romaniuk
Kubernetes
Worker node
Master node
Denis Romaniuk
Kubernetes
Worker node
Master node
Denis Romaniuk
Nodes
Worker node
Master node
Denis Romaniuk
Nodes
Worker node
Master node
Denis Romaniuk
Cloud
Nodes
Worker node
Master node
Denis Romaniuk
Nodes
Cloud
NodeGrou
p
Worker node
Master node
Denis Romaniuk
Components
Denis Romaniuk
Pods
≈
Denis Romaniuk
Pods ≈
Denis Romaniuk
docker
User Interface
High-level
library
Low-level
library
Container
● manages and runs
containers
● pushes and pulls images
● manages storage
● manages networking
● supervises the running of
containers
● actually creates and runs
containers
● intercommunicate with
user
containerd
docker-cli runc cgroups
Denis Romaniuk
kubernetes
● manages and runs
containers
● pushes and pulls images
● manages storage
● manages networking
● supervises the running of
containers
● actually creates and runs
containers
● intercommunicate with
user
containerd
docker-cli runc cgroups
kubernetes
Denis Romaniuk
kubernetes
● manages and runs
containers
● pushes and pulls images
● manages storage
● manages networking
● supervises the running of
containers
● actually creates and runs
containers
containerd runc cgroups
kubernetes 1.20+
Denis Romaniuk
Denis Romaniuk
Pods ≈
Denis Romaniuk
Pods
OS Kernel
Container
MySQL
Container
Backend
Denis Romaniuk
OS Kernel
Container
MySQL
Container
Backend
Pods
/var/www/uploads
/user/.my.cnf
/var/www/.my.cnf
/var/lib/mysql
Denis Romaniuk
Volume
● EmptyDir
● ConfigMap
● Secret
● PersistentVolume
/var/www/uploads
.my.cnf
/var/lib/mysql
Denis Romaniuk
Volume
● EmptyDir
● ConfigMap
● Secret
● PersistentVolume
.my.cnf /var/www/uploads
/var/lib/mysql
file
https://stackoverflow.com/a/36925553/7427923
https://learn.hashicorp.com/tutorials/vault/kubernetes-external-vault
https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/
Denis Romaniuk
Volume
● EmptyDir
● ConfigMap
● Secret
● PersistentVolume
.my.cnf /var/www/uploads
/var/lib/mysql
Denis Romaniuk
Mode:
● ReadWriteOnce
● ReadOnlyMany
● ReadWriteMany
User Admin
PersistentVolume
Size:
● 1 GiB
● 10 GiB
● 100 GiB
StorageClass:
● hdd
● ssd
● nvme
Denis Romaniuk
● 10 GiB
● RWO
● ssd
Mode:
● ReadWriteOnce
● ReadOnlyMany
● ReadWriteMany
PersistentVolume
Size:
● 1 GiB
● 10 GiB
● 100 GiB
StorageClass:
● hdd
● ssd
● nvme
Denis Romaniuk
Controllers
Denis Romaniuk
ReplicaSet
Denis Romaniuk
Recreate
Deployment
app
app-d8sje04kvl app-89dff34kjp app-54k18dfjg8
app-54k18dfjg8-fd17e
app-54k18dfjg8-9fdj4
app-54k18dfjg8-0fk3s
app-d8sje04kvl-f4s6e
app-d8sje04kvl-l8fhj
app-d8sje04kvl-j73b6
app-89dff34kjp-s85jd
app-89dff34kjp-ki87d
app-89dff34kjp-g36dl
Rolling Update
v0.5 v0.6 v0.7
Denis Romaniuk
Job
exitcode=0
restartPolicy=Always
restartPolicy=Never
Denis Romaniuk
CronJob
0 0 * * *
Denis Romaniuk
DaemonSet
Denis Romaniuk
10.102.104.208
None
my-svc.my-namespace.svc.cluster-domain.example
192.168.104.202
192.168.166.73
192.168.173.197
192.168.197.199
192.168.213.138
Service
my-service
my-service
app=MyApp
A/AAAA
ClusterIP
A/AAAA
Denis Romaniuk
StatefulSet
database-0.db-headless-svc.namespace.svc.cluster-domain.example
database-0
database-1
database-2
app-89bbf95dfc-cslnd
app-89bbf95dfc-2dsq8
app-89bbf95dfc-hznm9
app-89bbf95dfc
app
database
A/AAAA
Denis Romaniuk
StatefulSet
database-0
database-1
database-2
app-89bbf95dfc-cslnd
app-89bbf95dfc-2dsq8
app-89bbf95dfc-hznm9
app-89bbf95dfc
app
database
Denis Romaniuk
StatefulSet
Denis Romaniuk
Ingress
Physical Layer
Data Link Layer
Network Layer
Transport Layer
Session Layer
Presentation Layer
Application Layer
https://example.com/
192.168.68.91
192.168.71.15
https://example.com/blog 192.168.95.11
https://example.com/shop
192.168.68.15
192.168.71.23
192.168.95.40
TCP/UDP
HTTP
10.0.151.16
192.168.68.91
192.168.71.15
10.0.58.20 192.168.95.11
10.0.214.76
192.168.68.15
192.168.71.23
192.168.95.40
Denis Romaniuk
192.168.68.91
192.168.71.15
192.168.68.15
192.168.71.23
IngressController
Ingress
https://example.com/
https://example.com/shop
Ingress 192.168.68.91
192.168.71.15
192.168.68.15
192.168.71.23
Denis Romaniuk
Helm
Denis Romaniuk
Some project
php-fpm
nginx
mysql redis
IngressController
Denis Romaniuk
Some project
php-fpm
nginx
mysql redis
IngressController
Denis Romaniuk
Some project
php-fpm
nginx
mysql redis
IngressController
Denis Romaniuk
Some project
php-fpm
nginx
mysql redis
IngressController
nginx-we8df0d3-fj9d3 nginx-we8df0d3-8gj47
php-fpm-kf8dp439-mfg70 php-fpm-kf8dp439-d7n34
mysql-0 mysql-1
redis-1 redis-0
ingress-controller-89fsd
Denis Romaniuk
Some project
php-fpm
nginx
mysql redis
nginx-we8df0d3-8gj47
php-fpm-kf8dp439-d7n34
mysql-1 redis-0
IngressController
Denis Romaniuk
Some project
php-fpm
nginx
mysql redis
nginx-we8df0d3-8gj47
php-fpm-kf8dp439-d7n34
mysql-1 redis-0
nginx
php-fpm
mysql
redis
ingress
nginx-we8df0d3-fj9d3
php-fpm-kf8dp439-mfg70
mysql-0 redis-1
Denis Romaniuk
Manifests
Some project
Resources
Workload
nginx-we8df0d3-8gj47
php-fpm-kf8dp439-d7n34
mysql-1 redis-0
nginx
php-fpm
mysql
redis
ingress
nginx-we8df0d3-fj9d3
php-fpm-kf8dp439-mfg70
mysql-0 redis-1
Denis Romaniuk
Some project
nginx
php-fpm
mysql
redis
ingress
Denis Romaniuk
Manifests
Some project
nginx
php-fpm
mysql
redis
ingress
=
values.yaml
+
golang
template
Denis Romaniuk
Users
namespace
release name
Helm
+
golang
template
values.yaml
=
helm-chart
+
values.yaml
= Manifests
Release
parameters
+
Vendors
Denis Romaniuk
Helm
+
golang
template
values.yaml
=
helm-chart
+
values.yaml
= Manifests
Release
parameters
+
Source code Config Profit
Artifact
Denis Romaniuk
Installation
Denis Romaniuk
K8S update
logging/monitoring
auth/security
Cloud-native solutions
Manifests deployment (incl. Helm)
CRI, CNI, CSI, etc...
API-server, etcd, kubelets
VPS and private networks
Denis Romaniuk
Cloud-native solutions
Denis Romaniuk
Cloud-native solutions
Denis Romaniuk
Development solutions
Production Development
Scale
Availability
Access
Denis Romaniuk
Development solutions
minikube
● Kubernetes community
● OS-agnostic
● Creates VM or Container
microk8s
● Canonical community
● OS-agnostic
○ Snap store
● Uses process manager
k3s
● Rancher community
● Linux
○ Platform-agnostic
● Embeded-binaries
Denis Romaniuk
Local development
Denis Romaniuk
https://github.com/dromaniuk/fwdays-hello-world
Denis Romaniuk
CRD and Operators
Denis Romaniuk
cert-manager
Order Challenge
Certificate
Issuer
CertificateRequest
CSR-request ACME certificate order
HTTP challenge
DNS challenge
Operator
Denis Romaniuk
Vanilla kubernetes objects
Custom Resource Definitions ACME Only
cert-manager
Order
Certificate
Issuer
CertificateRequest
Operator
Challenge
Denis Romaniuk
Want to be the first to
get the alpha-version?
Contact us right now!
Also, you can get a ready solution for
your project. We are always ready to
provide our products for free trial.
advancedhosting.com
Nikolay Yavorovskyi
Product Manager
live:ah.002022
ahnick
nikolay.yavorovskyi@advanced.host

"[WORKSHOP] K8S for developers", Denis Romanuk