Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

From Code to Kubernetes

1,055 views

Published on

Slides from the talk given to the Startup Berlin Slack Group that demonstrates how TruckIN is implementing its continuous delivery workflow using technologies and open-source tools.
Topics that are covered: Automated Cloud Provisioning (Network, Subnets, VMs, Kubernetes Cluster, Firewall, Disks, Credentials, Private Docker Registry); Configuration Management (Salt Stack), Continuous Integration (Jenkins CI), Continuous Delivery/Deployment (Salt API/Reactor + Kubernetes) to a Google Cloud Kubernetes Cluster, Remote Application Debugging, Managing Google Cloud Kubernetes Cluster, Logging, Monitoring and ChatOps (Slack and operable.io)

Published in: Software
  • Hello! Get Your Professional Job-Winning Resume Here - Check our website! https://vk.cc/818RFv
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

From Code to Kubernetes

  1. 1. From Code to Kubernetes
  2. 2. About Us Art Richards CTO - truckin.io
  3. 3. About Me Daniel Oliveira Devops Engineer danieloliv79 danieloliveira079 daniel@truckin.io
  4. 4. Agenda
  5. 5. ● Scenario and Architecture ● Technologies ● Challenges ● Results ● Foundations ● Infrastructure as Code ● Configuration Management ● Building and Deployments ● Application Debugging using Weavescope ● Demo - From code to Kubernetes ● Future ● QA
  6. 6. git push
  7. 7. Scenario and Architecture
  8. 8. Distributed Teams
  9. 9. Early stages products
  10. 10. Greenfield projects
  11. 11. One man's operations team Priorities vs Resources
  12. 12. Deployments Lifecycle
  13. 13. 10+ Non-production deployments per day
  14. 14. 8 Projects Frontend, Backend API, Android Development, Test, Staging, Demo and Production
  15. 15. Weekly Production deployments (mobile, frontend and backend)
  16. 16. Technologies
  17. 17. Applications
  18. 18. Infrastructure
  19. 19. Challenges
  20. 20. ● CI/CD Pipeline ● Infrastructure as Code ● Isolated Environments (Dev, Test, Demo, Staging, Production) ● Unified orchestrator for builds and deployments processes ● Integrations ● Easy application debugging ● Automation
  21. 21. Results
  22. 22. Foundations
  23. 23. IaaS Cloud Provider Resources Network, Instances, IAM, Disk, Registry, Kubernetes Cluster Software, Packages and Configs Salt Master, Salt Minion, Docker, Postgresql and Elasticsearch ProvisioningOrder Desired State Minions, API, Reactor, Integrations
  24. 24. Let's talk about provisioning
  25. 25. Google Cloud Platform https://cloud.google.com
  26. 26. Infrastructure as Code
  27. 27. IaaS Cloud Provider Resources Network, Instances, IAM, Disk, Registry, Kubernetes Cluster Software, Packages and Configs Salt Master, Salt Minion, Docker, Postgresql and Elasticsearch ProvisioningOrder Desired State Minions, API, Reactor, Integrations
  28. 28. Terraform by Hashicorp https://www.terraform.io
  29. 29. Basic network resources configuration file variable ● Command line tool (apply, plan, destroy) ● Multiples Providers ● Config based resources ● Usage of Variables ● Dependencies Graph ● Execution Plan ● Resource Creation in Parallel ● Multiples Provisioners ● Detailed Output dependency Terraform output
  30. 30. Configure 'Em All Network, Firewall, Subnetworks, Instances, Buckets, Disks, Kubernetes Cluster, Services Accounts and IAM
  31. 31. Configuration Management
  32. 32. IaaS Cloud Provider Resources Network, Instances, IAM, Disk, Registry, Kubernetes Cluster Software, Packages and Configs Salt Master, Salt Minion, Docker, Postgresql and Elasticsearch ProvisioningOrder Desired State Minions, API, Reactor, Integrations
  33. 33. https://saltstack.com
  34. 34. SaltStack Open Source https://docs.saltstack.com/en/latest/ Master MinionOperator Minion Postgresql Minion Builder MinionElastic G@roles:builder and G@environment:test
  35. 35. Selectors Master Minion Builder Executed imperatively via command line or reactively via Salt Reactor. salt cli selector command
  36. 36. Salt Pillars "Offer global values that can be distributed to minions"
  37. 37. Salt States "The SLS is a representation of the state in which a system should be in, and is set up to contain this data in a simple format."
  38. 38. state ID modulename.command arguments
  39. 39. Using defined pillars within states ● Introducing the map.jinja file ● Passing pillars values when compiling states
  40. 40. Output to MinionParse + Merge SaltStack Compilation Process + =Pillars dictionaries States jinja2 Low Data Parse
  41. 41. Gitfs "The gitfs backend allows Salt to serve files from git repositories."
  42. 42. push 15s Master Gitfs
  43. 43. Putting all together
  44. 44. Desired State ● 8 VMs ○ Salt Master ○ Operator ○ Builder ○ Postgresql ○ Elasticsearch ○ 3 Kubernetes nodes ● 2 Persistent Data Disks: 500GB attached to PG and ELS ● 1 Kubernetes Cluster ● Network ○ Required Firewall Rules ○ 2 Subnets ● 2 IAM/Service Accounts: Pull/Push Docker Registry
  45. 45. Complete Cloud Provision Flow Network Firewall, Subnets, Static IPs, ... Instances Salt Master, Salt Minion, Postgresql, Elasticsearch, Builder, Operator Kubernetes Cluster Nodes, Firewall Rules, K8S Master and Workers ● $ terraform apply Salt states are applied just after an instance is created, based on its "role" specified in the grains config Core resources are created during this phase Creates the initial cluster state based on the number of nodes specified
  46. 46. Work is done!
  47. 47. Google Cloud Admin Panel
  48. 48. http://kubernetes.io/
  49. 49. Kubernetes Dashboard
  50. 50. Show me the flow!
  51. 51. Salt API https https ssh Builder Operator runners reactor Event Hub https
  52. 52. Building and Deploying
  53. 53. Kubernetes Objects "Kubernetes Objects are persistent entities in the Kubernetes system. Kubernetes uses these entities to represent the state of your cluster."
  54. 54. Kubernetes objects ● Abstracts: deployments, services, replica sets, ingress, ... ● Generated on the fly by Salt using templates ● Final .yaml file compiled including pillars and arguments ● $ kubectl apply -f mysite-development.yaml ● Garbage collector
  55. 55. deploymentV1.yaml
  56. 56. Builder 1 2 3 4 5 6 7 8 Code to Image Flow Registry Reactor push state.apply notify notify notify push notify
  57. 57. Operator Kubernetes Deployment Flow Registry Reactor (Post Build) Pullkubectlstate.apply1 2 4 notify 3 5 notify 6
  58. 58. https://operable.io/ ChatOps
  59. 59. Build Build
  60. 60. Rollback
  61. 61. Application Debugging https://www.weave.works/products/weave-scope/
  62. 62. Demo Live from code to Kubernetes!
  63. 63. Future What must be improved? ● Error Handling ● Credentials Management ● Logging and Monitoring ● On Demand Environments ● Terraform File Refactoring ● Implement Production ● Rollout Deployments ● Postgresql Cluster ● Elasticsearch Cluster ● ...
  64. 64. Wrap up What I've seen so far? ● Automated provision ● Infrastructure as Code ● Event driven environment ● Fast delivery cycle ● Isolated environments ● Application Debugging ● ChatOps
  65. 65. Final Words
  66. 66. Doesn't have to be perfect from day 0!
  67. 67. Pick up the right people "When you get into one of these groups, there's only a couple of ways you can get out: one is death, the other is mental institutions..." - Devops Engineer testimonial
  68. 68. Links Saltstack - https://saltstack.com Salt States - https://docs.saltstack.com/en/latest/topics/tutorials/starting_states.html Salt Pillars - https://docs.saltstack.com/en/latest/topics/pillar/ Terraform - https://www.terraform.io/intro/index.html Weavescope - https://www.weave.works/products/weave-scope Kubernetesio - http://kubernetes.io Jenkins CI - https://jenkins.io Docker - https://docker.com Google Cloud Platform - cloud.google.com GCP Calculator - https://cloud.google.com/products/calculator/
  69. 69. Danke Schön!
  70. 70. Questions?

×