All Projects → kubic-project → kubic-terraform-kvm

kubic-project / kubic-terraform-kvm

Licence: Apache-2.0 license
Kubic Terraform script using KVM/libvirt

Programming Languages

HCL
1544 projects
python
139335 projects - #7 most used programming language
shell
77523 projects

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

Demo
Easy to use KubeVirt demo based on minikube.
Stars: ✭ 88 (+193.33%)
Mutual labels:  libvirt
Node Libvirt
libvirt bindings for google v8 javascript engine (nodejs addon)
Stars: ✭ 162 (+440%)
Mutual labels:  libvirt
Kimchi
An HTML5 management interface for KVM guests
Stars: ✭ 2,773 (+9143.33%)
Mutual labels:  libvirt
Linchpin
ansible based multicloud orchestrator
Stars: ✭ 107 (+256.67%)
Mutual labels:  libvirt
Qt Virt Manager
Qt Virtual machines manager
Stars: ✭ 146 (+386.67%)
Mutual labels:  libvirt
Nixbox
NixOS Vagrant boxes [[email protected]]
Stars: ✭ 189 (+530%)
Mutual labels:  libvirt
Ha Sap Terraform Deployments
Automated SAP/HA Deployments in Public/Private Clouds
Stars: ✭ 61 (+103.33%)
Mutual labels:  libvirt
vagrant-travisci-libvrt
Example project showing how to run Vagrant on TravisCI using libvrt & KVM
Stars: ✭ 25 (-16.67%)
Mutual labels:  libvirt
Terrible
An Ansible playbook that apply the principle of the Infrastructure as Code on a QEMU/KVM environment.
Stars: ✭ 161 (+436.67%)
Mutual labels:  libvirt
Packer Templates
Scripts and Templates used for generating Vagrant images
Stars: ✭ 219 (+630%)
Mutual labels:  libvirt
Libvirt Hook Qemu
Libvirt hook for setting up iptables port-forwarding rules when using NAT-ed networking.
Stars: ✭ 137 (+356.67%)
Mutual labels:  libvirt
Appvm
Nix-based app VMs
Stars: ✭ 146 (+386.67%)
Mutual labels:  libvirt
Kubevirt
Kubernetes Virtualization API and runtime in order to define and manage virtual machines.
Stars: ✭ 2,916 (+9620%)
Mutual labels:  libvirt
Karesansui
Karesansui is an open-source virtualization management application made in Japan.
Stars: ✭ 97 (+223.33%)
Mutual labels:  libvirt
Kvm Install Vm
Bash script to build local virtual machines using KVM/libvirt and cloud-init.
Stars: ✭ 248 (+726.67%)
Mutual labels:  libvirt
Virt Lightning
Starts your VM on libvirt in a couple of seconds!
Stars: ✭ 71 (+136.67%)
Mutual labels:  libvirt
Virtlyst
Web interface to manage virtual machines with libvirt
Stars: ✭ 167 (+456.67%)
Mutual labels:  libvirt
evcloud
EVCloud是一个基于ceph和libvirt的轻量级云主机管理平台,实用稳定,维护简易
Stars: ✭ 44 (+46.67%)
Mutual labels:  libvirt
Ravada
Remote Virtual Desktops Manager
Stars: ✭ 253 (+743.33%)
Mutual labels:  libvirt
Kcli
Management tool for libvirt/aws/gcp/kubevirt/openstack/ovirt/vsphere/packet
Stars: ✭ 219 (+630%)
Mutual labels:  libvirt

terraform-kubic-kvm

The goal is to provide a simple setup of three Kubic VMs.

About terraform-libvirt

If you want to dive in the Terraform-libvirt API, you can have a look here:

https://github.com/dmacvicar/terraform-provider-libvirt#website-docs

Prerequisites

You're going to need at least:

Usage

Run

./download-image.py
terraform init
terraform plan
terraform apply
./mk-ssh-config.sh

to start the VMs.

Some parameters (like number of virtual machines and parameters of virtual machines) are configurable by creating a terraform.tfvars file which can be copied from the sample file:

cp terraform.tfvars.sample terraform.tfvars

Please refer to the variables.tf file for the full variables list with descriptions.

note: the default password for the root user is linux.

Setting up Kubernetes cluster

Initialize the K8s cluster by running kubeadm on the the first node:

cat <<'EOF' | ssh -F ssh_config $(terraform output -json | jq -r '.ips.value[0][]') 'bash -s'
kubeadm init --cri-socket=/var/run/crio/crio.sock --pod-network-cidr=10.244.0.0/16
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
EOF

And run the kubeadm join on the others. We just have to add --cri-socket=/var/run/crio/crio.sock:

join_command=$(ssh -F ssh_config $(terraform output -json | jq -r '.ips.value[0][]') "kubeadm token create --print-join-command")
join_command="kubeadm join --cri-socket=/var/run/crio/crio.sock $(echo $join_command | python -c 'import sys; print(" ".join(sys.stdin.read().split()[2:]))')"
ssh -F ssh_config $(terraform output -json | jq -r '.ips.value[1][]') "$join_command"
ssh -F ssh_config $(terraform output -json | jq -r '.ips.value[2][]') "$join_command"

Howto

Access the cluster locally

scp -F ssh_config $(terraform output -json | jq -r '.ips.value[0][]'):~/.kube/config ~/.kube/config
k get nodes

Using an insecure private registry

registry_ip="$(terraform output -json | jq -r '.ips.value[0][]'):5000"  # or another IO
for h in $(terraform output -json | jq -r '.ips.value[][]')
do
    cat <<EOF | ssh -F ssh_config $h 'bash -s'
sed -i 's/\[crio\.image\]/[crio.image]\ninsecure_registries = ["$registry_ip"]/g' /etc/crio/crio.conf
grep -C 1 insecure /etc/crio/crio.conf
systemctl restart crio
EOF
done

References

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