AmpereComputing / terraform-openstack-k3os-cluster

Terraform to assemble a k3os cluster

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ampere Computing

terraform-openstack-k3os-cluster

License

Description

This Terraform will build a multinode (ARM64/AMD64) k3OS cluster with a single master and N+1 minions. Minions join the Master node upon boot. The IP address of the master node is rendered dynamically in the cloud-config template used to launch the Minons. Minion count is configurable via the minion_count variable located in variables.tf

<script id="asciicast-278218" src="https://asciinema.org/a/278218.js" async data-autoplay="true" data-size="small" data-speed="2"></script>

Quickstart


git clone https://github.com/amperecomputing/terraform-openstack-k3os-cluster
cd terraform-openstack-k3os-cluster
terraform init && terraform plan && terraform apply -auto-approve

k3OS Packer Image Template

<script id="asciicast-278212" src="https://asciinema.org/a/278212.js" async data-autoplay="true" data-size="small" data-speed="2"></script>
  • The k3OS image used is created via a packer tempate.
  • The packer image template is located in the k3OS source here: https://github.com/rancher/k3os
  • The base image is created using using an Ubuntu 18.04 (ARM64/AMD64) image.
  • An Ubuntu 18.04 image must be present in Glance prior to building the image.
  • Terraform was used to deploy the Ubuntu 18.04 image to OpenStack. The Terraform code for loading images can be found here.
  • Assuming kolla-ansible was used to deploy openstack and packer is run from the kolla-ansible control node the following should build the packer image:
git clone https://github.com/rancher/k3os
cd k3os/package/packer/openstack
source /etc/kolla/admin-openrc.sh
export OS_SOURCE_IMAGE=`openstack image list | grep 'ubuntu-18.04'| awk '{print $2}'`
export OS_NETWORKS_ID=`openstack network list | grep 'demo-net'| awk '{print $2}'`
export OS_FLOATING_IP_POOL='public1'
packer validate template-arm64.json
packer build template-arm64.json

Notes

  • Currently there is a bug in the overlay installation of k3OS which causes the VM using the image to shutdown after first boot.
  • A pull request exists with a fix but is not slated for merge until the next point release of k3OS.
  • When starting the cluster, all the nodes will be created then get powered down as a result.
  • Until the next point release of k3OS, you will have to manually turn on the instances after creation.
  • I suggests powering them on one at a time starting with master.
  • If logged into the master while the other instances are being powered on, you can watch them join the cluster with the following command:
watch -n1 kubectl get nodes -o wide

About

Terraform to assemble a k3os cluster

License:Apache License 2.0


Languages

Language:HCL 80.5%Language:Smarty 10.9%Language:Shell 8.6%