0

I am trying to migrate a simple gitlab docker container to EKS cluster with Helm chart(it is custom helm chart created by helm create gitlab-ce command and not ready made gitlab helm chart ). for this, I am using EFS volume with static provision of PV, PVC

command to run gitlab as docker container

    - name: Install and manage gitlab-ce
    docker_container:
    name: gitlab
    image: gitlab/gitlab-ce:16.2.2-ce.0
    state: started
    restart_policy: unless-stopped
    volumes:
    - "/srv/gitlab/config:/etc/gitlab"
    - "/srv/gitlab/logs:/var/log/gitlab"
    - "/srv/gitlab/data:/var/opt/gitlab"
    ports:
    - "5666:22"
    networks:
    - name: proxy

I provisioned the EKS cluster, EFS volume, and access point for each volume mount. I am using static provisioning of PV and PVC. To keep the question short I am sharing details of only one volume.

storage class Please note i am using reclaimPolicy: Retain

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: efs-sc
provisioner: efs.csi.aws.com
reclaimPolicy: Retain

PV for gitlab config (similar pv for other volumes as well) Please note i am using

    accessModes:
        - ReadWriteMany
   persistentVolumeReclaimPolicy: Retain

Complete example

kind: PersistentVolume
metadata:
  name: gitlab-config-efs-pv
spec:
  capacity:
    storage: 5Gi
  volumeMode: Filesystem
  accessModes:
    - ReadWriteMany
  persistentVolumeReclaimPolicy: Retain
  storageClassName: efs-sc
  csi:
    driver: efs.csi.aws.com
    volumeHandle: fs-12345::fsap-56789
    volumeAttributes:
      encryptInTransit: "true"

PVC for config

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: gitlab-efs-pvc
spec:
  volumeName: gitlab-config-efs-pv
  accessModes:
    - ReadWriteMany
  storageClassName: efs-sc
  resources:
    requests:
      storage: 5Gi

Observations/problem Even though I provide a reclaim policy in the storage class as retain it deletes all my existing data (e.g. my git repo created will be no more after a new pod creation)when a new pod is created.

Ganesh Pol
  • 413
  • 1
  • 8
  • 29

0 Answers0