odoo

by IMIO

Helm chartv4.0.1App 18.0Apache-2.0Verified publisher

An opiniated Helm Chart for deploying Odoo

About this chart

Helm Chart for Odoo

Introduction

This Helm chart installs Odoo in a Kubernetes cluster.

[!IMPORTANT] This helm chart is designed for @IMIO specific needs and is not intended to resolve all use cases. But we are open to contributions and suggestions to improve this helm chart. This Helm chart targets Odoo 16.0+ using the official Odoo Docker image. The default image tag is 18.0; override with image.tag as needed.

Prerequisites

[!NOTE] For production environments, it is recommended to use CloudNativePG for PostgreSQL. The bundled chart is primarily intended for testing and development purposes, do not use it in production.

  • Kubernetes cluster 1.25+
  • Helm 3.8.0+
  • PV provisioner support in the underlying infrastructure.
  • Postgres DB (This chart can install a PostgreSQL database based on the CloudPirates postgres chart, pinned to PostgreSQL 17). We use it for testing purposes.

Why do we not use the bitnami/odoo chart?

  • we want to use the official Odoo Docker Image or our custom Odoo Docker Image.
  • we need some specific configuration for our Odoo instance.

Installation

Pull Helm release

helm repo add imio https://imio.github.io/helm-charts
helm repo update

Verify the chart signature

Since release 3.0.1, packaged charts are signed. See IMIO/helm-charts — Verify chart signatures for how to verify.

Configure the chart

The following items can be set via --set flag during installation or configured by editing the values.yaml directly (need to download the chart first).

See the values.yaml file for more information.

Install the chart

helm install [RELEASE_NAME] imio/odoo

or by cloning this repository:

git clone https://github.com/imio/helm-odoo.git
cd helm-odoo
helm dep up
helm upgrade odoo . -f values.yaml --namespace odoo --create-namespace --install

Configuration

The following table lists the configurable parameters of the helm-odoo chart and the default values.

See the values.yaml file for more information.

Database configuration

Database configuration is split into two clearly-scoped sections:

  • postgresql.* — configures the bundled CloudPirates postgres subchart (official docker.io/postgres image, pinned to PostgreSQL 17.x via postgresql.image.tag), used only when postgresql.enabled: true (intended for dev/test). The subchart is aliased to postgresql, so the values key and the <release-name>-postgresql resource names are preserved. Odoo's connection is taken from postgresql.auth.*, the host is auto-derived as <release-name>-postgresql and the port is 5432. postgresql.auth.username / .password / .database configure the superuser (this chart has no separate postgresPassword; the named user is the superuser and gets a same-named database), or supply the password through postgresql.auth.existingSecret (default key postgres-password).
  • externalDatabase.* — connection settings for an external PostgreSQL (e.g. CloudNativePG), used only when postgresql.enabled: false. externalDatabase.host is required in this mode (templating fails fast if it is empty).

Only one section is ever read at a time, depending on postgresql.enabled — no key is shared between the bundled and external scenarios.

Use an existing Secret for Odoo configuration

You can use an existing secret for the Odoo configuration.

In the values.yaml file, set the existingSecret.enabled parameter to true. Then, create a Secret in your namespace named <release-name>-odoo-conf (or <fullnameOverride>-odoo-conf if fullnameOverride is set), containing the odoo.conf key.

Use external-secrets.io for Odoo configuration

In the values.yaml file, set the externalsecrets.enabled parameter to true.

You need to have the external-secrets.io operator 0.16 or later installed in your cluster (the chart renders external-secrets.io/v1 ExternalSecrets). See the external-secrets.io documentation for more information.

Two Vault keys are used: postgresqlKey (the PostgreSQL credentials — DB user password + superuser) and odooKey (Odoo's master admin_passwd). Each credential written into odoo.conf chooses its own key + property under externalsecrets.properties.odoo, so the DB password is stored in Vault once and shared with the PostgreSQL secret instead of being duplicated:

externalsecrets:
  enabled: true
  secretStoreRef:
    name: vault-backend
  postgresqlKey: secret/data/odoo/db      # DB user password + superuser
  odooKey: secret/data/odoo/app           # Odoo master password
  properties:
    postgresql:
      password: postgresql-password
      adminPassword: postgresql-admin-password
    odoo:
      postgresqlPassword:                 # odoo.conf db_password
        key: ""                           # "" -> postgresqlKey (falls back to odooKey)
        property: postgresql-password
      adminPasswd:                        # odoo.conf admin_passwd
        key: ""                           # "" -> odooKey
        property: odoo-admin-passwd
  • Share the DB password (default): leave postgresqlPassword.key empty. Both the PostgreSQL secret and odoo.conf's db_password read postgresqlKey — one value in Vault. To make all Odoo/DB secrets live in a single key, set postgresqlKey == odooKey.
  • Split keys: set postgresqlPassword.key (or adminPasswd.key) to any other Vault key to read that credential from a different location.
  • External DB (postgresql.enabled: false): the <release>-postgresql-secret is not rendered; leave postgresqlKey unset and set only odooKey — db_password falls back to odooKey (the pre-2.0.0 behavior).

[!WARNING] existingSecret.enabled and externalsecrets.enabled are mutually exclusive. Enabling both will cause helm install/helm upgrade to fail with an explicit error. Choose exactly one secret backend, or leave both disabled to have the chart generate secrets from values.yaml.

Database initialization and updates

Database lifecycle is handled by Helm hook Jobs that run at pre-install and pre-upgrade — before the Odoo/cron deployments are created or re-applied. Each Job scales any running Odoo/cron to 0, waits for the database to be reachable, then runs the migration; Helm brings the deployments back up afterwards.

Initialization (odoo.init)

odoo:
  init:
    enabled: true
    modules: base,web

Runs odoo -i <modules> -d <db> --stop-after-init. Treat enabled as a one-shot intent: set it true to initialise on install or to re-initialise after wiping the DB, then set it back to false — left on, every upgrade re-runs odoo -i (which scales Odoo to 0 for the duration, even though the command itself is a no-op on an already-installed database).

Updates (odoo.update)

odoo:
  update:
    enabled: true       # set true only for a version bump (causes downtime + migration)
    modules: all
    maintenancePage: true

Runs odoo -u <modules> -d <db> --stop-after-init (requires an already-initialised DB). With maintenancePage: true (requires ingress.enabled or extraIngresses), a temporary maintenance pod is created that the <release>-nginx Service routes to while Odoo is scaled to 0, without touching the ingress.

[!IMPORTANT] Set odoo.update.enabled back to false after the upgrade — left on, a scale-to-0 migration runs on every helm upgrade.

[!NOTE] Maintenance mode does not disable these hooks. maintenance.enabled: true only scales Odoo/cron to 0 and serves the maintenance page — the init/update Jobs still run on the next helm install/helm upgrade. This is intentional: you can migrate behind the maintenance page (set maintenance.enabled: true, then upgrade with odoo.update.enabled: true, then reopen). If you enter maintenance for something that must not touch the DB (e.g. a restore), make sure odoo.init.enabled and odoo.update.enabled are false. When both maintenance and a hook are enabled, helm install/helm upgrade prints a warning in its notes.

[!NOTE] Bundled PostgreSQL + hooks: Helm cannot deploy a subchart before the parent's pre-install hooks, so postgresql.enabled: true is not up when the Jobs run. For dev/test, run PostgreSQL as a pre-install hook via postgresql.commonAnnotations (helm.sh/hook: pre-install, weight below 0) — see test/local.yaml. Production should use an external database (postgresql.enabled: false + externalDatabase.*).

Production readiness checklist

The chart ships safe-by-default security settings (non-root containers, dropped capabilities, a dedicated ServiceAccount with the API token disabled), but a few things still need explicit configuration for production:

  • [ ] Persistence — set persistence.enabled: true with an appropriate storageClass/size. Without it the filestore lives on an emptyDir and Odoo attachments/sessions are lost on pod restart. For more than one replica the filestore must be ReadWriteMany.
  • [ ] External database — set postgresql.enabled: false and configure externalDatabase.* (e.g. CloudNativePG). The bundled CloudPirates PostgreSQL uses ephemeral storage and is dev/test only.
  • [ ] Secrets — use existingSecret.enabled: true or externalsecrets.enabled: true instead of inline odoo.admin_passwd / externalDatabase.password so credentials never live in plaintext values.
  • [ ] Resources — set resources (Odoo), nginx.resources and cron.resources.
  • [ ] securityContext — defaults assume the official Odoo image (odoo user, uid 100 / gid 101). If you use a custom image with a different user, override securityContext / containerSecurityContext / nginx.containerSecurityContext accordingly.

Local Setup for development

Create a kind cluster:

cat <<EOF | kind create cluster --config=-
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
  kubeadmConfigPatches:
  - |
    kind: InitConfiguration
    nodeRegistration:
      kubeletExtraArgs:
        node-labels: "ingress-ready=true"
  extraPortMappings:
  - containerPort: 80
    hostPort: 80
    protocol: TCP
  - containerPort: 443
    hostPort: 443
    protocol: TCP
EOF

Install the Nginx Ingress Controller:

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml

Create the odoo namespace:

kubectl create namespace odoo

Get the IP address of the kind-control-plane:

 docker container inspect kind-control-plane --format '{{ .NetworkSettings.Networks.kind.IPAddress }}'

Modify the /etc/hosts file with the IP address of the kind-control-plane and add the hostnames:

nano /etc/hosts
172.18.0.2 odoo.local

Modify the test/local.yaml file and run the helm chart:

helm dep up
helm upgrade odoo . -f test/local.yaml --namespace odoo --create-namespace --install

Cleanup:

helm uninstall odoo -n odoo

# Delete resources not managed by Helm (hook Jobs/RBAC left behind by uninstall)
kubectl delete all,serviceaccount,networkpolicies \
  -l app.kubernetes.io/instance=odoo \
  -n odoo --ignore-not-found

kind delete cluster

Contributing

Feel free to contribute by making a pull request.

Please read the official Helm Contribution Guide from Helm for more information on how you can contribute to this Chart.

Upgrading

To 4.0.0

Both changes only affect externalsecrets.enabled: true — other users are unaffected.

1. external-secrets.io/v1

The ExternalSecrets are now rendered as external-secrets.io/v1 instead of v1beta1, because External Secrets 2.x no longer serves v1beta1. v1 is served from External Secrets 0.16 on.

Upgrade the External Secrets operator to 0.16 or later before upgrading the chart. On an older operator (v1beta1 only), helm install/upgrade fails with no matches for kind ExternalSecret in version external-secrets.io/v1; stay on 3.2.x until the operator is upgraded.

2. externalsecrets.s3 replaced by externalsecrets.extraSecrets

The S3-specific section is replaced by the generic extraSecrets map (documented in values.yaml). If you set externalsecrets.s3, move it under extraSecrets.s3: properties becomes env, enabled goes away (an entry is active when present), and the S3_* mapping, which used to be the default, must now be written out:

# before (3.x)
externalsecrets:
  s3:
    enabled: true
    key: "secret/odoo/{{ .Values.instance_id }}/s3"

# after (4.0.0)
externalsecrets:
  extraSecrets:
    s3:
      key: "secret/odoo/{{ .Values.instance_id }}/s3"
      env:
        S3_ACCESS_KEY: access_key_id
        S3_SECRET_KEY: secret_access_key
        S3_ENDPOINT: endpoint
        S3_BUCKET_NAME: bucket
        S3_REGION: region

The generated resources keep their name

Deploy odoo with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has odoo on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartodoo is pinned at v4.0.1 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply