| name | kcli-configuration |
| description | Guides kcli configuration and provider setup. Use when setting up ~/.kcli/config.yml, configuring providers (KVM, AWS, GCP, Azure, etc.), or managing profiles. |
kcli Configuration
Configuration Files Location
~/.kcli/
├── config.yml # Main configuration (clients/providers)
├── profiles.yml # VM profiles (optional, can be in config.yml)
├── id_rsa / id_rsa.pub # SSH keys for VM access
├── id_ed25519 # Alternative SSH key
└── clusters/ # Cluster state (created by kcli)
Basic config.yml Structure
default:
client: localhost
numcpus: 2
memory: 512
pool: default
nets:
- default
disks:
- size: 10
localhost:
type: kvm
host: 127.0.0.1
Provider Types
| Type | Description | Required Fields |
|---|
kvm | Local/remote libvirt | host |
aws | Amazon Web Services | access_key_id, access_key_secret, region |
gcp | Google Cloud Platform | credentials, project, zone |
azure | Microsoft Azure | subscription_id, credentials (file) |
kubevirt | VMs on Kubernetes | context, host |
openstack | OpenStack cloud | auth_url, user, password, project |
ovirt | oVirt/RHV | host, user, password, datacenter |
vsphere | VMware vSphere | host, user, password, datacenter |
proxmox | Proxmox VE | host, user, password |
hcloud | Hetzner Cloud | token |
ibm | IBM Cloud | iam_api_key, region, vpc |
KVM/Libvirt Configuration
localhost:
type: kvm
host: 127.0.0.1
pool: default
remote-kvm:
type: kvm
host: 192.168.1.100
protocol: ssh
user: root
pool: default
AWS Configuration
myaws:
type: aws
access_key_id: AKIAIOSFODNN7EXAMPLE
access_key_secret: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
region: us-east-1
keypair: mykey
GCP Configuration
mygcp:
type: gcp
credentials: ~/service-account.json
project: my-project-id
zone: us-central1-a
region: us-central1
Azure Configuration
myazure:
type: azure
subscription_id: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
credentials: ~/.azure/credentials.json
location: eastus
resource_group: my-rg
KubeVirt Configuration
mykubevirt:
type: kubevirt
context: my-k8s-context
host: api.cluster.local
pool: my-storageclass
multus: true
cdi: true
OpenStack Configuration
myopenstack:
type: openstack
auth_url: https://openstack:5000/v3
user: admin
password: secret
project: myproject
domain: Default
oVirt/RHV Configuration
myovirt:
type: ovirt
host: ovirt-engine.local
user: admin@internal
password: secret
datacenter: Default
cluster: Default
pool: DataDomain
ca_file: ~/ovirt.pem
Default Section Options
default:
client: localhost
numcpus: 2
memory: 512
cpumodel: host-model
nested: true
pool: default
disks:
- size: 10
diskinterface: virtio
diskthin: true
nets:
- default
reservedns: false
reservehost: false
reserveip: false
cloudinit: true
keys: []
cmds: []
files: []
tunnel: false
insecure: false
enableroot: true
storemetadata: false
planview: false
Profiles (profiles.yml or in config.yml)
small:
numcpus: 1
memory: 1024
disks:
- size: 10
medium:
numcpus: 2
memory: 2048
disks:
- size: 20
large:
numcpus: 4
memory: 4096
disks:
- size: 40
- size: 100
webserver:
image: centos9stream
numcpus: 2
memory: 4096
nets:
- default
cmds:
- dnf -y install nginx
- systemctl enable --now nginx
base: medium
Multiple Clients
default:
client: local-kvm
local-kvm:
type: kvm
host: 127.0.0.1
remote-kvm:
type: kvm
host: 192.168.1.100
myaws:
type: aws
access_key_id: ...
access_key_secret: ...
region: us-east-1
Switch clients:
kcli switch local-kvm
kcli -C myaws list vm
Validation Commands
kcli list client
kcli list host
kcli info host
kcli switch <client>
kcli -C <client> list vm
Environment Variables
Some values can come from environment:
GOOGLE_APPLICATION_CREDENTIALS - GCP credentials path
AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY - AWS credentials
AZURE_AUTH_LOCATION - Azure credentials path
OS_* - OpenStack credentials (standard OS_ vars)
Troubleshooting
Connection refused (KVM):
sudo systemctl status libvirtd
virsh -c qemu:///system list
SSH key issues:
ssh-keygen -t rsa -N '' -f ~/.kcli/id_rsa
ssh-keygen -t ed25519 -N '' -f ~/.kcli/id_ed25519
Debug mode:
kcli -d list vm