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

Creating Kubernetes clusters on-demand using Go - Marko Mudrinić, Loodse

GoDays
January 30, 2019

Creating Kubernetes clusters on-demand using Go - Marko Mudrinić, Loodse

Creating Kubernetes clusters on-demand using Go - Marko Mudrinić, Loodse

GoDays

January 30, 2019
Tweet

More Decks by GoDays

Other Decks in Technology

Transcript

  1. • Software Developer @ Loodse • Computer Science student •

    Former GSoC student with CNCF/Kubernetes • Maintainer of Kubicorn and Cluster-API provider for DigitalOcean @xmudrii Who am I?
  2. • There are many tools for running Kubernetes clusters •

    Many tools require manual interaction or can’t be used as Go libraries Goal: We want to use Go to run Kubernetes Clusters @xmudrii Running Kubernetes
  3. • Improved developer and user experience • Better integration with

    existing workflows and test suites written in Go • Better cluster lifecycle control and improved error handling @xmudrii Why use Go for running clusters?
  4. • Where do we want to run our clusters? ◦

    On local machines or on public cloud? • Do we need multi-node or High-Availability support? • What Kubernetes version we want to run? • For which cloud provider we need support? @xmudrii Choosing a right solution
  5. • When running integration and end-to-end tests ◦ Running tests

    on local clusters reduces costs and makes tests faster ◦ In CI environment, we want an easy way to create and control clusters • When building end user tools ◦ Cluster-API CLI (clusterctl) uses Minikube to run a cluster @xmudrii When do we need local clusters?
  6. • A library should require as least as possible dependencies

    ◦ Dependencies should be common that most users already have • It would be nice if we could run our clusters inside Docker containers ◦ Many users already have Docker installed ◦ Docker doesn’t requires root privileges or changes files on the system @xmudrii Prerequisites
  7. • A tool for running local Kubernetes clusters using just

    Docker • Maintained by Kubernetes community • Supports Kubernetes 1.11+, including running Kubernetes from sources • Comes with a CLI, but can also be used as a Go library @xmudrii kind (Kubernetes in Docker)
  8. • Comes with easy to use and well-documented Go interfaces

    • Requires just Docker, making it well suitable for end users and CI pipelines ◦ Comes with pre-built Docker image containing all dependencies • Uses popular kubeadm, making clusters easily customizable • Supports multi-node clusters, HA support expected in the upcoming period @xmudrii Why kind?
  9. • kind is a young project, currently in alpha ◦

    Backwards-incompatible changes are announced in upcoming period ◦ It is recommended to vendor and pin kind to specific commit! • High-availability support is work-in-progress • Image sideloading has to be done manually, but a native feature is WIP @xmudrii Project status
  10. • GitHub repository: https://sigs.k8s.io/kind • We have a channel on

    Kubernetes Slack: #kind @xmudrii Getting involved
  11. • Provisioning clusters manually is time consuming and error prone

    • There are many cloud providers, many possible setups, and many tasks to do ◦ Setting up networking, creating VMs, bootstrapping them… • Sometimes it’s not possible to catch up all bugs when testing locally ◦ Example: GCP authorization plugin _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" @xmudrii Running clusters on the Cloud
  12. • Library needs to support cloud provider you need ◦

    Optionally, implementing cloud provider support should be possible • Cluster provisioning process is customizable ◦ We can tell what resources we need ◦ We can tell how to provision the VMs and Kubernetes • There is a secure mechanism for cleaning up resources @xmudrii Prerequisites
  13. • A tool for provisioning Kubernetes clusters in cloud •

    Takes care of provisioning both infrastructure and Kubernetes • Supports any Kubernetes version and (almost) any setup @xmudrii Kubicorn
  14. • Open-source tool that can be used as a library,

    framework, or CLI • Support many cloud providers ◦ AWS, GCP, DigitalOcean, Azure, OpenStack, Packet • Support (almost) any Kubernetes version • Machines and cluster provisioning is customizable @xmudrii Why Kubicorn?
  15. • Kubicorn is based on reconcilation process ◦ We define

    what what resources we expect (desired state) ◦ A loop is running until we don’t reach desired state (actual state) @xmudrii How Kubicorn works?
  16. • Kubicorn is currently in alpha ◦ Currently transitioning to

    the upstream Cluster-API ◦ Breaking changes may happen in the future • Support for AWS, DigitalOcean, GCP, Azure, OpenStack and Packet ◦ Azure support is not fully implemented ◦ OpenStack and GCP are known to have some bugs @xmudrii Project status
  17. • GitHub repository: https://github.com/kubicorn/kubicorn • Make sure to check our

    awesome website: https://kubicorn.io • We have a channel on Kubernetes Slack: #kubicorn @xmudrii Getting involved
  18. Goal: We want to use Go to run Kubernetes Clusters

    • Using kind for running local clusters • Using Kubicorn for running clusters on many cloud providers • Repository with resources: http://bit.ly/k8s-with-go • Twitter/GitHub/Slack: @xmudrii • Blog: https://xmudrii.com @xmudrii Conclusion