Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rgl/terraform-libvirt-rke-example
an example RKE cluster in libvirt QEMU/KVM Virtual Machines using terraform
https://github.com/rgl/terraform-libvirt-rke-example
k8s libvirt rke terraform
Last synced: 13 days ago
JSON representation
an example RKE cluster in libvirt QEMU/KVM Virtual Machines using terraform
- Host: GitHub
- URL: https://github.com/rgl/terraform-libvirt-rke-example
- Owner: rgl
- Created: 2021-08-15T14:17:53.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-09-12T18:47:41.000Z (about 2 years ago)
- Last Synced: 2024-10-11T07:16:14.182Z (27 days ago)
- Topics: k8s, libvirt, rke, terraform
- Language: HCL
- Homepage:
- Size: 18.6 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# About
This creates an example [RKE cluster](https://rancher.com/docs/rke/latest/en/) in libvirt QEMU/KVM Virtual Machines using terraform.
For a vSphere equivalent see the [rgl/terraform-rke-vsphere-cloud-provider-example](https://github.com/rgl/terraform-rke-vsphere-cloud-provider-example).
For a Pulumi equivalent see the [rgl/dotnet-pulumi-libvirt-rke-example repository](https://github.com/rgl/dotnet-pulumi-libvirt-rke-example).
## Usage (Ubuntu 20.04 host)
Create and install the [Ubuntu 20.04 vagrant box](https://github.com/rgl/ubuntu-vagrant) (because this example uses its base disk).
Install `terraform`:
```bash
wget https://releases.hashicorp.com/terraform/1.2.9/terraform_1.2.9_linux_amd64.zip
unzip terraform_1.2.9_linux_amd64.zip
sudo install terraform /usr/local/bin
rm terraform terraform_*_linux_amd64.zip
```Install `kubectl`:
```bash
kubectl_version='1.24.2'
wget -qO /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
echo 'deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main' | sudo tee /etc/apt/sources.list.d/kubernetes.list >/dev/null
sudo apt-get update
kubectl_package_version="$(apt-cache madison kubectl | awk "/$kubectl_version-/{print \$3}")"
sudo apt-get install -y "kubectl=$kubectl_package_version"
```Launch this example:
```bash
export TF_VAR_controller_count=1 # number of controller nodes.
export TF_VAR_worker_count=1 # number of worker nodes.
time make recreate
```Test accessing the cluster:
```bash
terraform output --raw rke_state >rke_state.json # might be useful for troubleshooting.
terraform output --raw kubeconfig >kubeconfig.yaml
export KUBECONFIG="$PWD/kubeconfig.yaml"
kubectl get nodes -o wide
```Destroy everything:
```bash
make destroy
```