Skip to content

Cloud Deployment

This guide covers automating PiVirt infrastructure provisioning on hyperscale cloud platforms (AWS, Google Cloud, Microsoft Azure) using deployer and cloud-native APIs.

  • AWS account with appropriate permissions
  • VPC with private subnets
  • Security groups configured
  • EC2 key pair
  • IAM roles for EC2 instances
/etc/deployer/config.yaml
providers:
aws:
enabled: true
default_region: "eu-central-1"
credentials_ref: "vault:secret/data/aws#credentials"
deploy/aws-cluster.yaml
apiVersion: deployer.pilab.hu/v1
kind: Deployment
metadata:
name: "pivirt-aws-eu-central-1"
spec:
provider: "aws"
region: "eu-central-1"
topology:
control_plane:
count: 3
instance_type: "m6i.xlarge"
ami: "ami-0abc123" # Ubuntu 24.04
volume_size: 50
volume_type: "gp3"
workers:
count: 6
instance_type: "m6i.2xlarge"
ami: "ami-0abc123"
volume_size: 200
volume_type: "gp3"
network:
vpc_id: "vpc-0123456789"
subnets:
- "subnet-0123456789" # private-a
- "subnet-0123456788" # private-b
- "subnet-0123456787" # private-c
security_groups:
- "sg-pivirt-control-plane"
- "sg-pivirt-workers"
iam_instance_profile: "pivirt-node-profile"
cloud_init:
template: "aws-node.yaml.tmpl"
Terminal window
deployer apply -f deploy/aws-cluster.yaml
  • GCP project with billing enabled
  • VPC network with subnets
  • Service account with appropriate roles
  • SSH keys
/etc/deployer/config.yaml
providers:
gcp:
enabled: true
default_project: "pilab-prod"
region: "europe-west1"
credentials_ref: "vault:secret/data/gcp#credentials"
deploy/gcp-cluster.yaml
apiVersion: deployer.pilab.hu/v1
kind: Deployment
metadata:
name: "pivirt-gcp-europe-west1"
spec:
provider: "gcp"
project: "pilab-prod"
region: "europe-west1"
topology:
control_plane:
count: 3
machine_type: "n2-standard-4"
image_family: "ubuntu-2404-lts"
disk_size: 50
disk_type: "pd-ssd"
workers:
count: 6
machine_type: "n2-standard-8"
image_family: "ubuntu-2404-lts"
disk_size: 200
disk_type: "pd-ssd"
network:
network: "pivirt-vpc"
subnetwork: "pivirt-subnet"
tags:
- "pivirt-node"
service_account: "pivirt-node@pilab-prod.iam.gserviceaccount.com"
cloud_init:
template: "gcp-node.yaml.tmpl"
Terminal window
deployer apply -f deploy/gcp-cluster.yaml
templates/aws-node.yaml.tmpl
#cloud-config
hostname: {{ .node_name }}
fqdn: {{ .node_name }}.pilab.hu
users:
- name: pivirt
groups: [sudo, docker, kvm]
sudo: ALL=(ALL) NOPASSWD:ALL
ssh_authorized_keys:
- {{ .ssh_public_key }}
packages:
- qemu-kvm
- awscli
- pivirt-agent
- pvcli
runcmd:
- systemctl enable --now pivirt-agent
- systemctl enable --now pivirtd
- aws configure set region eu-central-1
final_message: "PiVirt node {{ .node_name }} provisioned on AWS"
templates/gcp-node.yaml.tmpl
#cloud-config
hostname: {{ .node_name }}
fqdn: {{ .node_name }}.pilab.hu
users:
- name: pivirt
groups: [sudo, docker, kvm]
sudo: ALL=(ALL) NOPASSWD:ALL
ssh_authorized_keys:
- {{ .ssh_public_key }}
packages:
- qemu-kvm
- google-cloud-sdk
- pivirt-agent
- pvcli
runcmd:
- systemctl enable --now pivirt-agent
- systemctl enable --now pivirtd
final_message: "PiVirt node {{ .node_name }} provisioned on GCP"
Terminal window
# Check instance status
aws ec2 describe-instances --instance-ids i-1234567890abcdef0
# Check instance logs
aws ec2 get-console-output --instance-id i-1234567890abcdef0
# SSH into instance
ssh -i ~/.ssh/pivirt.pem ubuntu@10.0.1.10
Terminal window
# Check instance status
gcloud compute instances describe pivirt-cp-01 --zone=europe-west1-b
# Check serial port output
gcloud compute instances get-serial-port-output pivirt-cp-01 --zone=europe-west1-b
# SSH into instance
gcloud compute ssh pivirt-cp-01 --zone=europe-west1-b