Giriş
Tuning your PostgreSQL for High Performance yazısına bakılabilir
Sanırım 3 tane temel senaryo var. Bunlar şöyle
1. Running PostgreSQL Outside of Kubernetes
Şeklen şöyle
Açıklaması şöyle
The PostgreSQL cluster consists of a Master Node and a Standby Node. In case the Master Node failed for some reason (e.g., hardware or network defect) the standby server can overtake the role of the master. The PG-Bouncer in this picture is a component from Postgres and acts as a kind of reverse proxy server. In case of a failure, the switch from the Master to the Standby node can be done by an administrator or can be automated by scripts. From the view of a client, this switch is transparent.
2. Running PostgreSQL Inside of Kubernetes
Örnek
Deployment şöyledir
apiVersion: apps/v1kind: Deploymentmetadata:name: postgresnamespace: spring-keycloak-demospec:selector:matchLabels:app: postgresreplicas: 1template:metadata:labels:app: postgresspec:containers:- name: postgresimage: postgres:latestports:- containerPort: 5432env:- name: POSTGRES_DBvalue: postgres- name: POSTGRES_USERvalue: postgres- name: POSTGRES_PASSWORDvalueFrom:secretKeyRef:name: spring-keycloak-secretskey: postgres-pass
service şöyledir
apiVersion: v1 kind: Service metadata: name: postgres-service namespace: spring-keycloak-demo labels: app: postgres spec: selector: app: postgres ports: - port: 5432 type: NodePort
Örnek
apiVersion: apps/v1 kind: StatefulSet metadata: name: postgres labels: component: postgres spec: selector: matchLabels: component: postgres serviceName: postgres template: metadata: labels: component: postgres spec: containers: - name: postgres image: postgres:11 ports: - containerPort: 5432 volumeMounts: - mountPath: /var/lib/postgresql/data name: postgres-data env: - name: POSTGRES_DB value: postgres - name: POSTGRES_USER value: postgres - name: POSTGRES_PASSWORD value: postgres volumeClaimTemplates: - metadata: name: postgres-data spec: accessModes: - ReadWriteOnce storageClassName: hostpath resources: requests: storage: 5Gi
Service olarak şöyle yaparız
apiVersion: v1 kind: Service metadata: name: postgres labels: component: postgres spec: selector: component: postgres ports: - port: 5432
3. Running PostgreSQL on a Distributed Block Storage
Hiç yorum yok:
Yorum Gönder