<p>I am setting up a CI/CD environment for the first time consisting of a single node kubernetes (minikube). </p>

<p>On this node I created a PV </p>

<pre><code>NAME          CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS   CLAIM                                   STORAGECLASS   REASON   AGE
data-volume   1Gi        RWO            Retain           Bound    gitlab-managed-apps/data-volume-claim   manual                  20m
</code></pre>

<p>and PVC</p>

<pre><code>NAME                STATUS   VOLUME        CAPACITY   ACCESS MODES   STORAGECLASS   AGE
data-volume-claim   Bound    data-volume   1Gi        RWO            manual         19m
</code></pre>

<p>Now I would like to create a pod with multiple containers accessing to this volume.</p>

<p>Where and how do you advise to setup this using gitlab pipelines gitlab-ci etc? Multiple repos may be the best fit for the project.</p>

<p>Here is the fully working example of deployment manifest file, having in Pod's spec defined two containers (based on different nginx docker images) using the same PV, from where they serve custom static html content on ports 80/81 accordingly:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: "1"
  creationTimestamp: null
  generation: 1
  labels:
    run: nginx
  name: nginx
  selfLink: /apis/extensions/v1beta1/namespaces/default/deployments/nginx
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      run: nginx
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      creationTimestamp: null
      labels:
        run: nginx
    spec:
      volumes:
      - name: my-pv-storage
        persistentVolumeClaim:
          claimName: my-pv-claim-nginx
      containers:
      - image: nginx
        imagePullPolicy: IfNotPresent
        name: nginx
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: "/usr/share/nginx/html"
          name: my-pv-storage
          subPath: html_custom 
      - image: custom-nginx
        imagePullPolicy: IfNotPresent
        name: custom-nginx
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: "/usr/share/nginx/html"
          name: my-pv-storage
          subPath: html
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
status: {}
</code></pre>
