postgres-operator: pgo is not compatible with k8s v1.25

Overview

After upgrading to Kubernetes v1.25.0 the pgo pod is crashing because the CronJob batch/v1beta1 API is no longer served. The code for the operator needs to be updated to (also) look for the batch/v1 apiVersion which has been GA since k8s v1.21

$ k get pod -n postgres-operator
NAME                           READY   STATUS             RESTARTS      AGE
pgo-6d89f7c7cb-4dhkf           0/1     CrashLoopBackOff   7 (68s ago)   12m
pgo-upgrade-6f956b867c-4tzts   1/1     Running            0             12m

I am using the latest version of the postgres-operator Helm chart from here

Environment

Please provide the following details:

  • Platform: Kubernetes
  • Platform Version: v1.25.0

Steps to Reproduce

  1. Install the latest version of the PGO
  2. Upgrade Kubernetes to v1.25.0
  3. Observe that the pgo pod is now crash looping

EXPECTED

  1. To not crash after the k8s upgrade

ACTUAL

  1. pgo pod goes into CrashLoopBackoff due to the beta CronJob API not being served

Logs

time="2022-08-29T15:33:28Z" level=error msg="if kind is a CRD, it should be installed before calling Start" error="no matches for kind \"CronJob\" in version \"batch/v1beta1\"" file="sigs.k8s.io/controller-runtime@v0.8.3/pkg/log/deleg.go:144" func="log.(*DelegatingLogger).Error" kind=CronJob.batch version=5.1.3-0
panic: no matches for kind "CronJob" in version "batch/v1beta1"

goroutine 1 [running]:
main.assertNoError(...)
        github.com/crunchydata/postgres-operator/cmd/postgres-operator/main.go:40
main.main()
        github.com/crunchydata/postgres-operator/cmd/postgres-operator/main.go:100 +0x550

Furthermore, while CronJobs are required for backups, they aren’t critical for managing the lifecycle of the database cluster from what I can tell. It may be better to emit a warning and skip trying to reconcile the CronJob(s) objects instead of crashing the application.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 11
  • Comments: 18 (5 by maintainers)

Most upvoted comments

We are currently planning a mid-December release for PGO v5.3.0, which will include the changes required for Kubernetes v1.25 compatibility.

I also wanted to point out the Crunchy Postgres for Kubernetes release policy, which specifically highlights our standard release cadence across each quarter. For instance, as described in the policy:

Crunchy Data anticipates the following release schedule for Crunchy PostgreSQL for Kubernetes:

  • At least one (1) PATCH release per quarter, timed around the PGDG Release
  • At least one (1) MINOR release per quarter, timed around the end-of-the-quarter

PGO v5.3.0 is therefore the new MINOR version of PGO that we’re looking to release this quarter.

Thanks for your feedback, and we appreciate your patience as we look to get this update released in the coming weeks!

When is the next release, approximately?

I’ve added support for Kubernetes 1.25 in #3370; experimental container build from those changes available at ghcr.io/jelmer/postgres-operator:rocky9-v4.5.0-855-g1b8413409

I have the same issue , also when installing fresh installtion on kubernetes 1.25 it fails to create CDR , it says :

The CustomResourceDefinition “postgresclusters.postgres-operator.crunchydata.com” is invalid: metadata.annotations: Too long: must have at most 262144 bytes

Try passing --server-side to kubectl; that should address it.

I have the same issue , also when installing fresh installtion on kubernetes 1.25 it fails to create CDR , it says :

The CustomResourceDefinition “postgresclusters.postgres-operator.crunchydata.com” is invalid: metadata.annotations: Too long: must have at most 262144 bytes

@youvegotmoxie as mentioned above, PR https://github.com/CrunchyData/postgres-operator/pull/3370 should resolve these issues and is planned to be available in the next release.

To clarify, PGO is fully compatible with Kubernetes 1.25.

The issue @haf references is unrelated, and cannot be reproduced (and is being addressed/discussed in https://github.com/CrunchyData/postgres-operator/issues/3549). Additionally, backups have been confirmed to work properly with the v5.3.0 release.

PGO v5.3.0 has been released! It is compatible with K8s v1.25, as noted above.

I just wanted to note on this thread that we are actively working on 1.25 compatibility/support, which will be included the next release of PGO.