0

I need to upgrade my Postgres version. 9.6 to 14.x on deployment yaml file. But I need to keep my old Postgres data and bin folders for the new version of Postgres. When I update and apply the Postgres version in the deployment yaml file. My pod will be changed, and after this change, I want to use the same files(bin and data) for the new version. How can I do this just by updating the yaml file?

My Deployment file:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: postgres
spec:
  replicas: 1
  template:
    metadata:
      labels:
        name: postgres
    spec:
      containers:
      - name: postgres
        imagePullPolicy: Never
        image: postgres:9.6   # will be changed to 14.x version
        ports:
        - name: postgres
          containerPort: 5432
        volumeMounts:
        - mountPath: /var/lib/postgresql
          name: postgres-persistent-storage
      volumes:
      - name: postgres-persistent-storage
        persistentVolumeClaim:
          claimName: postgres-pv-claim
hammer89
  • 343
  • 1
  • 5
  • 13
  • Version 9.14 doesn't exist and if it did, you wouldn't want it either, it would also be unsupported. Version 10 will be EOL within a few months. – Frank Heikens Jun 15 '22 at 11:29
  • @LaurenzAlbe but the official website says we have to **[pg_upgrade](https://www.postgresql.org/docs/current/pgupgrade.html)** – hammer89 Jun 15 '22 at 11:33
  • @FrankHeikens so sorry my mistake 9.6 upgrade to 14. – hammer89 Jun 15 '22 at 11:37
  • Ah, now I understand. Well, unless you use `pg_upgrade --link`, you get to keep the old cluster anyway, so no problem. – Laurenz Albe Jun 15 '22 at 11:41
  • Unfortunately I can't use any cli or commands. I need to do this in k8s yaml files. – hammer89 Jun 15 '22 at 12:11
  • @hammer89 : I found a similar issue link in [SO](https://stackoverflow.com/a/62198992/19230181) kindly Follow this link might be helpful in keeping the old files. – Hemanth Kumar Aug 09 '22 at 11:11

0 Answers0