- Install Kubernetes cluster for learning, testing and developing applications.
On Linux server execute script:
cd cloud-infra
./configure.sh
It will automatically configure your server for cloud-infra
project. Otherwise look below what manual changes should be done on your server.
-
First of all chceck is there any new packages that have just come to the repositories and fetch new versions of packages existing on the machine:
sudo apt update && apt upgrade --yes
-
Install required packages:
sudo apt install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils virt-manager git-core libguestfs-tools jq
-
Add your user to the
libvirt
andkvm
group:sudo usermod -a -G kvm $(whoami) sudo usermod -a -G libvirt $(whoami)
3.a. Now you can check user permissions by command:
id
Remember: If user has
0
it means that user isroot
, numbers1000+
means that's normal user -
Only on ubuntu: Change parameter
security_driver
in/etc/libvirt/qemu.conf
fromsecurity_driver = "selinux"
tosecurity_driver = "none"
:sudo sed -i -e 's/#security_driver = "selinux"/security_driver = "none"/g' /etc/libvirt/qemu.conf
-
Start libvirtd and check status:
sudo systemctl start libvirtd sudo systemctl status libvirtd
-
Download your favorite Linux cloud image e.g. Ubuntu Cloud Image to
/var/lib/libvirt/images
directory:sudo curl -L https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img --output /var/lib/libvirt/images/focal-server-cloudimg-amd64.img
-
Install Terraform project on you environment:
sudo 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 install terraform
-
Clone cloud-infra to your pc:
git clone https://github.com/go4clouds/cloud-infra
-
Copy settings file for Terraform:
cd ~/git/cloud-infra/libvirt cp terraform.tfvars.examples terraform.tfvars
-
Copy your
ssh-key
toterraform.tfvars
:
Show your key and copy itcat ~/.ssh/id_rsa.pub
If you don't have ssh keys, you can create them using command:
ssh-keygen
Open
terraform.tfvars
placed in~/git/cloud-infra/libvirt/
vim ~/git/cloud-infra/libvirt/terraform.tfvars
and paste your key as shown:
authorized_keys = [ "<YOUR_KEY>" ]
-
Start Terraform:
terraform init terraform plan terraform apply --auto-approve
-
After all, you can clean up using:
terraform destroy --auto-approve
Cloud-infra uses a number of open source projects to work properly:
- Terraform - codifies cloud APIs into declarative configuration files
- Kernel Virtual Machine - is a full virtualization solution for Linux on x86 hardware containing virtualization extensions
- Libvirt - is a toolkit to manage virtualization platforms
- Bridge Utils- a utility needed to create, manage and setting up networks for a hosted virtual machine
- Virtual Machine Manager- is a desktop user interface for managing virtual machines through libvirt
- Git- version control system
- Virtual Machine Manager- tools for accessing and modifying virtual machine disk images
And of course Cloud-infra is open source with a repository on GitHub.
Hardware for properly working Cloud-infra
Physical server or PC with:
Recommended | |
---|---|
CPU | 8x core |
RAM | 24 GB |
Disk Space | 256 GB |
OS | Linux OS |
Plugins for Cloud-infra
Plugin | Readme |
---|---|
dmacvicar | Readme |
hashicorp/null | Readme |
hashicorp/template | Readme |