kubeblocks icon indicating copy to clipboard operation
kubeblocks copied to clipboard

[BUG] Postgresql config multi parameters have parameter changes that do not take effect

Open JashBook opened this issue 4 months ago • 1 comments

Describe the bug A clear and concise description of what the bug is.

kbcli version
Kubernetes: v1.32.6
KubeBlocks: 1.0.1-beta.16
kbcli: 1.0.1-beta.2

To Reproduce Steps to reproduce the behavior:

  1. create cluster
kubectl apply -f -<<EOF
apiVersion: apps.kubeblocks.io/v1
kind: Cluster
metadata:
  name: kb-pg-16-4-0-thwsxf
  namespace: default
spec:
  clusterDef: postgresql
  topology: replication
  terminationPolicy: WipeOut
  componentSpecs:
    - name: postgresql
      serviceVersion: 16.4.0
      env:
      - name: PATRONI_DCS_ETCD_SERVICE_ENDPOINT
        value: 'etcd-cluster-client.kb-system.svc.cluster.local:2379'
      - name: ETCDCTL_API
        value: '3'
      replicas: 3
      resources:
        requests:
          cpu: "500m"
          memory: "512Mi"
        limits:
          cpu: "1"
          memory: "1Gi"
      volumeClaimTemplates:
        - name: data
          spec:
            storageClassName:
            accessModes:
              - ReadWriteOnce
            resources:
              requests:
                storage: 5Gi
EOF
kubectl get cluster kb-pg-16-4-0-thwsxf                          
NAME                  CLUSTER-DEFINITION   TERMINATION-POLICY   STATUS    AGE
kb-pg-16-4-0-thwsxf   postgresql           WipeOut              Running   3m46s

kbcli cluster list-instances kb-pg-16-4-0-thwsxf
NAME                               NAMESPACE   CLUSTER               COMPONENT    STATUS    ROLE        ACCESSMODE   AZ   CPU(REQUEST/LIMIT)   MEMORY(REQUEST/LIMIT)   STORAGE    NODE                                             CREATED-TIME                 
kb-pg-16-4-0-thwsxf-postgresql-0   default     kb-pg-16-4-0-thwsxf   postgresql   Running   secondary                0    500m / 1             512Mi / 1Gi             data:5Gi   aks-userpool-27716930-vmss00008l/10.224.19.2     Aug 26,2025 18:16 UTC+0800   
kb-pg-16-4-0-thwsxf-postgresql-1   default     kb-pg-16-4-0-thwsxf   postgresql   Running   primary                  0    500m / 1             512Mi / 1Gi             data:5Gi   aks-userpool-27716930-vmss00008c/10.224.23.224   Aug 26,2025 18:16 UTC+0800   
kb-pg-16-4-0-thwsxf-postgresql-2   default     kb-pg-16-4-0-thwsxf   postgresql   Running   secondary                0    500m / 1             512Mi / 1Gi             data:5Gi   aks-userpool-27716930-vmss00008k/10.224.17.38    Aug 26,2025 18:16 UTC+0800   

kubectl exec -it kb-pg-16-4-0-thwsxf-postgresql-1  -- bash
root@kb-pg-16-4-0-thwsxf-postgresql-1:/home/postgres# psql
psql (16.4 (Ubuntu 16.4-1.pgdg22.04+1))
Type "help" for help.

postgres=# show max_connections;
 max_connections 
-----------------
 112
(1 row)

postgres=# show shared_buffers;
 shared_buffers 
----------------
 256MB
(1 row)

  1. config max_connections and shared_buffers
kubectl create -f -<<EOF
apiVersion: operations.kubeblocks.io/v1alpha1
kind: OpsRequest
metadata:
  generateName: kb-pg-16-4-0-thwsxf-reconfiguring-
  namespace: default
  labels:
    app.kubernetes.io/instance: kb-pg-16-4-0-thwsxf
spec:
  type: Reconfiguring
  clusterName: kb-pg-16-4-0-thwsxf
  force: false
  reconfigures:
  - componentName: postgresql
    parameters:
      - key: shared_buffers
        value: '1024MB'
      - key: max_connections
        value: '500'
EOF
  1. See error shared_buffers change succeed max_connections change failed
kubectl exec -it kb-pg-16-4-0-thwsxf-postgresql-1  -- bash
root@kb-pg-16-4-0-thwsxf-postgresql-1:/home/postgres# cat /home/postgres/postgres.yml|egrep "max_connections|shared_buffers"
        max_connections: '500'
    shared_buffers: 1024MB

root@kb-pg-16-4-0-thwsxf-postgresql-1:/home/postgres# psql
psql (16.4 (Ubuntu 16.4-1.pgdg22.04+1))
Type "help" for help.

postgres=# show max_connections;
 max_connections 
-----------------
 112
(1 row)

postgres=#  show shared_buffers;
 shared_buffers 
----------------
 1GB
(1 row)
  1. config max_connections only
kubectl create -f -<<EOF
apiVersion: operations.kubeblocks.io/v1alpha1
kind: OpsRequest
metadata:
  generateName: kb-pg-16-4-0-thwsxf-reconfiguring-
  namespace: default
  labels:
    app.kubernetes.io/instance: kb-pg-16-4-0-thwsxf
spec:
  type: Reconfiguring
  clusterName: kb-pg-16-4-0-thwsxf
  force: false
  reconfigures:
  - componentName: postgresql
    parameters:
      - key: max_connections
        value: '1000'
EOF

kubectl get ops
NAME                                      TYPE            CLUSTER               STATUS    PROGRESS   AGE
kb-pg-16-4-0-thwsxf-reconfiguring-fgp26   Reconfiguring   kb-pg-16-4-0-thwsxf   Succeed   -/-        7s
kb-pg-16-4-0-thwsxf-reconfiguring-jp5nl   Reconfiguring   kb-pg-16-4-0-thwsxf   Succeed   -/-        6m10s

max_connections change succeed

kubectl exec -it kb-pg-16-4-0-thwsxf-postgresql-1  -- bash
root@kb-pg-16-4-0-thwsxf-postgresql-1:/home/postgres# cat /home/postgres/postgres.yml|egrep "max_connections|shared_buffers"
        max_connections: '500'
    shared_buffers: 1024MB
root@kb-pg-16-4-0-thwsxf-postgresql-1:/home/postgres# psql
psql (16.4 (Ubuntu 16.4-1.pgdg22.04+1))
Type "help" for help.

postgres=# show max_connections;
 max_connections 
-----------------
 1000
(1 row)

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Additional context Add any other context about the problem here.

JashBook avatar Aug 26 '25 10:08 JashBook

This issue has been marked as stale because it has been open for 30 days with no activity

github-actions[bot] avatar Oct 13 '25 00:10 github-actions[bot]