Skip to main content

Quick Start

This is a quick start guide for using the project to deploy kubernetes on ProxmoxVE nodes.This quick start guide will create a cluster consist of:

  • 2 Loadbalancer nodes
  • 3 control plane nodes
  • 1 worker node

Prerequisite

This guide assume you have following things:

Deployment

The deployment divided into 2 stages: create VMs and build cluster, corresponding to function of Terraform and Ansible.

Create VMs

Go to the infra directory and copy the example tfvar configuration.

cp ./vars/tfvars.example ./your-values.auto.tfvars

Here are the things you need to modify:

NameDescribe
cloud_init_config.template.ssh_public_keySSH key will insert to new VMs
All of the datastore_idWhere to storage the data
All of the *_vm_config.network_devicesNICs of VMs
All of the cloud_init_*_network_configsHow to allocate IP address
vmsFQDN of VMs
available_nodesName of ProxmoxVE nodes to deploy the VMs
cloud_providerHow to connect your ProxmoxVE nodes

After modified the fields above, you can initialize the terraform and run the deploy command.

terraform init
terraform apply

The apply command may need 5 minuites or more, be patient. After you get the success message. You can find there is a file named inventory.gen.

Make sure the nodes can connect each other with the FQDN. If the FQDN not work, replace all of FQDNs by IP address.

You also need uncomment ansible_ssh_extra_args and edit ansible_ssh_private_key_file with private key path in the inventory file.

Build Cluster

Go to the bootstrap directory and copy the inventory.gen to here, and named it to inventory. Copy the files in tools_playbook to here.

cp ../infra/inventory.gen ./inventory
cp ./tools_playbook/* ./

Edit the keepalived.virtual_ip in ./vars/custom.yml, it will be the HA address of control plane. Then deploy the cluster.

ansible-playbook -i inventory deploy.playbook.yml

Play with cluster

After the ansible command, you will find there is a /tmp/kubeconfig.yaml file contain the credentials of cluster. Copy it to the ~/.kube/config and try to get nodes.

kubectl get nodes -o wide

You shold install kured to handle the autoreboot of kubernetes node.