Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Kubernetes at XING: what it takes to build a co...

Kubernetes at XING: what it takes to build a coherent development environment

This talk is a walk through the design of our XING's internal PaaS, the story of problems we encountered and solutions we found sprinkled with reflections on Kubernetes programming interface and real examples of making developers' lives easier with automation and closed feedback loops. Keywords: Kubernetes, PaaS, GitHub, Jenkins, Golang, Groovy, custom controllers, Prometheus, CLI, lessons learned.

Avatar for Egor Balyshev

Egor Balyshev

June 26, 2019
Tweet

Other Decks in Technology

Transcript

  1. Kubernetes at XING What it takes to build a coherent

    development environment Egor Balyshev ContainerDays 2019
  2. XING • Career / work oriented social network • 16

    million users • German-speaking countries • 1,500 employees
  3. XING, circa 2017 • Two data centers • VMware &

    Chef • 100+ apps • Ruby, Scala, Elixir, Perl • GitHub, Jenkins, Capistrano
  4. Pain points • Slow resource provisioning • Mistakes in host

    configuration • Complicated application boilerplates • Lack of granular security policies
  5. Dockerfile isn’t cutting it • OS and library version management

    • Security patch rollouts • Certificate installation
  6. docker-build • Base images: OS + frameworks + dependencies •

    Centralized configuration • Production and development targets
  7. build.yaml type: rails-app passenger_version: 6.0.2 image: reg.xing.com/xing/rails-misc os_release: bionic build_packages:

    - libmysqlclient-dev runtime_packages: - libmysqlclient20 assets_compile_command: rake assets:precompile
  8. build.yaml type: rails-app passenger_version: 6.0.2 image: reg.xing.com/xing/rails-misc os_release: bionic build_packages:

    - libmysqlclient-dev runtime_packages: - libmysqlclient20 assets_compile_command: rake assets:precompile
  9. build.yaml type: rails-app passenger_version: 6.0.2 image: reg.xing.com/xing/rails-misc os_release: bionic build_packages:

    - libmysqlclient-dev runtime_packages: - libmysqlclient20 assets_compile_command: rake assets:precompile
  10. build.yaml type: rails-app passenger_version: 6.0.2 image: reg.xing.com/xing/rails-misc os_release: bionic build_packages:

    - libmysqlclient-dev runtime_packages: - libmysqlclient20 assets_compile_command: rake assets:precompile
  11. build.yaml type: rails-app passenger_version: 6.0.2 image: reg.xing.com/xing/rails-misc os_release: bionic build_packages:

    - libmysqlclient-dev runtime_packages: - libmysqlclient20 assets_compile_command: rake assets:precompile
  12. build.yaml type: rails-app passenger_version: 6.0.2 image: reg.xing.com/xing/rails-misc os_release: bionic build_packages:

    - libmysqlclient-dev runtime_packages: - libmysqlclient20 assets_compile_command: rake assets:precompile
  13. build.yaml type: rails-app passenger_version: 6.0.2 image: reg.xing.com/xing/rails-misc os_release: bionic build_packages:

    - libmysqlclient-dev runtime_packages: - libmysqlclient20 assets_compile_command: rake assets:precompile
  14. test_compose.yaml services: mysql: image: reg.xing.com/deps/mysql memcached: image: reg.xing.com/deps/memcached main: image:

    reg.xing.com/xing/rails-misc:$TAG entrypoint: script/test.sh links: - mysql - memcached environment: RAILS_CACHE_STORE_MEMCACHE_HOSTS: memcached DB_HOST: mysql
  15. test_compose.yaml services: mysql: image: reg.xing.com/deps/mysql memcached: image: reg.xing.com/deps/memcached main: image:

    reg.xing.com/xing/rails-misc:$TAG entrypoint: script/test.sh links: - mysql - memcached environment: RAILS_CACHE_STORE_MEMCACHE_HOSTS: memcached DB_HOST: mysql
  16. test_compose.yaml services: mysql: image: reg.xing.com/deps/mysql memcached: image: reg.xing.com/deps/memcached main: image:

    reg.xing.com/xing/rails-misc:$TAG entrypoint: script/test.sh links: - mysql - memcached environment: RAILS_CACHE_STORE_MEMCACHE_HOSTS: memcached DB_HOST: mysql
  17. test_compose.yaml services: mysql: image: reg.xing.com/deps/mysql memcached: image: reg.xing.com/deps/memcached main: image:

    reg.xing.com/xing/rails-misc:$TAG entrypoint: script/test.sh links: - mysql - memcached environment: RAILS_CACHE_STORE_MEMCACHE_HOSTS: memcached DB_HOST: mysql
  18. test_compose.yaml services: mysql: image: reg.xing.com/deps/mysql memcached: image: reg.xing.com/deps/memcached main: image:

    reg.xing.com/xing/rails-misc:$TAG entrypoint: script/test.sh links: - mysql - memcached environment: RAILS_CACHE_STORE_MEMCACHE_HOSTS: memcached DB_HOST: mysql
  19. Mesos + Marathon, 2017 • One-shot tasks • Guaranteed CPU/memory

    ☹ • Granular access control • Developer support
  20. “Containers” is a huge change • Automate everything! • Resource

    utilization! • Lock the things down! • We’re playing with Mesos!
  21. XING platform values 1. Engineers’ productivity 2. Security 3. Maintenance

    cost 4. Platform resilience 5. Hardware utilization
  22. kubectl isn’t cutting it • K8s manifest duplication • No

    resource creation order • The status is not reported back
  23. kubernetes-deploy • Open source • Templates and partials • Secret

    encryption • Deployment stages • Status reports
  24. Jenkins pipeline 1. Checkout the code 2. Docker-build 3. Docker-test

    4. Push to the registry 5. Kubernetes-deploy
  25. GitHub • Organizations → Kubernetes namespaces, Jenkins folders • Team

    membership → Deployment permissions • Branches → Stages • Events → Pipeline triggers
  26. The big picture code HTTP images manifests status images folders,

    credentials orgs namespaces, rbac roles orgs, teams
  27. The big picture code HTTP images manifests status images folders,

    credentials orgs namespaces, rbac roles orgs, teams secrets repositories
  28. The big picture code HTTP images manifests status images folders,

    credentials orgs namespaces, rbac roles orgs, teams secrets repositories
  29. The big picture code HTTP images manifests status images folders,

    credentials orgs namespaces, rbac roles orgs, teams secrets repositories
  30. The big picture code HTTPS images manifests status images folders,

    credentials orgs namespaces, rbac roles orgs, teams secrets repositories HTTP
  31. The big picture code HTTPS images manifests status images folders,

    credentials orgs namespaces, rbac roles orgs, teams secrets repositories HTTP
  32. The big picture code HTTPS images manifests status images folders,

    credentials orgs namespaces, rbac roles orgs, teams secrets repositories HTTP rules services ingresses
  33. The big picture code HTTPS images manifests status images folders,

    credentials orgs namespaces, rbac roles orgs, teams secrets repositories HTTP env variables rules services ingresses
  34. The big picture code HTTPS images manifests status images folders,

    credentials orgs namespaces, rbac roles orgs, teams secrets repositories HTTP rules services ingresses env variables
  35. The big picture code HTTPS images manifests status images folders,

    credentials orgs namespaces, rbac roles orgs, teams secrets repositories HTTP rules services ingresses values ConfigMaps
  36. Custom controllers • Application config reloads • Graceful node restarts

    • Docker runtime fixes • Metrics collection setup • Cross-cluster service discovery
  37. The big picture code HTTPS images manifests status images folders,

    credentials orgs namespaces, rbac roles orgs, teams secrets repositories HTTP rules services ingresses config ConfigMaps
  38. The big picture code HTTPS images manifests status images folders,

    credentials orgs namespaces, rbac roles orgs, teams secrets repositories HTTP rules services ingresses config ConfigMaps
  39. Docs structure • Components: what it is and what it

    does • Tasks: daily routines, < 15 min • Tutorials: migrations, tuning guides
  40. The big picture code HTTPS images manifests status images folders,

    credentials orgs namespaces, rbac roles orgs, teams secrets repositories HTTP rules services ingresses config ConfigMaps
  41. The big picture code HTTPS images manifests status images folders,

    credentials orgs namespaces, rbac roles orgs, teams secrets repositories HTTP rules services ingresses config ConfigMaps
  42. Support channel • “Argonaut of the week” role • Support

    channel is the only duty • Helps a lot!
  43. The big picture code HTTPS images manifests status images folders,

    credentials orgs namespaces, rbac roles orgs, teams secrets repositories HTTP rules services ingresses config ConfigMaps
  44. The big picture code HTTPS images manifests status images folders,

    credentials orgs namespaces, rbac roles orgs, teams secrets repositories HTTP rules services ingresses config ConfigMaps
  45. The big picture code HTTPS images manifests status images folders,

    credentials orgs namespaces, rbac roles orgs, teams secrets repositories HTTP rules services ingresses config ConfigMaps
  46. The big picture code HTTPS images manifests status images folders,

    credentials orgs namespaces, rbac roles orgs, teams secrets repositories HTTP rules services ingresses config ConfigMaps
  47. The big picture code HTTPS images manifests status images folders,

    credentials orgs namespaces, rbac roles orgs, teams secrets repositories HTTP rules services ingresses config ConfigMaps
  48. The big picture code HTTPS images manifests status images folders,

    credentials orgs namespaces, rbac roles orgs, teams secrets repositories HTTP rules services ingresses config ConfigMaps
  49. Olympify • Auto-detects application type • Writes image build config

    • Writes Jenkins pipeline • Writes Kubernetes manifests
  50. Day-to-day commands • app deploy, app rollback, app restart •

    secret encode, secret import • run job, run command • authenticate
  51. The big picture code HTTPS images manifests status images folders,

    credentials orgs namespaces, rbac roles orgs, teams secrets repositories HTTP rules services ingresses config ConfigMaps
  52. The big picture code HTTPS images manifests status images folders,

    credentials orgs namespaces, rbac roles orgs, teams secrets repositories HTTP rules services ingresses config ConfigMaps
  53. Prometheus (format) • Widely supported • Pull model • Telegraph

    adds versatility • Thanos looks promising
  54. The big picture code HTTPS images manifests status images folders,

    credentials orgs namespaces, rbac roles orgs, teams secrets repositories HTTP rules services ingresses config ConfigMaps
  55. XING, 2019 • 230 applications • Kubernetes Olympus is the

    platform • 100% of eligible apps migrated • 9 clusters, 100 namespaces, 7000 pods • Massive proliferation of “misc” apps
  56. Reality code HTTPS images manifests status images folders, credentials orgs

    namespaces, rbac roles orgs, teams secrets repositories HTTP rules services ingresses config ConfigMaps
  57. Acknowledgements I used a bunch of icons from thenounproject.com: •

    build by priyanka from the Noun Project • cogs by kurakuricon from the Noun Project • Command Line by Focus from the Noun Project • terminal by Focus from the Noun Project • Router by Lero Keller from the Noun Project • website by lastspark from the Noun Project • customer service by Deemak Daksina from the Noun Project • documentation by Mahmure Alp from the Noun Project • pause by uzeir syarief from the Noun Project All product and company logos belong to their original copyright holders.