kubectl create namespace devops


dbdevops.yaml:

---
apiVersion: v1
kind: Secret
metadata:
  name: pg-app-user
  namespace: demo-apps
type: kubernetes.io/basic-auth
stringData:
  username: devops
  password: KAYQE1QA7uwUZ8uI
---
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
  name: pg-devops
  namespace: devops
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"



--- pgadmin -------------------
apiVersion: apps/v1
kind: Deployment
metadata:
  name: pgadmin-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: pgadmin
  template:
    metadata:
      labels:
        app: pgadmin
    spec:
      containers:
        - name: pgadmin
          image: dpage/pgadmin4
          ports:
            - containerPort: 80
          env:
            - name: PGADMIN_DEFAULT_EMAIL
              value: pgadmin@italiadatacenter.com
            - name: PGADMIN_DEFAULT_PASSWORD
              value: KAYQE1QA7uwUZ8uI
            - name: PGADMIN_CONFIG_ENHANCED_COOKIE_PROTECTION
              value: "false"
---
apiVersion: v1
kind: Service
metadata:
  name: pgadmin-service
spec:
  selector:
    app: pgadmin
  ports:
    - protocol: TCP
      port: 80
      targetPort: 80
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: demo-route
  namespace: demo-apps
spec:
  hostnames:
  - poc3.italiadatacenter.com
  parentRefs:
  - name: main-gateway
    namespace: nginx-gateway
  rules:
  - matches:
    - path:
        type: PathPrefix
        value: /
    backendRefs:
    - name: pgadmin-service
      port: 80
