Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s43vg-000K9z-Lf for pgsql-novice@arkaria.postgresql.org; Mon, 06 May 2024 19:23:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1s43vd-00FOYe-1t for pgsql-novice@arkaria.postgresql.org; Mon, 06 May 2024 19:23:13 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s43qX-00FNe3-Aa; Mon, 06 May 2024 19:17:58 +0000 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1s43qV-001t1a-8m; Mon, 06 May 2024 19:17:57 +0000 Received: by mail-pj1-x1031.google.com with SMTP id 98e67ed59e1d1-2b432be5cc9so1618525a91.3; Mon, 06 May 2024 12:17:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715023073; x=1715627873; darn=lists.postgresql.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=nQnI/pJTI2C+gp39q4DSsnKs+TvUCizWapZlzyiw2is=; b=gwkkjuaipguxqi5u9lKEVR71gbGQOomCMsB43vkNOQ2WtmtF04lsdXsLpUk2FfQQFW g1yCHsgbjT6Q9Ul8kHY8GKYtYCF9K+FVNuCW2BSgqjP+m2vW8A2f5bIpyDCWcArSyE1g nCQ68EJoJ6WOhI6eTo9MCGFm2MR2cwfnQ9Nqj86OQWcD57+uRAtpl0eJPqy9Ywkh1ogV RXv89rOig15FCfJsvAFaDA4eIe7NUdYv6oJmG0krLUNfQrfPWw3IYuIikJwi+2Y57VZ2 va9a2KcWUGN0LiYgd0h46J5Ssj40ZcfVCxglZARv6k+OZKNacSoNqDev8FG1uP2q/j3h MmYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715023073; x=1715627873; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=nQnI/pJTI2C+gp39q4DSsnKs+TvUCizWapZlzyiw2is=; b=oGAbgji0Mo5y1eJQ5QiBJH1izPzMZ6V1A7PRnofImJ1HNnPaLqXbyf+GL9V7wy8+Ld AtX12iijszCu7py6LLynBfOeD0i4/ZHjmB1U+QQdYrT8XlJst5wAOPLwWrbw9TO8ZegK rewhSOiscJ7Xr/jjesAybTMfGPpOwNytwPxU3mJGB3Ap2T2vyN4MNHoydNcyB0I6Z8hF 62+HnE1HIEFkgBblpRtBY4lHD4hLEEoDZb8vyteOPJAze/fEpCWsEZVkyjaqJFR9mxrz LjSbqd2KCwnSKShPyZ0l5nxs1Wd4kYGL0SYg7P8SnhxOQiYxfE8J+U+We1y5DPMKKTE6 AlJw== X-Forwarded-Encrypted: i=1; AJvYcCUiQaksINlZtVMwlkPuL5ZXvzZQSCBCDBgn2V7kVxIj7gcrjEfMbnaqkFgUYiNr97o9hKgOX8xEQrw8jwFV729hp/TmZm75wukfkSToVUE= X-Gm-Message-State: AOJu0YxJu/MBnMOnZB0popX1f4HiQU5GrnF82EoU2hkosn2UUGcFYGoG MAuwoj6PWqnqrZNCAcHOG2GkNd6LkpTpyTVSvyPtvlGNHeH1hZ45OABYQD9rbdFZgesaOyft4P8 oJALpAT+dSw8M4gCcHJq4MwF1Hd/+L/IWgSM= X-Google-Smtp-Source: AGHT+IFsdopdHFmxaHMJ3GYh8vT0m5KWptXPiahPwcUXeeLNoXqqR+Xsm+yIXASFABkbhQA6wIaOJ8V5Uw55mwwrwXU= X-Received: by 2002:a17:90a:8a0c:b0:2b3:ed2:1a91 with SMTP id w12-20020a17090a8a0c00b002b30ed21a91mr7569789pjn.45.1715023072278; Mon, 06 May 2024 12:17:52 -0700 (PDT) MIME-Version: 1.0 From: first last Date: Tue, 7 May 2024 00:47:40 +0530 Message-ID: Subject: Access a Postgres storage with two independent instances To: pgsql-novice@lists.postgresql.org, pgsql-sql@lists.postgresql.org Content-Type: multipart/alternative; boundary="0000000000000147910617cded02" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000000147910617cded02 Content-Type: text/plain; charset="UTF-8" I tried to deploy Postgres deployment with Kubernetes, having three replicas that are accessing the same storage(PVC). Here is the configuration ``` apiVersion: v1 kind: PersistentVolume metadata: name: postgres-volume labels: type: local spec: persistentVolumeReclaimPolicy: Delete capacity: storage: 10Gi accessModes: - ReadWriteOnce hostPath: path: /data/postgresql --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: postgres-volume-claim spec: accessModes: - ReadWriteOnce resources: requests: storage: 10Gi --- apiVersion: apps/v1 kind: Deployment metadata: name: postgres spec: replicas: 3 selector: matchLabels: app: postgres template: metadata: labels: app: postgres spec: containers: - name: postgres image: 'postgres:14' env: - name: POSTGRES_DB value: db - name: POSTGRES_USER value: user - name: POSTGRES_PASSWORD value: pwd volumeMounts: - name: postgresdata mountPath: /var/lib/postgresql/data volumes: - name: postgresdata persistentVolumeClaim: claimName: postgres-volume-claim --- apiVersion: v1 kind: Service metadata: name: postgres labels: app: postgres spec: type: NodePort ports: - port: 5432 protocol: TCP targetPort: 5432 nodePort: 32001 selector: app: postgres ``` When you apply this configuration file `kubectl apply -f file_name.yaml`, you can create three pods. Here I have given the configuration to create the pods that use a single storage as a data store. But what actually happening is, that it uses separate storage. I have tested all the replicas manually by creating a db and table and see, if other database stores are affected or not. Anyway, it is not affected. And then I tried to apply the same config file change the image name and the env variables suit for MySQL and tried to deploy it. It works as expected. Anyway, it can not use single storage( https://stackoverflow.com/questions/78436945/access-a-mysql-storage-with-two-independent-instances ). Finally, my question is, why the scenario is different for MySQL and Postgres? Could you please help me to figure out the issue? This is for my Final year project testing Kubernetes using fuzzing. --0000000000000147910617cded02 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I=C2=A0tried to deploy= Postgres deployment with Kubernetes, having three replicas that are access= ing the same storage(PVC). Here is the configuration
```
apiVersion: v1
kind: PersistentVolume
metadata:
name: postgres-volume
labels:
ty= pe: local
spec:
persistentVolumeReclaimPolicy: Delete
capacity:
storage: 10Gi
accessModes:
- ReadWriteOnce
hostPath:
= path: /data/postgresql
---
apiVersion: v1
kind<= /span>: PersistentVolumeClaim=
metadata:
name: postgres-volume-claim
spec:
accessModes:
- ReadWriteOnce
resources:
req= uests:
storage= : 10Gi
---
apiVersion: apps/v1
kind: Deplo= yment
metadata:
name: postgres
spec:
replicas: 3
selector:
= matchLabels:
= app: postgres
template:
metadata:
lab= els:
app: postgres
<= span style=3D"color:rgb(86,156,214)">spec:
containers:
- name: postgres
image: 'postgres:14= 9;
env:
- name: <= span style=3D"color:rgb(206,145,120)">POSTGRES_DB
= value: db
- name: POSTGRES_USE= R
value: user
= - name: POSTGRES_PASSWORD
value: pwd
vol= umeMounts:
- name: postgresdata
mountPath: <= span style=3D"color:rgb(206,145,120)">/var/lib/postgresql/data
=
volumes:
= - name: postgresdata
persistentVolumeClaim:
<= span style=3D"color:rgb(86,156,214)">claimName: postgres-volume-claim
---
apiVersion: v1
kind: Service
metadata:
name: postgres
labels:
app: postgres
spec:
type: No= dePort
ports:
- port: 5432
protocol: TCP
targetPort= : 5432
<= span style=3D"color:rgb(86,156,214)">nodePort: 32001
selector:
= app: postgres
```

When you apply this configuration file `kubectl apply -f = file_name.yaml`, you can create three pods. Here I have given the configura= tion to create the pods that use a single storage as a data store. But what= actually happening is, that it uses separate storage. I have tested all th= e replicas manually by creating a db and table and see, if other database s= tores are affected or not. Anyway, it is not affected. And then I tried to = apply the same config file change the image name and the env variables suit= for MySQL and tried to deploy it. It works as expected. Anyway, it can not= use single storage(https://stackoverfl= ow.com/questions/78436945/access-a-mysql-storage-with-two-independent-insta= nces).

Finally, my question is, why the scenario is different for MySQL= and Postgres?=C2=A0 Could you please help me to figure out=C2=A0the issue?= This is for my Final year project testing Kubernetes using fuzzing.


--0000000000000147910617cded02--