This operator allows you to deploy and manage Odoo instances on Kubernetes with ease. It handles the lifecycle of the Odoo application, including provisioning PostgreSQL databases (managed or external), handling persistent storage, managing Odoo Enterprise and custom modules from Git repositories, and performing backups and restores.
- Managed Deployment: Automated deployment of Odoo (StatefulSet) and PostgreSQL (StatefulSet or external).
- Custom Modules Management:
- Install community or custom modules directly from Git repositories.
- Support for private repositories via SSH keys.
- Automatic updates of modules when configuration changes.
- Odoo Enterprise Ready: Easy configuration to pull Enterprise addons from the official private repository.
- Resource Control: Granular configuration of CPU/Memory for all containers.
- Backup & Restore: Native support for backing up the Odoo database and restoring it (
OdooBackupandOdooRestoreCRDs). - Automatic Upgrades: Triggers migration scripts (
odoo -u ...) automatically when the Odoo version changes.
# Install CRDs and deploy the operator manager
make install
make deploy IMG=alterway/odoo-operator:latestCreate a simple Odoo Community instance with a managed PostgreSQL database.
apiVersion: cloud.alterway.fr/v1alpha1
kind: Odoo
metadata:
name: odoo-community
namespace: default
spec:
version: "19"
size: 1
service:
type: LoadBalancer
ingress:
enabled: true
host: odoo.example.com
tls: true
storage:
data:
size: "5Gi"
postgres:
size: "5Gi"
modules:
install:
- sale
- websiteThis example demonstrates how to deploy Odoo Enterprise and install custom modules from a private Git repository.
Prerequisites:
- Create a Kubernetes Secret
ssh-key-odoocontaining the SSH private key for the Enterprise repo. - Create a Kubernetes Secret
ssh-key-customfor your private custom repository.
apiVersion: cloud.alterway.fr/v1alpha1
kind: Odoo
metadata:
name: odoo-enterprise
spec:
version: "18.0"
enterprise:
enabled: true
sshKeySecretRef: ssh-key-odoo # Secret containing 'ssh-privatekey'
modules:
# Clone custom addons from a private Git repo
repositories:
- name: my-custom-addons
url: git@github.com:my-org/my-odoo-addons.git
version: "18.0"
sshKeySecretRef: ssh-key-custom
# List of modules to install (from core, enterprise, or custom repos)
install:
- account_accountant # Enterprise module
- my_custom_module # From the custom repo
- saleBackup:
apiVersion: cloud.alterway.fr/v1alpha1
kind: OdooBackup
metadata:
name: backup-daily
spec:
odooRef:
name: odoo-enterprise
storageLocation:
pvc:
claimName: backup-pvcRestore:
apiVersion: cloud.alterway.fr/v1alpha1
kind: OdooRestore
metadata:
name: restore-job
spec:
odooRef:
name: odoo-enterprise
backupSource:
odooBackupRef:
name: backup-daily
restoreMethod: StopAndRestore # Will stop Odoo, restore DB, and restartTo enable scalable session storage, you can configure Odoo to use Redis. The operator can manage a Redis instance for you or connect to an external one.
Managed Redis:
apiVersion: cloud.alterway.fr/v1alpha1
kind: Odoo
metadata:
name: odoo-ha
spec:
version: "19"
size: 2 # Now you can scale Odoo!
redis:
enabled: true
managed: trueExternal Redis:
apiVersion: cloud.alterway.fr/v1alpha1
kind: Odoo
metadata:
name: odoo-external-redis
spec:
# ...
redis:
enabled: true
managed: false
host: "my-redis-service.default.svc.cluster.local"
port: 6379
secretRef: "my-redis-password" # Secret containing 'password' key
databaseIndex: 0
prefix: "odoo_prod"
isCacheEnabled: true
cacheDatabaseIndex: 1
options: # These options will be merged into odoo.conf. Password can be passed via env var or directly from secret.
session_store: redis
session_redis_host: my-redis-service.default.svc.cluster.local
session_redis_port: "6379"
session_redis_dbindex: "0"
session_redis_prefix: odoo_prod
session_redis_password: ${REDIS_PASSWORD} # Odoo will pick this up from environment variables if set in StatefulSet
enable_redis: "True" # For cache (requires appropriate Odoo modules)
redis_host: my-redis-service.default.svc.cluster.local
redis_port: "6379"
redis_dbindex: "1"
redis_password: ${REDIS_PASSWORD}Note: For external Redis, you must manually ensure that the REDIS_PASSWORD environment variable (or equivalent, depending on your Odoo image) is passed to the Odoo Pods, typically by referencing the secretRef in the Odoo StatefulSet configuration. When redis.managed is true, the operator handles this automatically.## Configuration Reference
| Field | Description | Default |
|---|---|---|
version |
Odoo version tag (e.g., "19", "18.0") | "19" |
size |
Number of Odoo replicas | 1 |
database |
External DB config. If empty, a managed Postgres is created. | - |
enterprise |
Configuration for Enterprise edition (enabled, repo, key). | - |
modules |
List of modules to install and external Git repositories. | - |
redis |
Configuration for Redis session storage. | - |
storage |
PVC configurations for data, logs, addons, and postgres. | - |
resources |
Resource requests/limits for containers. | - |
(See CRD definitions in api/v1alpha1 for full details)
Prerequisites
- go version v1.24.6+
- docker version 17.03+.
- kubectl version v1.11.3+.
- Access to a Kubernetes v1.11.3+ cluster.
Run locally:
make install
make runRun tests:
make testCopyright 2025.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.