title: Kubernetes how do you create persistent volume on AWS Elastic Block Store
body: <p>I try to create persistent volume with AWS Elastic Block Store, so whenever I deployed a metabase pods no need to worry to losing all initial data I've settled up.</p>
  
  <p>Here is <strong>Deployment</strong> yaml file:</p>
  
  <pre><code>apiVersion: extensions/v1beta1
  kind: Deployment
  metadata:
    name: metabase
  spec:
    replicas: 1
    template:
      metadata:
        labels:
          app: metabase
          tier: backend
      spec:
        containers:
        - name: metabase
          image: metabase/metabase
          volumeMounts:
          - mountPath: "/metabase-ebs"
            name: metabase-volume
        volumes:
          - name: metabase-volume
            persistentVolumeClaim:
              claimName: metabase-pvc
  </code></pre>
  
  <p>My <strong>Persistent Volume Claim</strong> yaml file:</p>
  
  <pre><code>apiVersion: v1
  kind: PersistentVolumeClaim
  metadata:
    name: metabase-pvc
  spec:
    accessModes:
      - ReadWriteOnce
    resources:
      requests:
        storage: 5Gi
    volumeName: metabase-pv
  </code></pre>
  
  <p>My <strong>Persistent Volume</strong> yaml file:</p>
  
  <pre><code>apiVersion: v1
  kind: PersistentVolume
  metadata:
    name: "metabase-pv"
  spec:
    capacity:
      storage: 5Gi
    accessModes:
      - ReadWriteOnce
    persistentVolumeReclaimPolicy: Recycle
    awsElasticBlockStore:
      volumeID: MY-EBS-VOLUME-ID
      fsType: ext4
  </code></pre>
  
  <p>How I test if my persistent volume is right or not:</p>
  
  <ol>
  <li>I destroy my pods after I set initial metabase setup</li>
  <li>Recreate pods</li>
  </ol>
  
  <p>If there is no need to do the initial setup again. Then it works, if not then it fails.</p>
  
  <p>Is my test scenario wrong? Or how do you manage to work with Persistent volume using AWS EBS?</p>
  
  <p>Thanks in advance :)</p>
  
  <p><strong><em>UPDATE</em></strong></p>
  
  <p>Sorry, silly me I forget to mention the issue Im facing :bow:</p>
  
  <p>The issue is:</p>
  
  <p>Whenever I recreate pods after I do the initial setup, I have to do the initial setup again. So I assumed the Persistent Volume not working :(</p>