sguyennet / terraform-vsphere-kubespray

Deploy a Kubernetes HA cluster on VMware vSphere
https://blog.inkubate.io/install-and-manage-automatically-a-kubernetes-cluster-on-vmware-vsphere-with-terraform-and-kubespray/
Apache License 2.0
174 stars 89 forks source link
deployment kubernetes kubespray terraform vmware vsphere

terraform-vsphere-kubespray

Requirements

Tested Linux distribution

Tested Kubernetes network plugins

RHEL 7 CentOS 7 Ubuntu LTS 18.04 Ubuntu LTS 16.04 Debian 9
Flannel :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
Weave :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
Calico :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
Cilium :x: :x: :heavy_check_mark: :x: :heavy_check_mark:
Canal :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:

Usage

All the steps to use this Terraform script are described in details here: https://blog.inkubate.io/install-and-manage-automatically-a-kubernetes-cluster-on-vmware-vsphere-with-terraform-and-kubespray/

Create a Kubernetes cluster

$ cd terraform-vsphere-kubespray

$ vim terraform.tfvars

$ terraform init

$ terraform plan

$ terraform apply

Add a worker node

Add one or several worker nodes to the k8s_worker_ips list:

$ vim terraform.tfvars

Execute the terraform script to add the worker nodes:

$ terraform apply -var 'action=add_worker'

Delete a worker node

Remove one or several worker nodes to the k8s_worker_ips list:

$ vim terraform.tfvars

Execute the terraform script to remove the worker nodes:

$ terraform apply -var 'action=remove_worker'

Upgrade Kubernetes

Modify the k8s_version and the k8s_kubespray_version variables:

$ vim terraform.tfvars

Kubernetes version Kubespray version
v1.15.3 v2.11.0
v1.14.3 v2.10.3
v1.14.1 v2.10.0
v1.13.5 v2.9.0
v1.12.5 v2.8.2
v1.12.4 v2.8.1
v1.12.3 v2.8.0

Execute the terraform script to upgrade Kubernetes:

$ terraform apply -var 'action=upgrade'