C6611225171C94B20CEA5867362185FF.jpg

gitlab-postgresql-pvc

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: gitlab-postgresql-pvc
spec:
  accessModes:
  - ReadWriteMany
  resources:
    requests:
      storage: "640Gi"
  volumeName: 
  storageClassName: nfs

Deployment gitlab-postgresql

apiVersion: apps/v1
kind: Deployment
metadata:
  name: gitlab-postgresql
  labels:
    name: postgresql-gitlab
spec:
  selector:
    matchLabels:
      name: postgresql-gitlab
  template:
    metadata:
      name: postgresql
      labels:
        name: postgresql-gitlab
    spec:
      containers:
      - name: postgresql
        image: registry.cn-hangzhou.aliyuncs.com/sre_pub/postgresql:10
        #image: sameersbn/postgresql:10
        imagePullPolicy: IfNotPresent
        env:
        - name: DB_USER
          value: gitlab
        - name: DB_PASS
          value: passw0rd
        - name: DB_NAME
          value: gitlab_production
        - name: DB_EXTENSION
          value: pg_trgm
        ports:
        - name: postgres
          containerPort: 5432
        volumeMounts:
        - mountPath: /var/lib/postgresql
          name: data
        livenessProbe:
          exec:
            command:
            - pg_isready
            - -h
            - localhost
            - -U
            - postgres
          initialDelaySeconds: 30
          timeoutSeconds: 5
        readinessProbe:
          exec:
            command:
            - pg_isready
            - -h
            - localhost
            - -U
            - postgres
          initialDelaySeconds: 5
          timeoutSeconds: 1
      volumes:
      - name: data
        persistentVolumeClaim:
          claimName: gitlab-postgresql-pvc

svc

apiVersion: v1
kind: Service
metadata:
  name: postgresql
  labels:
    name: postgresql-gitlab
spec:
  type: NodePort
  ports:
    - name: postgres
      port: 5432
      nodePort: 30004
      targetPort: postgres
  selector:
    name: postgresql-gitlab

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

Captcha Code