# V2.4.0 - Backup job pods are not being removed

**URL:** <https://forums.percona.com/t/v2-4-0-backup-job-pods-are-not-being-removed/32259>\
**Category:** Percona Operator for PostgreSQL\
**Created:** [August 13, 2024, 7:57pm UTC](https://forums.percona.com/t/v2-4-0-backup-job-pods-are-not-being-removed/32259 "2024-08-13T19:57:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michel\_Filipe](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/michel_filipe/32/11796_2.png) [@Michel\_Filipe](https://forums.percona.com/u/Michel_Filipe)\
**Post date:** [August 13, 2024, 7:57pm UTC](https://forums.percona.com/t/v2-4-0-backup-job-pods-are-not-being-removed/32259/1 "2024-08-13T19:57:11Z")

</div>

## Description:

Using Operator v2.4.0, the backup job pods aren’t being cleaned up. PerconaPGBackup are being deleted according to the retention configuration, but the backup job pods are not.

## Steps to Reproduce:

```auto
...
spec:
  backups:
    pgbackrest:
      configuration:
        - secret:
            name: pac-registry-db-pgbackrest-backup-s3
      global:
        repo1-path: /pgbackrest/harbor/harbor-db/repo1
        repo1-retention-diff: '5'
        repo1-retention-full: '3'
        repo1-retention-full-type: count
        repo1-s3-uri-style: path
      image: percona/percona-postgresql-operator:2.4.0-ppg13-pgbackrest
      ...
      repos:
        - name: repo1
          ...
          schedules:
            differential: 24 * * * *
            full: 48 1 * * *
  crVersion: 2.4.0
  ...

```

## Version:

Percona Postgresql Operator v2.4.0

## Expected Result:

The backup job pods be deleted following the retention policy.

## Actual Result:

The backup job pods are being kept when list all the pods.

## Additional Information

> <https://github.com/percona/percona-postgresql-operator/issues/676>
>
> \### Report
> 
> Sheduled kubernetes pg-backup objects are not automatically cleaned …up
> 
> \### More about the problem
> 
> Since the 2.3.0 k8s Percona Postgres operator upgrade, pg-backup resources are created for each scheduled backup (\[K8SPG-410\](https://perconadev.atlassian.net/browse/K8SPG-410))
> The pgbackrest backups and related items saved in the storage are still clean-up up properly following the retention rules defined in the spec.backups.pgbackrest.global.\<repo\>-retention-full\* attributes of the pg cluster definition.
> BUT the pg-backup related k8s resources are well created but never cleaned up even with the retention attributes properly defined.
> This problem lead to a quick accumulation of pg-backups and jobs k8s resources in the namespaces using a pg cluster with scheduled backups.
> 
> \### Steps to reproduce
> 
> 1. Create a pg cluster with a backup storage and schedule section defined and a retention period
> 2. On the scheduled time, pg-backup resource is created with the related job, pod, pgbackrest backup and items in the storage
> 3. At the end of the retention period, pgbackrest backup and items are removed from the storage but none of the k8s resources (pg-backup and job) are not deleted
> 
> 
> \### Versions
> 
> 1. Kubernetes - v1.27.6
> 2. Operator - Percona for PostgreSQL 2.3.1
> 3. Database - PostgreSQL 15.5
> 
> 
> \### Anything else?
> 
> \_No response\_
> 
> \[K8SPG-410\]: https://perconadev.atlassian.net/browse/K8SPG-410?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

---

<div class="post-metadata">

**Author:** ![mboncalo](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/mboncalo/32/16954_2.png) [@mboncalo](https://forums.percona.com/u/mboncalo)\
**Post date:** [August 22, 2024, 12:32pm UTC](https://forums.percona.com/t/v2-4-0-backup-job-pods-are-not-being-removed/32259/2 "2024-08-22T12:32:29Z")

</div>

I solved it by creating my own pgbackrest image which calls quitquitquit istio-proxy endpoint to terminate the container

---

<div class="post-metadata">

**Author:** ![Slava\_Sarzhan](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/slava_sarzhan/32/3196_2.png) [@Slava\_Sarzhan](https://forums.percona.com/u/Slava_Sarzhan)\
**Post date:** [August 27, 2024, 4:44pm UTC](https://forums.percona.com/t/v2-4-0-backup-job-pods-are-not-being-removed/32259/3 "2024-08-27T16:44:38Z")

</div>

> [@Michel\_Filipe](#):
>
> `repo1-retention-diff: '5'`

Hi @mboncalo I have created the task [[K8SPG-629] - Percona JIRA](https://perconadev.atlassian.net/browse/K8SPG-629) We will try to include the fix into v2.5.0
