|
@@ -0,0 +1,64 @@
|
|
|
|
|
+apiVersion: postgresql.cnpg.io/v1
|
|
|
|
|
+kind: Cluster
|
|
|
|
|
+metadata:
|
|
|
|
|
+ name: k8s-postgres-cluster
|
|
|
|
|
+ namespace: k8s-pg-cluster
|
|
|
|
|
+spec:
|
|
|
|
|
+ instances: 3
|
|
|
|
|
+
|
|
|
|
|
+ imageName: ghcr.io/cloudnative-pg/postgresql:16
|
|
|
|
|
+
|
|
|
|
|
+ primaryUpdateStrategy: unsupervised
|
|
|
|
|
+
|
|
|
|
|
+ storage:
|
|
|
|
|
+ size: 1Gi
|
|
|
|
|
+
|
|
|
|
|
+ superuserSecret:
|
|
|
|
|
+ name: postgres-superuser
|
|
|
|
|
+
|
|
|
|
|
+ bootstrap:
|
|
|
|
|
+ initdb:
|
|
|
|
|
+ database: reymotadb
|
|
|
|
|
+ owner: creylopez
|
|
|
|
|
+ secret:
|
|
|
|
|
+ name: postgres-app-user
|
|
|
|
|
+
|
|
|
|
|
+---
|
|
|
|
|
+apiVersion: v1
|
|
|
|
|
+kind: Secret
|
|
|
|
|
+metadata:
|
|
|
|
|
+ name: postgres-superuser
|
|
|
|
|
+ namespace: k8s-pg-cluster
|
|
|
|
|
+type: kubernetes.io/basic-auth
|
|
|
|
|
+stringData:
|
|
|
|
|
+ username: postgres
|
|
|
|
|
+ password: Rey-1176
|
|
|
|
|
+
|
|
|
|
|
+---
|
|
|
|
|
+apiVersion: v1
|
|
|
|
|
+kind: Secret
|
|
|
|
|
+metadata:
|
|
|
|
|
+ name: postgres-app-user
|
|
|
|
|
+ namespace: k8s-pg-cluster
|
|
|
|
|
+type: kubernetes.io/basic-auth
|
|
|
|
|
+stringData:
|
|
|
|
|
+ username: creylopez
|
|
|
|
|
+ password: Dsa-0213
|
|
|
|
|
+
|
|
|
|
|
+---
|
|
|
|
|
+apiVersion: v1
|
|
|
|
|
+kind: Service
|
|
|
|
|
+metadata:
|
|
|
|
|
+ name: postgres-nodeport
|
|
|
|
|
+ namespace: k8s-pg-cluster
|
|
|
|
|
+spec:
|
|
|
|
|
+ type: NodePort
|
|
|
|
|
+ selector:
|
|
|
|
|
+ cnpg.io/cluster: reymota-pg-cluster
|
|
|
|
|
+ role: primary
|
|
|
|
|
+ ports:
|
|
|
|
|
+ - name: postgres
|
|
|
|
|
+ protocol: TCP
|
|
|
|
|
+ port: 5432
|
|
|
|
|
+ targetPort: 5432
|
|
|
|
|
+ nodePort: 30432
|