All Projects → inercia → terraform-provider-kubeadm

inercia / terraform-provider-kubeadm

Licence: other
A Terraform provider/provisioner for deploying Kubernetes with kubeadm

Programming Languages

go
31211 projects - #10 most used programming language
shell
77523 projects
Makefile
30231 projects

Projects that are alternatives of or similar to terraform-provider-kubeadm

kubeadm-tf
PoC; terraform + kubeadm
Stars: ✭ 25 (-58.33%)
Mutual labels:  kubernetes-cluster, kubeadm
kubeadm-vagrant
Setup Kubernetes Cluster with Kubeadm and Vagrant
Stars: ✭ 49 (-18.33%)
Mutual labels:  kubernetes-cluster, kubeadm
icp-ce-on-linux-containers
Multi node IBM Cloud Private Community Edition 3.2.x w/ Kubernetes 1.13.5 in a Box. Terraform, Packer and BASH based Infrastructure as Code script sets up a multi node LXD cluster, installs ICP-CE and clis on a metal or VM Ubuntu 18.04 host.
Stars: ✭ 52 (-13.33%)
Mutual labels:  kubernetes-cluster, infrastructure-as-code
Terraform Aws Kubernetes
Terraform module for Kubernetes setup on AWS
Stars: ✭ 159 (+165%)
Mutual labels:  kubernetes-cluster, kubeadm
terraform-provider-hsdp
Terraform provider to orchestrate various HSDP resources like IAM, CDL, CDR, MDM, Container Host, Edge, etc
Stars: ✭ 26 (-56.67%)
Mutual labels:  infrastructure-as-code, terraform-provider
Kainstall
Use shell scripts to install kubernetes(k8s) high availability clusters and addon components based on kubeadmin with one click.使用shell脚本基于kubeadmin一键安装kubernetes 高可用集群和addon组件。
Stars: ✭ 198 (+230%)
Mutual labels:  kubernetes-cluster, kubeadm
kubernetes-cluster
Vagrant As Automation Script
Stars: ✭ 34 (-43.33%)
Mutual labels:  kubernetes-cluster, kubeadm
Geodesic
🚀 Geodesic is a DevOps Linux Distro. We use it as a cloud automation shell. It's the fastest way to get up and running with a rock solid Open Source toolchain. ★ this repo! https://slack.cloudposse.com/
Stars: ✭ 629 (+948.33%)
Mutual labels:  kubernetes-cluster, infrastructure-as-code
GPU-Kubernetes-Guide
How to setup a production-grade Kubernetes GPU cluster on Paperspace in 10 minutes for $10
Stars: ✭ 34 (-43.33%)
Mutual labels:  kubernetes-cluster, kubeadm
Kontainerd
Creating a kubernetes kubeadm cluster using Vagrant machines as nodes and Containerd as a container runtime
Stars: ✭ 16 (-73.33%)
Mutual labels:  kubernetes-cluster, kubeadm
Kube Aws
[EOL] A command-line tool to declaratively manage Kubernetes clusters on AWS
Stars: ✭ 1,146 (+1810%)
Mutual labels:  kubernetes-cluster, infrastructure-as-code
pico
A Git-driven task runner built to facilitate GitOps and Infrastructure-as-Code while securely passing secrets to tasks.
Stars: ✭ 51 (-15%)
Mutual labels:  infrastructure-management, infrastructure-as-code
Karch
A Terraform module to create and maintain Kubernetes clusters on AWS easily, relying entirely on kops
Stars: ✭ 38 (-36.67%)
Mutual labels:  kubernetes-cluster, infrastructure-as-code
terraform-provider-upcloud
Terraform provider for UpCloud
Stars: ✭ 52 (-13.33%)
Mutual labels:  infrastructure-as-code, terraform-provider
K8s Digitalocean Terraform
Deploy latest Kubernetes cluster on DigitalOcean using Terraform
Stars: ✭ 33 (-45%)
Mutual labels:  kubernetes-cluster, kubeadm
kainstall-offline
kainstall tools offline file
Stars: ✭ 31 (-48.33%)
Mutual labels:  kubernetes-cluster, kubeadm
Kurl
Production-grade, airgapped Kubernetes installer combining upstream k8s with overlays and popular components
Stars: ✭ 391 (+551.67%)
Mutual labels:  kubernetes-cluster, kubeadm
Kubeadm Ansible
Build a Kubernetes cluster using kubeadm via Ansible.
Stars: ✭ 479 (+698.33%)
Mutual labels:  kubernetes-cluster, kubeadm
aws-kubernetes
Kubernetes cluster setup in AWS using Terraform and kubeadm
Stars: ✭ 32 (-46.67%)
Mutual labels:  kubernetes-cluster, kubeadm
rak8s
Stand up a Raspberry Pi based Kubernetes cluster with Ansible
Stars: ✭ 362 (+503.33%)
Mutual labels:  kubernetes-cluster, kubeadm

Terraform kubeadm plugin

Build Status

A Terraform resource definition and provisioner that lets you install Kubernetes on a cluster.

The underlying resources where the provisioner runs could be things like AWS instances, libvirt machines, LXD containers or any other resource that supports SSH-like connections. The kubeadm provisioner will run over this SSH connection all the commands necessary for installing Kubernetes in those resources, according to the configuration specified in the resource "kubeadm" block.

Example

Here is an example that will setup Kubernetes in a cluster created with the Terraform libvirt provider:

resource "kubeadm" "main" {
  api {
    external = "loadbalancer.external.com"   # external address for accessing the API server
  }
  
  cni {
    plugin = "flannel"   # could be 'weave' as well...
  }
  
  network {
    dns_domain = "my_cluster.local"  
    services = "10.25.0.0/16"
  }
  
  # install some extras: helm, the dashboard...
  helm      { install = "true" }
  dashboard { install = "true" }
}

# from the libvirt provider
resource "libvirt_domain" "master" {
  name = "master"
  memory = 1024
  
  # this provisioner will start a Kubernetes master in this machine,
  # with the help of "kubeadm" 
  provisioner "kubeadm" {
    # there is no "join", so this will be the first node in the cluster: the seeder
    config = "${kubeadm.main.config}"

    # when creating multiple masters, the first one (the _seeder_) must join="",
    # and the rest will join it afterwards...
    join      = "${count.index == 0 ? "" : libvirt_domain.master.network_interface.0.addresses.0}"
    role      = "master"

    install {
      # this will try to install "kubeadm" automatically in this machine
      auto = true
    }
  }

  # provisioner for removing the node from the cluster
  provisioner "kubeadm" {
    when   = "destroy"
    config = "${kubeadm.main.config}"
    drain  = true
  }
}

# from the libvirt provider
resource "libvirt_domain" "minion" {
  count      = 3
  name       = "minion${count.index}"
  
  # this provisioner will start a Kubernetes worker in this machine,
  # with the help of "kubeadm"
  provisioner "kubeadm" {
    config = "${kubeadm.main.config}"

    # this will make this minion "join" the cluster started by the "master"
    join = "${libvirt_domain.master.network_interface.0.addresses.0}"
    install {
      # this will try to install "kubeadm" automatically in this machine
      auto = true
    }
  }

  # provisioner for removing the node from the cluster
  provisioner "kubeadm" {
    when   = "destroy"
    config = "${kubeadm.main.config}"
    drain  = true
  }
}

Note well that:

  • all the provisioners must specify the config = ${kubeadm.XXX.config},
  • any other nodes that join the seeder must specify the join attribute pointing to the <IP/name> they must join. You can use the optional role parameter for specifying whether it is joining as a master or as a worker.

Now you can see the plan, apply it, and then destroy the infrastructure:

$ terraform plan
$ terraform apply
$ terraform destroy

You can find examples of the privider/provisioner in other environments like OpenStack, LXD, etc. in the examples directory)

Features

  • Easy deployment of kubernetes clusters in any platform supported by Terraform, just adding our provisioner "kubeadm" in the machines you want to be part of the cluster.
    • All operations are performed through the SSH connection created by Terraform, so you can create a k8s cluster in completely isolated machines.
  • Multi-master deployments. Just add a Load Balancer that points to your masters and you will have a HA cluster!.
  • Easy scale-up/scale-down of the cluster by just changing the count of your masters or workers.
  • Use the kubeadm attributes in other parts of your Terraform script. This makes it easy to do things like:
    • enabling SSL termination by using the certificates generated for kubeadm in the code you have for creating your Load Balancer.
    • create machine templates (for example, cloud-init code) that can be used for creating machines dynamically, without Terraform being involved (like autoscaling groups in AWS).
  • Automatic rolling upgrade of the cluster by just changing the base image of your machines. Terraform will take care of replacing old nodes with upgraded ones, and this provider will take care of draining the nodes.
  • Automatic deployment of some addons, like CNI drivers, the k8s Dashboard, Helm, etc.

(check the TODO for an updated list of features).

Status

This provider/provisioner is being actively developed, but I would still consider it ALPHA, so there can be many rough edges and some things can change without any previous notice. To see what is left or planned, see the issues list and the roadmap.

Requirements

Quick start

$ mkdir -p $HOME/.terraform.d/plugins
$ # with go>=1.12
$ go build -v -o $HOME/.terraform.d/plugins/terraform-provider-kubeadm \
    github.com/inercia/terraform-provider-kubeadm/cmd/terraform-provider-kubeadm
$ go build -v -o $HOME/.terraform.d/plugins/terraform-provisioner-kubeadm \
    github.com/inercia/terraform-provider-kubeadm/cmd/terraform-provisioner-kubeadm

Documentation

Running the tests

You can run the unit tests with:

$ make test

There are end-to-end tests as well, that can be launched with

$ make tests-e2e

Author(s)

License

  • Apache 2.0, See LICENSE file
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].