Se ha denunciado esta presentación.
Utilizamos tu perfil de LinkedIn y tus datos de actividad para personalizar los anuncios y mostrarte publicidad más relevante. Puedes cambiar tus preferencias de publicidad en cualquier momento.

[WSO2Con Asia 2018] Deploying Applications in K8S and Docker

182 visualizaciones

Publicado el

Sanjaya discusses best practices of deploying application in Docker and Kubernetes while discussing Docker and Kubernetes concepts.

Publicado en: Tecnología
  • Sé el primero en comentar

[WSO2Con Asia 2018] Deploying Applications in K8S and Docker

  1. 1. Technical Lead, WSO2 Deploying Applications in K8S and Docker Sanjaya Ratnaweera
  2. 2. Evolution of Application Deployment Bare Metal
  3. 3. Evolution of Application Deployment Virtual Machines
  4. 4. Evolution of Application Deployment Deploy as a Container
  5. 5. Docker Docker provides an easy-to-use packaging model to bundle the application
  6. 6. Running apps on a VM vs Docker Container Infrastructure Virtual Machines
  7. 7. Running apps on a VM vs Docker Container Infrastructure Virtual Machines Host OS
  8. 8. Running apps on a VM vs Docker Container Infrastructure Virtual Machines Host OS Hypervisor
  9. 9. Running apps on a VM vs Docker Container Infrastructure Virtual Machines Host OS Hypervisor Guest OS Guest OS Guest OS Guest OS
  10. 10. Running apps on a VM vs Docker Container Infrastructure Virtual Machines Host OS Hypervisor Guest OS Guest OS Guest OS Guest OS bins/libs bins/libs bins/libs bins/libs
  11. 11. Running apps on a VM vs Docker Container Infrastructure Virtual Machines Host OS Hypervisor Guest OS Guest OS Guest OS Guest OS bins/libs bins/libs bins/libs bins/libs App App App App
  12. 12. Running apps on a VM vs Docker Container Infrastructure Virtual Machines Host OS Hypervisor Guest OS Guest OS Guest OS Guest OS bins/libs bins/libs bins/libs bins/libs App App App App Infrastructure Docker Containers
  13. 13. Running apps on a VM vs Docker Container Infrastructure Virtual Machines Host OS Hypervisor Guest OS Guest OS Guest OS Guest OS bins/libs bins/libs bins/libs bins/libs App App App App Infrastructure Host OS Docker Containers
  14. 14. Running apps on a VM vs Docker Container Infrastructure Virtual Machines Host OS Hypervisor Guest OS Guest OS Guest OS Guest OS bins/libs bins/libs bins/libs bins/libs App App App App Infrastructure Host OS Docker Daemon Docker Containers
  15. 15. Running apps on a VM vs Docker Container Infrastructure Virtual Machines Host OS Hypervisor Guest OS Guest OS Guest OS Guest OS bins/libs bins/libs bins/libs bins/libs App App App App Infrastructure Host OS Docker Daemon bins/libs bins/libs bins/libs bins/libs Docker Containers
  16. 16. Running apps on a VM vs Docker Container Infrastructure Virtual Machines Host OS Hypervisor Guest OS Guest OS Guest OS Guest OS bins/libs bins/libs bins/libs bins/libs App App App App Infrastructure Host OS Docker Daemon bins/libs bins/libs bins/libs bins/libs App App App App Docker Containers
  17. 17. Reality However in many cases, a single container is not enough to run an application
  18. 18. K8S Kubernetes is an open source container orchestration system that helps to automate deployment, scaling, and management of containerized applications.
  19. 19. K8S Architecture (From Above 5000 ft)
  20. 20. K8S Core Primitive
  21. 21. 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
  22. 22. 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
  23. 23. 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
  24. 24. 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
  25. 25. 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
  26. 26. 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
  27. 27. 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
  28. 28. Services are assumed L4 Ingress in L7 Ingress maps HTTP/HTTPS incoming traffic to backend services ● By host headers ● By URL paths K8S Ingress
  29. 29. K8S Rolling Update
  30. 30. K8S Rolling Update
  31. 31. K8S Rolling Update
  32. 32. K8S Rolling Update
  33. 33. K8S Rolling Update
  34. 34. K8S Rolling Update
  35. 35. K8S Rolling Update
  36. 36. K8S Rolling Update
  37. 37. 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
  38. 38. 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
  39. 39. 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
  40. 40. 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
  41. 41. Demo: Hello World with kubectl
  42. 42. ● Draft ● Gitkube ● Helm ● Ksonnet ● Skaffold ● Metaparticle ● Ballerina Tools and framework for K8S
  43. 43. ● 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
  44. 44. ● 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
  45. 45. ● 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
  46. 46. ● 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
  47. 47. ● 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
  48. 48. ● 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
  49. 49. ● 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.
  50. 50. Demo: Metaparticles with K8S
  51. 51. Demo: Ballerina with K8S
  52. 52. ● https://kubernetes.io/docs/concepts ● https://www.youtube.com/watch?v=A4A7ybtQujA ● https://www.slideshare.net/DanielSmith272/whats-new-in- kubernetes ● https://blog.hasura.io/draft-vs-gitkube-vs-helm-vs-ksonne t-vs-metaparticle-vs-skaffold-f5aa9561f948 References
  53. 53. THANK YOU wso2.com

×