In this slide deck, Lakmal discusses best practices for deploying applications in Docker and Kubernetes while discussing Docker and Kubernetes concepts.
7. K8S
Kubernetes is an open source
container orchestration system that
helps to automate deployment,
scaling, and management of
containerized applications.
10. Small group of containers and
volume
Tightly coupled
● The atom of replication
and placement
Logical host for containers
● Echo pod get an IP address
● Share data: localhost,
volume, IPC, etc.
K8S POD
11. Storage automatically
attached to a Pod
● Local storage
● Cloud block storage
○ AWS EBS, GCE persistent
● Cluster storage
○ NSF, Gluster
○ iSCSI, Cinder
● Special volumes
○ Git repo, secret
K8S Volume
12. Ensures N copies of Pod
● If too few, start new one
● If too many, kill some
Enables self-healing
Facilitates auto scaling
K8S Replication Controller
13. Group of pods thats work
together
DNS name
Load balanced: name map to
a stable virtual IP
Decoupled from Pods and
Replication controllers
K8S Service
14. Secrets: Tokens, credentials,
certs, etc.
Don’t put them in a container
image.
Inject them as virtual volume
into pods
● Not backed into images
nor pod config
● Kept in memory, never
touches disk
K8S Secret
15. Multi tenancy in K8S
is namespace has its own
● Resources (Pods, Services,
etc.)
● Policies (who can or
cannot perform an action
in their tenancy)
● Constrain (how much
quota, etc.)
K8S Namespace
16. 12-factor says config comes
from the environment.
● Should not be baked into
Docker image
ConfigMap inject config as a
virtual volume into the Pods
● Late binding, live update
(atomic)
● Also available as env vars
K8S ConfigMap
17. Services are assumed L4
Ingress in L7
Ingress maps HTTP/HTTPS
incoming traffic to backend
services
● By host headers
● By URL paths
K8S Ingress
26. Rolling update too imperative
Deployment manage RC
changes for you
● Kubectl edit /apply is all
you need
Aggregate stats
Can have multiple updates
inflight
K8S Deployment
27. How to run pod in every
node? Or subset of nodes?
Daemonset
● Like ReplicationController
● Do one thing
● Don’t overload
Which node is a selector
K8S Daemonset
28. Give Pods time to clean up
Catch SIGTERM, clean-up exit
ASAP
Pods status Terminating
30 seconds by default
● Finish inflight operation
● Flush to disk
● Log state
K8S Graceful Termination
29. Automatically scale RCs to a
target utilization
● CPU utilization for now
Operate within user-defined
min/max bound
Set it and forget it
K8S Horizontal Pod Autoscaler
31. ● Draft
● Gitkube
● Helm
● Ksonnet
● Skaffold
● Metaparticle
● Ballerina
Tools and framework for K8S
32. ● Draft
● Gitkube
● Helm
● Ksonnet
● Skaffold
● Metaparticle
● Ballerina
Tools and framework for K8S
● deploy code to k8s cluster (automates
build-push-deploy)
● deploy code in draft-pack supported
languages without writing dockerfile or
k8s manifests
● needs draft cli, helm cli, tiller on cluster,
local docker, docker registry
33. ● Draft
● Gitkube
● Helm
● Ksonnet
● Skaffold
● Metaparticle
● Ballerina
Tools and framework for K8S
● deploy code to k8s cluster (automates
build-push-deploy)
● git push to deploy, no dependencies on
your local machine
● needs dockerfile, k8s manifests in the
git repo, gitkube on cluster
34. ● Draft
● Gitkube
● Helm
● Ksonnet
● Skaffold
● Metaparticle
● Ballerina
Tools and framework for K8S
● deploy and manage charts (collection
of k8s objects defining an application)
on a k8s cluster
● ready made charts for many common
applications, like mysql, mediawiki etc.
● needs helm cli, tiller on cluster, chart
definition locally or from a repo
35. ● Draft
● Gitkube
● Helm
● Ksonnet
● Skaffold
● Metaparticle
● Ballerina
Tools and framework for K8S
● define k8s manifests in jsonnet, deploy
them to k8s cluster
● reusable components for common
patterns and stacks, like
deployment+service, redis
● needs jsonnet knowledge, ksonnet cli
36. ● Draft
● Gitkube
● Helm
● Ksonnet
● Skaffold
● Metaparticle
● Ballerina
Tools and framework for K8S
● deploy code to k8s cluster (automates
build-push-deploy)
● watches source code and triggers
build-push-deploy when change
happens, configurable pipeline
● needs skaffold cli, dockerfile, k8s
manifests, skaffold manifest in folder,
local docker, docker registry
37. ● Draft
● Gitkube
● Helm
● Ksonnet
● Skaffold
● Metaparticle
● Ballerina
Tools and framework for K8S
● deploy your code in metaparticle
supported languages to k8s
(automates build-push-deploy)
● define containerizing and deploying to
k8s in the language itself, in an
idiomatic way, without writing
dockerfile or k8s yaml
● needs metaparticle library for
language, local docker
38. ● Draft
● Gitkube
● Helm
● Ksonnet
● Skaffold
● Metaparticle
● Ballerina
Tools and framework for K8S
● Generate docker images, k8s artifacts
depending on annotation defined in
the code.
● Support many Kubernetes
functionalities like; all kind of
Kubernetes services, deployment,
ingress, secrets, persistent volumes,
config maps, liveness probe and
horizontal pod autoscaling.