https://github.com/starbops/terraform-rke2
Create an RKE2 cluster with Libvirt/KVM in bridge/NAT mode using Terraform
https://github.com/starbops/terraform-rke2
Last synced: 6 months ago
JSON representation
Create an RKE2 cluster with Libvirt/KVM in bridge/NAT mode using Terraform
- Host: GitHub
- URL: https://github.com/starbops/terraform-rke2
- Owner: starbops
- Created: 2023-07-28T11:11:36.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-08-15T17:28:30.000Z (almost 2 years ago)
- Last Synced: 2025-10-27T20:53:39.027Z (9 months ago)
- Language: HCL
- Homepage:
- Size: 20.5 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Terraform RKE2
==============
Create an RKE2 cluster with Libvirt/KVM in bridge/NAT mode using Terraform.
Prerequisites
-------------
Tested on Ubuntu 20.04 machines
```sh
sudo apt update
sudo apt install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils virtinst
sudo usermod -aG libvirt $USER
sudo usermod -aG kvm $USER
```
```sh
$ curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
$ sudo apt-add-repository "deb [arch=$(dpkg --print-architecture)] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
$ sudo apt update
$ sudo apt install terraform
$ terraform -v
Terraform v1.5.4
on linux_amd64
```
Firing Up
---------
```sh
make tf-init
make tf-plan
make tf-apply
```
Connect to one of the control plane nodes and execute the `kubectl` command to check the cluster info:
```sh
$ root@rke2-server-0:~# KUBECONFIG=/etc/rancher/rke2/rke2.yaml /var/lib/rancher/rke2/bin/kubectl cluster-info
Kubernetes control plane is running at https://127.0.0.1:6443
CoreDNS is running at https://127.0.0.1:6443/api/v1/namespaces/kube-system/services/rke2-coredns-rke2-coredns:udp-53/proxy
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
```
Tearing Down
------------
```sh
make tf-destroy
```