Introduction to Kubernetes Setup for Odoo

With your virtual infrastructure already built using Proxmox, the next major step is setting up your Kubernetes cluster — the core of your containerized Odoo ERP environment. In this post, we’ll walk through automating the Kubernetes setup for Odoo using kubeadm and Ansible. This ensures repeatability, consistency, and production-grade scalability.

Kubernetes setup for Odoo ERP with Ansible, kubeadm, and Longhorn storage

Why Use Kubernetes for Odoo?

Here’s why Kubernetes is ideal for Odoo:

  • Scalability: Instantly spin up or scale down Odoo pods.
  • Self-Healing: Automatically restarts failed containers.
  • Load Balancing: Evenly distributes traffic across Odoo replicas.
  • Resource Isolation: Securely separates Odoo, PostgreSQL, GitLab, and monitoring tools.

Tools Used in Kubernetes Setup for Odoo

To automate the deployment:

  • kubeadm – Bootstraps the Kubernetes control plane
  • Ansible – Provisions VMs, installs OS packages, and configures Kubernetes

🔗 Read about kubeadm

Cluster Topology for Odoo Deployment

We recommend starting with:

  • 1x Master Node
  • 2x Worker Nodes

All nodes should run Ubuntu 22.04 or Debian 12 with static IPs.

Step 1: Define Your Ansible Inventory

Create inventory/hosts.ini:

[master]
k8s-master ansible_host=192.168.100.10 ansible_user=ubuntu

[workers]

k8s-worker-1 ansible_host=192.168.100.11 ansible_user=ubuntu k8s-worker-2 ansible_host=192.168.100.12 ansible_user=ubuntu

[k8s:children]

master workers

Step 2: Prepare the OS with Ansible

Run the base playbook:

ansible-playbook -i inventory/hosts.ini playbooks/02-init-base-os.yml

This automates:

  • Installing curl, containerd, and Kubernetes prerequisites
  • Disabling swap
  • Configuring hostname and /etc/hosts resolution

Step 3: Bootstrap the Kubernetes Cluster

Initialize the cluster and join nodes:

ansible-playbook -i inventory/hosts.ini playbooks/03-install-k8s.yml

This covers:

  • Running kubeadm init
  • Setting up kubectl config
  • Installing Calico or Flannel
  • Joining worker nodes

Step 4: Enable Persistent Storage with Longhorn

Use the following playbook:

ansible-playbook -i inventory/hosts.ini playbooks/04-deploy-longhorn.yml

Longhorn ensures distributed storage for Odoo and PostgreSQL pods.

🔗 Longhorn Storage Docs

Step 5: Verify Your Kubernetes Setup

From your master node:

kubectl get nodes
kubectl get pods --all-namespaces

You should see all nodes in Ready state and essential services running smoothly.

What’s Next?

In the next article, we’ll walk through deploying Odoo and PostgreSQL inside Kubernetes using Helm — a critical step in creating a high-performance ERP backend.

🔁 Previous: Setting Up Proxmox for Odoo
🔁 Next: Deploying Odoo with Helm

🛠️ Need the full Ansible automation repo? Contact me or view the GitHub

Leave a Reply