Giter VIP home page Giter VIP logo

cluster-libvirt's Introduction

Introduction

Terraform files to deploy clusters of virtual machines with libvirt provider.

Requisites

Packages:

  • terraform 1.3.7-1
  • libvirt 1:8.10.0-1
  • qemu-base 7.2.0-1

Terraform providers:

  • dmacvicar/libvirt 0.7.6

How to use

  1. Create your own deployment variables file:
touch terraform.tfvars
  1. Set variables as you want overwriting them in your file:
    Example of terraform.tfvars
# Network
net_name = "k3s-net"
net_domain = "k3s.local"
net_dns_forwarder = "8.8.8.8"

# Storage
pool_name = "k3s"
pool_path = "/var/lib/libvirt/k3s_pool"

# Nodes
nodes_quantity = 3
nodes_name = "k3s-node"
nodes_cpu = 1
nodes_ram = "512"
nodes_disk_size = 16106127360 #15GiB in bytes
  1. Create your own cloud-init.cfg file and customize it:
touch cloud-init.cfg

Cloud-init oficial documentation examples

โš ๏ธ Create cloud-init.cfg at root level: Terraform expects cloud-init.cfg file in repository root directory.

  1. Execute terraform commands:
terraform init
terraform plan
terraform apply
  1. At the end of the terraform apply command, it shows the ip assigned for each node:
    Example of output:
[...]
Apply complete! Resources: 10 added, 0 changed, 0 destroyed.

Outputs:

nodes-ip = [
  "k3s-node-0: 10.17.3.64",
  "k3s-node-1: 10.17.3.18",
  "k3s-node-2: 10.17.3.186",
]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.