VMware vSphere Deployment
This guide covers automating PiVirt cluster deployments onto VMware vSphere and ESXi infrastructure using deployer and vSphere automation APIs.
Prerequisites
Section titled “Prerequisites”VMware Requirements
Section titled “VMware Requirements”- vCenter Server 7.0+ or 8.0+
- ESXi hosts with KVM-compatible CPUs (VT-x/AMD-V)
- Shared storage (vSAN, NFS, or VMFS)
- Network with VLAN support
- VM templates for PiVirt nodes
Credentials
Section titled “Credentials”providers: vmware: enabled: true default_vcenter: "vcenter.pilab.hu" default_user: "administrator@vsphere.local" password_ref: "vault:secret/data/vmware#password" datacenter: "DC1" cluster: "PiVirt-Cluster" datastore: "vsanDatastore" network: "VM Network" template_folder: "Templates/PiVirt"Deployment Configuration
Section titled “Deployment Configuration”Cluster Definition
Section titled “Cluster Definition”apiVersion: deployer.pilab.hu/v1kind: Deploymentmetadata: name: "pivirt-vmware-staging"spec: provider: "vmware" topology: control_plane: count: 3 template: "pivirt-cp-template" customization: cpu: 4 memory: 16Gi disk: 100Gi workers: count: 3 template: "pivirt-worker-template" customization: cpu: 8 memory: 32Gi disk: 200Gi
customization: domain: "pilab.hu" dns_servers: - "10.0.1.5" - "10.0.1.6" ntp_servers: - "time.pilab.hu" timezone: "Europe/Budapest"
cloud_init: template: "vmware-node.yaml.tmpl" vars: pivirt_version: "v0.0.89" cluster_name: "pivirt-vmware-staging"Create VM Templates
Section titled “Create VM Templates”Control Plane Template
Section titled “Control Plane Template”# Create base VMgovc vm.create \ -ds=vsanDatastore \ -net="VM Network" \ -m=16384 \ -c=4 \ -disk=100GB \ -on=false \ pivirt-cp-base
# Install Ubuntu 24.04govc vm.power -on pivirt-cp-base
# Install PiVirt components# ... (install pivirtd, agent, pvcli)
# Shutdown and convert to templategovc vm.power -off pivirt-cp-basegovc vm.markastemplate pivirt-cp-baseWorker Template
Section titled “Worker Template”# Similar process for worker templategovc vm.create \ -ds=vsanDatastore \ -net="VM Network" \ -m=32768 \ -c=8 \ -disk=200GB \ -on=false \ pivirt-worker-base
# Install and configure# ...
govc vm.markastemplate pivirt-worker-baseDeployment Process
Section titled “Deployment Process”1. Plan Deployment
Section titled “1. Plan Deployment”deployer plan -f deploy/vmware-cluster.yaml2. Apply Deployment
Section titled “2. Apply Deployment”deployer apply -f deploy/vmware-cluster.yaml3. Monitor Progress
Section titled “3. Monitor Progress”deployer status -n pivirt-vmware-stagingdeployer logs -n pivirt-vmware-staging --follow4. Verify Deployment
Section titled “4. Verify Deployment”pvcli cluster get stagingpvcli cluster node listcloud-init Template
Section titled “cloud-init Template”#cloud-confighostname: {{ .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 - open-vm-tools - pivirt-agent - pvcli
runcmd: - systemctl enable --now open-vm-tools - systemctl enable --now pivirt-agent - systemctl enable --now pivirtd
final_message: "PiVirt node {{ .node_name }} provisioned on VMware"Troubleshooting
Section titled “Troubleshooting”VM Won’t Start
Section titled “VM Won’t Start”# Check vCentergovc vm.info pivirt-cp-01
# Check logsgovc vm.console pivirt-cp-01Template Issues
Section titled “Template Issues”# List templatesgovc find -type m -template true
# Convert back to VMgovc vm.markasvm pivirt-cp-base