Infrastructure as Code using Deployment Manager and Kubernetes

Infrastructure as Code using Deployment Manager and Kubernetes

How to do infrastructure as code using GCP Deployment Manager and automate the creation of Kubernetes + Kubernetes resources. Also, what "cloud-native configuration management" could be.

B41604b29277208b65682d098be6e2fc?s=128

David Schweikert

May 22, 2018
Tweet

Transcript

  1. Infrastructure as Code using Deployment Manager and Kubernetes Cloud Native

    Computing Switzerland Meetup, 22 May 2018 David Schweikert @dschweikert AdNovum Informatik AG
  2. David, can you please review our Kubernetes setup in GCP?

  3. Problem #1: GCP Infrastructure…

  4. README files - Click “Kubernetes Engine” - Click “Create new

    cluster” - Fill in: - Name: my-new-cluster - Description: … - … - Click ”Cloud SQL” - Click “Create Database instance” - … (many steps…) +
  5. Problem #2: Kubernetes Infrastructure…

  6. None
  7. We need to fix this before going productive

  8. We need it to be: • Reproducible • Well documented

    • Well tested
  9. We need: Infrastructure as code!

  10. We need it fast

  11. Look, Google also provides an infra-as-code tool…

  12. It’s called: Deployment Manager

  13. Problem #1? Easy…

  14. None
  15. None
  16. Also… • It keeps state on what it created •

    Only does the needed changes • And knows when to delete things (like Terraform and Helm, for example… and unlike Ansible) !
  17. About Problem #2…

  18. None
  19. Kubernetes resources are not supported

  20. None
  21. The best feature of Deployment Manager: You can teach it

    how to manage other resource types that it doesn’t know about, even external resources!
  22. Requirement: RESTful API to configure resources collection/ collection/object1 collection/object2 GET

    POST PUT DELETE
  23. Very good example: Kubernetes services/ services/backend services/db GET POST PUT

    DELETE
  24. RESTful APIs for configuration management

  25. RESTful APIs as the sole abstraction, no need to hide

    it!
  26. None
  27. Kubernetes custom resources are becoming more and more important… what

    then?
  28. I would call this “cloud-native configuration management”

  29. Problem #2 was also solved and we delivered in time

  30. The less good parts

  31. 1. Lock-in

  32. If lock-in is a problem, HashiCorp‘s Terraform is probably the

    better choice (but I wish it was more like Deployment Manager …)
  33. Also, if you do chose Terraform to create your GCP

    resources, you probably need something else for the Kubernetes resources (like Helm, Kapitan, …) Having a holistic solution would be definitely better though
  34. 2. Maturity

  35. § Using Deployment Manager to manage Kubernetes resource works… but

    it feels like nobody does this
  36. Credit: 20th Century Fox/The Martian

  37. § The best documentation often are the code examples

  38. § You can’t use it to set passwords yet (an

    important feature for that is still in the works)
  39. § Too dangerous for some resources (like external IPs)

  40. To summarize: I recommend it… • If you are totally

    committed to GCP • or, you just need something quick (but still reproducible) Really interesting to me… § A configuration management system that interacts with user-defined RESTful APIs to manage resources § Maybe it’s time for a new open-source “cloud-native configuration management” tool?
  41. Questions? (see also my blog article for all the details

    on managing Kubernetes resources with Deployment Manager: https://tinyurl.com/dm-kubernetes)