<p>I am new to Kubernetes, and I struggle to understand whol idea behind Persistent Storage in Kubernetes.</p>
<p>So is this enough or I have to create Persistent Volume and what will happen if I deploy only these two object without creating PV?</p>
<p>Storage should be on local machine.</p>
<pre><code>apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  creationTimestamp: null
  name: nginx-logs
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 100Mi
status: {}
</code></pre>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: app-web
  name: app-web
spec:
  selector:
    matchLabels:
      app: app-web
  replicas: 1
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: app-web
    spec:
      containers:
        image: nginx:1.14.2
        imagePullPolicy: Always
        name: app-web
        volumeMounts:
        - mountPath: /var/log/nginx
          name: nginx-logs
      restartPolicy: Always
      volumes:
      - name: nginx-logs
        persistentVolumeClaim:
          claimName: nginx-logs
</code></pre>

<blockquote>
<p>I struggle to understand whole idea behind Persistent Storage in Kubernetes</p>
</blockquote>
<p>The idea is to separate the <em>storage request</em> that the app needs, and the physical storage - such that an app can be moved to e.g. other cloud provider that has a different storage system - but without needing any changes in the app. It also separates the responsibility for &quot;requesting storage&quot; and managing the underlying storage e.g. developers vs operations.</p>
<blockquote>
<p>So is this enough or I have to create Persistent Volume and what will happen if I deploy only these two object without creating PV?</p>
</blockquote>
<p>This depends on you environment. Most environments typically have <a href="https://kubernetes.io/docs/concepts/storage/dynamic-provisioning/" rel="nofollow noreferrer">Dynamic Volume Provisioning</a>, e.g. the big cloud providers and now also Minikube has support for this.</p>
<p>When using dynamic volume provisioning, the developer only has to create a <code>PersistentVolumeClaim</code> - and no <code>PersistentVolume</code>, its instead dynamically provsioned.</p>
