logo

Postgres Extensions in Kubernetes

2021-10-13

Authors:   Alvaro Hernandez


Summary

The talk introduces a mechanism for dynamically loading Postgres extensions in Kubernetes, allowing for the use of an unlimited number of extensions without having to download new images.
  • Postgres extensions are software bundles that enhance the functionality of a Postgres database
  • Extensions are developed by third parties and can be delivered to users at any time
  • Extensions prevent forks of Postgres and can run on top of any existing Postgres without having to fork it
  • The new mechanism allows for dynamic loading of extensions in Kubernetes, avoiding the need to pack all possible extensions in a fat container or load dynamically under demand
  • The mechanism uses a 'pod-local controller' to watch for extensions that need to be installed, download and pack them, verify digital signatures, and make them available to Postgres
  • The mechanism allows for the use of more than 100 extensions and a growing number in the future
  • The talk invites feedback and ideas on the mechanism
Postgres extensions are often cited as one of the best features of Postgres, as they significantly augment the database's functionality and make it a very adaptable and rich database. They also allow for the development of new features that can be delivered to users at any time, without having to wait for the yearly release cycle of Postgres. Extensions have also prevented many forks of Postgres, as they can run on top of any existing Postgres without having to fork it. The new mechanism for dynamically loading extensions in Kubernetes allows for the use of an unlimited number of extensions without having to download new images, making it easier to run Postgres on Kubernetes.

Abstract

Postgres Extensions are one of the most distinctive and appreciated features of Postgres. Acting like “plugins”, they allow you to extend Postgres functionality. From adding simple data types to turning the database into a sharded cluster with a distributed query planner and executor. Yet they are hard to use in a container environment like Kubernetes. Because container images are immutable! So you either pack all possible extensions in a fat container, which leads to substantial problems; or you load dynamically under demand. Join this talk to explore the extension ecosystem in Kubernetes Postgres Operators; and how to solve this problem by introducing a system for dynamically loading extensions into the containers, and cache them within the cluster to avoid excessive downloads. A new operator pattern, the “pod-local controller” will also be introduced, as the technological solution that powers dynamic extension loading.

Materials: