All Projects → MusicDin → terraform-kvm-kubespray

MusicDin / terraform-kvm-kubespray

Licence: Apache-2.0 License
Set up Kubernetes cluster using KVM, Terraform and Kubespray

Programming Languages

HCL
1544 projects
Smarty
1635 projects
shell
77523 projects

Projects that are alternatives of or similar to terraform-kvm-kubespray

K8s-Cluster-Provisioner-GCP-Terrafrom
This repo will seamlessly setup self managed Kubernetes cluster in GCP using Terraform and Kubespray.
Stars: ✭ 17 (-69.09%)
Mutual labels:  kubernetes-cluster, kubespray
Kubespray
Deploy a Production Ready Kubernetes Cluster
Stars: ✭ 11,588 (+20969.09%)
Mutual labels:  kubernetes-cluster, kubespray
Enjoliver
Build, test, deploy and maintain a baremetal Kubernetes Cluster
Stars: ✭ 27 (-50.91%)
Mutual labels:  kubernetes-cluster, kvm
metalnetes
Create and manage multiple Kubernetes clusters using KVM on a bare metal Fedora 29 server. Includes helm + rook-ceph + nginx ingress + the stock analysis engine (jupyter + redis cluster + minio + automated cron jobs for data collection) - works on Kubernetes version v1.16.0 - 1.16.3 was not working
Stars: ✭ 37 (-32.73%)
Mutual labels:  kubernetes-cluster, kvm
devops
基于django+vue实现的一套前后端分离的运维系统
Stars: ✭ 32 (-41.82%)
Mutual labels:  kubernetes-cluster
ganeti-rpm
Ganeti RPM Packaging
Stars: ✭ 23 (-58.18%)
Mutual labels:  kvm
spark
Apache Spark enhanced with native Kubernetes scheduler back-end: NOTE this repository is being ARCHIVED as all new development for the kubernetes scheduler back-end is now on https://github.com/apache/spark/
Stars: ✭ 609 (+1007.27%)
Mutual labels:  kubernetes-cluster
kubernetes-auto-install-script
kubernetes auto install script
Stars: ✭ 14 (-74.55%)
Mutual labels:  kubernetes-cluster
iris
Watch on Kubernetes events, filter and send them as standard wehbook to any system
Stars: ✭ 57 (+3.64%)
Mutual labels:  kubernetes-cluster
terraform-vultr-condor
Kubernetes Deployment Tool for Vultr
Stars: ✭ 60 (+9.09%)
Mutual labels:  kubernetes-cluster
okd-lab
Controlled Environment for OKD4 experiments
Stars: ✭ 24 (-56.36%)
Mutual labels:  kvm
LEDs-single-gpu-passthrough
Single GPU passthrough guide 单显卡直通教程资源
Stars: ✭ 87 (+58.18%)
Mutual labels:  kvm
os
OS for Pi-KVM based on Arch Linux ARM
Stars: ✭ 42 (-23.64%)
Mutual labels:  kvm
IntroVirt
IntroVirt is an guest introspection library for KVM
Stars: ✭ 23 (-58.18%)
Mutual labels:  kvm
k8s-actions
Enable GitHub developers to deploy to Kubernetes service using GitHub Actions
Stars: ✭ 104 (+89.09%)
Mutual labels:  kubernetes-cluster
deploy-vm
Libvirt wrapper to spawn VMs using cloud images
Stars: ✭ 56 (+1.82%)
Mutual labels:  kvm
tinypilot
Use your Raspberry Pi as a browser-based KVM.
Stars: ✭ 1,926 (+3401.82%)
Mutual labels:  kvm
vrnetlab
Run virtual routers with docker
Stars: ✭ 879 (+1498.18%)
Mutual labels:  kvm
rak8s
Stand up a Raspberry Pi based Kubernetes cluster with Ansible
Stars: ✭ 362 (+558.18%)
Mutual labels:  kubernetes-cluster
inspr
Inspr is an agnostic application mesh for simpler, faster, and securer development of distributed applications (dApps).
Stars: ✭ 49 (-10.91%)
Mutual labels:  kubernetes-cluster

terraform-kvm-kubespray

Set up HA Kubernetes cluster using KVM, Terraform and Kubespray.

Requirements

Getting Started

If you encounter any issues during the installation, please refer to the troubleshooting page first.

Clone the project and move to the main directory:

git clone https://github.com/MusicDin/terraform-kvm-kubespray.git

cd terraform-kvm-kubespray

SSH keys

Generate SSH keys that will be used to access created VMs:

ssh-keygen

Follow the instructions to generate SSH keys:

Generating public/private rsa key pair.
Enter file in which to save the key (/home/your_username/.ssh/id_rsa): [1]
Enter passphrase (empty for no passphrase): [2]
Enter same passphrase again: [2]
...

[1] You will be asked to enter file in which to save the key. Default is /home/your_username/.ssh/id_rsa.

[2] When asked to enter a password, press ENTER twice to skip setting a password. DO NOT enter it, otherwise Terraform will fail to initialize a cluster.

Finally, you have to enter a location of SSH private key in the vm_ssh_private_key field in terraform.tfvars file.

Cluster setup

Change variables in terraform.tfvars file to fit your needs. Variables are set to work out of the box.

IMPORTANT: Review variables before initializing a cluster.

Note: Script also supports deployment of single node cluster.

Execute terraform script:

# Initializes terraform project
terraform init

# Shows what is about to be done
terraform plan

# Runs/creates project
terraform apply

Note: The installation process can take up to 20 minutes depending on the configuration.

Test cluster

All configuration files will be generated in config/ directory, and one of them will be admin.conf which is actually a kubeconfig file.

Test if the cluster works by displaying all cluster nodes:

kubectl --kubeconfig=config/admin.conf get nodes

Cluster management

Adding worker nodes to the cluster

In terraform.tfvars file add new worker node(s) in worker_nodes list.

Execute terraform script to add a worker (workers):

terraform apply -var 'action=add_worker'

Removing worker nodes from the cluster

In terraform.tfvars file remove worker node(s) from worker_nodes list.

Execute terraform script to remove a worker (workers):

terraform apply -var 'action=remove_worker'

Upgrading the cluster

In terraform.tfvars file modify:

  • k8s_kubespray_version and
  • k8s_version.

Note: Before upgrading make sure Kubespray supports provided Kubernetes version.

Execute terraform script to upgrade a cluster:

terraform apply -var 'action=upgrade'

IMPORTANT: Do not skip releases when upgrading--upgrade by one tag at a time. For more information read Kubespray upgrades.

Destroying the cluster

To destroy the cluster, simply run:

terraform destroy

More documentation

Related projects

If you are interested in deploying a Kubernetes cluster on vSphere instead of KVM check out this project.

Having issues?

In case you have found a bug, or some unexpected behaviour please open an issue.

If you need anything else, you can contact me on GitHub.

License

Apache License 2.0

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].