|
| 1 | +--- |
| 2 | +title: "Run PostgreSQL 18 on Kubernetes Today with CloudNativePG" |
| 3 | +date: 2025-09-26T13:30:38+02:00 |
| 4 | +description: "Run the new PostgreSQL 18 on Kubernetes in minutes with CloudNativePG and our new half-sized minimal image." |
| 5 | +tags: ["postgresql", "postgres", "kubernetes", "k8s", "cloudnativepg", "cnpg", "postgresql", "postgres", "dok", "data on kubernetes", "pg18", "postgresql 18", "minimal images"] |
| 6 | +cover: cover.jpg |
| 7 | +thumb: thumb.jpg |
| 8 | +draft: false |
| 9 | +--- |
| 10 | + |
| 11 | +_PostgreSQL 18 is officially released, packed with improvements for |
| 12 | +performance, authentication, operations, and security. In this article, I'll |
| 13 | +show you how to run it on Kubernetes from day one with CloudNativePG. I will |
| 14 | +summarise key new features like asynchronous I/O and OAuth 2.0, as well as the |
| 15 | +`extension_control_path` parameter. This is a simple but critical feature for |
| 16 | +operational control in cloud-native environments, and one our team at |
| 17 | +CloudNativePG and EDB was proud to help contribute to PostgreSQL. You'll see how |
| 18 | +this reflects our close collaboration with the upstream community, learn about |
| 19 | +our new half-sized `minimal` container image, and be able to follow my |
| 20 | +guide to deploy your first cluster today._ |
| 21 | + |
| 22 | +<!--more--> |
| 23 | + |
| 24 | +--- |
| 25 | + |
| 26 | +This Thursday, 25 September 2025, marks the |
| 27 | +[official release of **PostgreSQL 18**](https://www.postgresql.org/about/news/postgresql-18-released-3142/), |
| 28 | +the world’s most advanced open-source database. Every major release of |
| 29 | +[PostgreSQL](https://www.postgresql.org/) is an important milestone for our |
| 30 | +community — and this one brings exciting improvements in performance, |
| 31 | +authentication, and security. You can find the full list of changes in the |
| 32 | +[PostgreSQL 18 release notes](https://www.postgresql.org/docs/18/release-18.html). |
| 33 | + |
| 34 | +Good news: with CloudNativePG and the updated |
| 35 | +[`postgres-containers`](https://github.com/cloudnative-pg/postgres-containers), |
| 36 | +you can run PostgreSQL 18 on Kubernetes today — using a new `minimal` image |
| 37 | +that’s nearly half the size of PostgreSQL 17. |
| 38 | + |
| 39 | +--- |
| 40 | + |
| 41 | +## PostgreSQL 18 in Brief |
| 42 | + |
| 43 | +PostgreSQL 18 is packed with features that enhance performance, security, and |
| 44 | +operational management. Among the most notable improvements for cloud-native |
| 45 | +environments are: |
| 46 | + |
| 47 | +- **Asynchronous I/O subsystem**: This fundamental change unlocks significant |
| 48 | + performance gains for I/O-bound operations like sequential scans, `VACUUM`, |
| 49 | + and bitmap heap scans, making workloads on large databases much faster. |
| 50 | + |
| 51 | +- **B-tree skip scans**: Multi-column indexes can now be used even when the |
| 52 | + leading column isn't part of the query predicate, potentially eliminating the |
| 53 | + need for many specialised indexes and saving significant storage space. |
| 54 | + Relevant for very large databases (VLDBs). |
| 55 | + |
| 56 | +- **OAuth 2.0 authentication**: A major step forward for modern identity |
| 57 | + integration, simplifying secure access in complex enterprise environments. |
| 58 | + I'll be covering this topic at the upcoming |
| 59 | + [KubeCon North America in Atlanta (November 2025)](https://kccncna2025.sched.com/event/27FXv). |
| 60 | + |
| 61 | +- **Trusted path for extension installation (`extension_control_path`)**: As a |
| 62 | + strong advocate and reviewer for this feature, I believe it's a critical step |
| 63 | + forward for PostgreSQL's future in cloud-native, immutable infrastructures. |
| 64 | + This parameter allows administrators to define a specific, trusted, and |
| 65 | + possibly read-only directory for extension control files. This perfectly aligns |
| 66 | + with the declarative management model of CloudNativePG and the new "image |
| 67 | + volumes" feature in Kubernetes. You can read a deep dive in my previous article |
| 68 | + [“The Immutable Future of PostgreSQL Extensions in Kubernetes with CloudNativePG”]({{< relref "../20250303-volume-source-extension-control-path/index.md" >}}). |
| 69 | + |
| 70 | +- **Minor but useful additions**: `postgres_fdw` can now forward client-side |
| 71 | + SCRAM authentication to remote servers, and the new `fips_mode()` function |
| 72 | + makes it easy to verify if the server is running in FIPS-compliant mode. |
| 73 | + |
| 74 | +It is also important to mention that PostgreSQL 18 finally deprecates |
| 75 | +**MD5 password authentication**, pushing the ecosystem toward more secure |
| 76 | +defaults. |
| 77 | + |
| 78 | +--- |
| 79 | + |
| 80 | +## CloudNativePG and `postgres-containers` |
| 81 | + |
| 82 | +CloudNativePG is ready to run PostgreSQL 18. Part of its ecosystem is the |
| 83 | +[`postgres-containers`](https://github.com/cloudnative-pg/postgres-containers) |
| 84 | +project, where the CloudNativePG community builds and maintains container |
| 85 | +images for PostgreSQL. |
| 86 | + |
| 87 | +For PostgreSQL 18, we’ve introduced |
| 88 | +[a change in the building system](https://github.com/cloudnative-pg/postgres-containers/pull/311) |
| 89 | +that makes the `minimal` image particularly lightweight: |
| 90 | + |
| 91 | +- **PostgreSQL 17 `minimal` image**: \~412 MB |
| 92 | +- **PostgreSQL 18 `minimal` image**: \~232 MB |
| 93 | + |
| 94 | +The difference comes from |
| 95 | +[a new package called `postgresql-18-jit`](https://www.postgresql.org/message-id/20250224134829.286cc256%40ardentperf.com), |
| 96 | +which contains LLVM JIT support. This package has been moved out of the `minimal` |
| 97 | +image and is now included in the `standard` image, which is built on top of |
| 98 | +the `minimal`. |
| 99 | + |
| 100 | +This design keeps the `minimal` image lean for those who want fast pulls and |
| 101 | +smaller footprints with reduced attack surface, while still making JIT |
| 102 | +available when needed through the standard image. |
| 103 | + |
| 104 | +## Hands-on: Create a PostgreSQL 18 Cluster with the `minimal` Image |
| 105 | + |
| 106 | +> **NOTE:** You’ll need a Kubernetes environment for this hands-on. |
| 107 | +> The easiest way to get started is with `kind`; follow |
| 108 | +> [“CloudNativePG Recipe 1 – Setting up your local playground in minutes”]({{< relref "../20240303-recipe-local-setup/index.md" >}}) |
| 109 | +> to have one ready quickly. |
| 110 | +
|
| 111 | +Running PostgreSQL 18 on Kubernetes with CloudNativePG is straightforward. |
| 112 | +Below is a simple example showing how to deploy a cluster using the `minimal` |
| 113 | +image on Debian Trixie (13, current `stable` release). |
| 114 | + |
| 115 | +1. **Create a `Cluster` manifest** (`angus.yaml`) |
| 116 | + |
| 117 | +```yaml |
| 118 | +{{< include "yaml/angus.yaml" >}} |
| 119 | +``` |
| 120 | + |
| 121 | +2. **Apply the manifest** |
| 122 | + |
| 123 | +```bash |
| 124 | +kubectl apply -f angus.yaml |
| 125 | +``` |
| 126 | + |
| 127 | +3. **Check cluster status** |
| 128 | + |
| 129 | +```bash |
| 130 | +kubectl cnpg status angus |
| 131 | +``` |
| 132 | + |
| 133 | +You should see your cluster up and running with PostgreSQL 18. |
| 134 | + |
| 135 | +4. **Connect and verify** |
| 136 | + |
| 137 | +```bash |
| 138 | +kubectl cnpg psql angus -- -c 'SELECT version()' |
| 139 | +``` |
| 140 | + |
| 141 | +You’ll see confirmation that you’re running PostgreSQL 18 inside Kubernetes. |
| 142 | + |
| 143 | +```console |
| 144 | + version |
| 145 | +-------------------------------------------------------------------------------------------------------------------------- |
| 146 | + PostgreSQL 18.0 (Debian 18.0-1.pgdg13+3) on aarch64-unknown-linux-gnu, compiled by gcc (Debian 14.2.0-19) 14.2.0, 64-bit |
| 147 | +(1 row) |
| 148 | +``` |
| 149 | + |
| 150 | +# Conclusion |
| 151 | + |
| 152 | +PostgreSQL 18 is here, and with CloudNativePG, you can run it on Kubernetes |
| 153 | +right away. The `postgres-containers` project delivers fresh, secure |
| 154 | +images—including a streamlined `minimal` variant—enabling you to test the |
| 155 | +latest features and prepare for production from day one. |
| 156 | + |
| 157 | +This rapid, day-one availability is no accident. As you can see, the |
| 158 | +CloudNativePG community works very closely with the PostgreSQL project, not |
| 159 | +just as users but as active contributors. This deep involvement allows us to |
| 160 | +anticipate changes and even help shape features—like the new |
| 161 | +`extension_control_path`—that are vital for running PostgreSQL securely and |
| 162 | +efficiently in modern, cloud-native environments. We are committed to bridging |
| 163 | +these two worlds and delivering the best possible PostgreSQL experience on |
| 164 | +Kubernetes. |
| 165 | + |
| 166 | +--- |
| 167 | + |
| 168 | +Stay tuned for the upcoming recipes! For the latest updates, consider |
| 169 | +subscribing to my [LinkedIn](https://www.linkedin.com/in/gbartolini/) and |
| 170 | +[Twitter](https://twitter.com/_GBartolini_) channels. |
| 171 | + |
| 172 | +If you found this article informative, feel free to share it within your |
| 173 | +network on social media using the provided links below. Your support is |
| 174 | +immensely appreciated! |
0 commit comments