Access a Postgres storage with two independent instances

Поиск
Список
Период
Сортировка
От first last
Тема Access a Postgres storage with two independent instances
Дата
Msg-id CAG3FJTaRdS1asGHcuMk3NFB0Ap+kcjO7mk1gMY2jSZ4T0a_62A@mail.gmail.com
обсуждение исходный текст
Ответы Re: Access a Postgres storage with two independent instances  (Alan Hodgson <ahodgson@lists.simkin.ca>)
Список pgsql-novice
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.

В списке pgsql-novice по дате отправления:

Предыдущее
От: TIM CHILD
Дата:
Сообщение: Re: Hello, novice Postgres user, seg fault investigation
Следующее
От: Alan Hodgson
Дата:
Сообщение: Re: Access a Postgres storage with two independent instances