
kubectl create namespace <dbxx>


dbxx.yaml.yaml:

---
apiVersion: v1
kind: Secret
metadata:
  name: pg-app-user
  namespace: <dbxx>
type: kubernetes.io/basic-auth
stringData:
  username: devops
  password: KAYQE1QA7uwUZ8uI
---
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
  name: pg-devops
  namespace: <dbxx>
spec:
  instances: 3
 
  storage:
    size: 1Gi
    storageClass: csi-rbdfs-sc
  
  walStorage:
    storageClass: csi-rbdfs-sc
    size: 1Gi	

  bootstrap:
    initdb:
      database: devops
      owner: admin
      secret:
        name: pg-app-user

  postgresql:
    parameters:
      max_connections: "300"
      shared_buffers: "1GB"

  resources:
    requests:
      cpu: "500m"
      memory: "1Gi"
    limits:
      cpu: "2"
      memory: "2Gi"




kubectl cnpg psql pg-devops -n devops

CREATE DATABASE giteadb;
CREATE USER gitea WITH PASSWORD 'KAYQE1QA7uwUZ8uI';
GRANT ALL PRIVILEGES ON DATABASE giteadb TO gitea;
ALTER DATABASE giteadb OWNER TO gitea;