<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>pv &amp;mdash; LinuxPizza</title>
    <link>https://blogs.linux.pizza/tag:pv</link>
    <description>Personal notes and occasional posts - 100% human, 0% AI generated</description>
    <pubDate>Tue, 14 Apr 2026 15:41:14 +0000</pubDate>
    <item>
      <title>Creating a PV and PVC on NFS for K8s</title>
      <link>https://blogs.linux.pizza/creating-a-pv-and-pvc-on-nfs-for-k8s</link>
      <description>&lt;![CDATA[Took myself ages to figure this out, so I am noting this down for my future self.&#xA;Just a note - this is not the indented workflow, but rather a &#34;getting started with kubernetes&#34; step.&#xA;&#xA;First, we need to add NFS as a storage class:&#xA;&#xA;apiVersion: storage.k8s.io/v1&#xA;kind: StorageClass&#xA;metadata:&#xA;  name: managed-nfs-storage&#xA;provisioner: k8s-sigs.io/nfs-subdir-external-provisioner # or choose another name, must match deployment&#39;s env PROVISIONERNAME&#39;&#xA;parameters:&#xA;  archiveOnDelete: &#34;false&#34;&#xA;Then, we can add the actual storage:&#xA;kind: PersistentVolume&#xA;apiVersion: v1&#xA;metadata:&#xA;  name: nfs-persistentvolume&#xA;spec:&#xA;  capacity:&#xA;    storage: 1Gi&#xA;  accessModes:&#xA;    ReadWriteMany&#xA;  storageClassName: &#34;nfs&#34; # Empty string must be explicitly set otherwise default StorageClass will be set / or custom storageClassName name&#xA;  nfs:&#xA;    path: &#34;/path/to/share&#34;&#xA;    server: &#34;xxx.xxx.xxx.xxx&#34;&#xA;    readOnly: false&#xA;  claimRef:&#xA;    name: nfs-persistentvolumeclaim&#xA;    namespace: default&#xA;---&#xA;apiVersion: v1&#xA;kind: PersistentVolumeClaim&#xA;metadata:&#xA;  name: nfs-persistentvolumeclaim&#xA;  namespace: default&#xA;spec:&#xA;  accessModes:&#xA;    ReadWriteMany&#xA;  resources:&#xA;    requests:&#xA;      storage: 1Gi&#xA;  storageClassName: &#34;nfs&#34; # Empty string must be explicitly set otherwise default StorageClass will be set / or custom storageClassName name&#xA;  volumeName: nfs-persistentvolume&#xA;&#xA;Hope this helps&#xA;&#xA;Bonus - run a Minecraft Bedrock inside K8S using your newly created PVC as storage&#xA;&#xA;apiVersion: apps/v1&#xA;kind: Deployment&#xA;metadata:&#xA;  name: mc-bedrock&#xA;  labels:&#xA;    app: mc-bedrock&#xA;spec:&#xA;  replicas: 1&#xA;  template:&#xA;    metadata:&#xA;      name: mc-bedrock&#xA;      labels:&#xA;        app: mc-bedrock&#xA;    spec:&#xA;      containers:&#xA;        name: mc-bedrock&#xA;          image: itzg/minecraft-bedrock-server&#xA;          imagePullPolicy: Always&#xA;          resources:&#xA;            requests:&#xA;              cpu: 500m&#xA;              memory: 4Gi&#xA;          env:&#xA;            name: EULA&#xA;              value: &#34;TRUE&#34;&#xA;            name: GAMEMODE&#xA;              value: survival&#xA;            name: DIFFICULTY&#xA;              value: normal&#xA;            name: WHITELIST&#xA;              value: &#34;false&#34;&#xA;            name: ONLINEMODE&#xA;              value: &#34;true&#34;&#xA;            name: ALLOWCHEATS&#xA;              value: &#34;true&#34;&#xA;          volumeMounts:&#xA;            mountPath: /data&#xA;              name: data&#xA;      volumes:&#xA;        name: data&#xA;          persistentVolumeClaim:&#xA;            claimName: nfs-persistentvolumeclaim&#xA;  selector:&#xA;    matchLabels:&#xA;      app: mc-bedrock&#xA;---&#xA;apiVersion: v1&#xA;kind: Service&#xA;metadata:&#xA;  name: mc-bedrock&#xA;  labels:&#xA;    app: mc-bedrock&#xA;spec:&#xA;  selector:&#xA;    app: mc-bedrock&#xA;  ports:&#xA;    port: 19132&#xA;      protocol: UDP&#xA;  type: LoadBalancer&#xA;Get the IP assigned for the service&#xA;kubectl get service mc-bedrock -o jsonpath=&#39;{.status.loadBalancer.ingress[0].ip}&#39;&#xA;Restart the pods in the deployment&#xA;kubectl logs -f deployment/mc-bedrock&#xA;&#xA;#linux #k8s #kubernetes #pvc #pv #minecraft]]&gt;</description>
      <content:encoded><![CDATA[<p>Took myself ages to figure this out, so I am noting this down for my future self.
Just a note – this is not the indented workflow, but rather a “getting started with kubernetes” step.</p>

<h4 id="first-we-need-to-add-nfs-as-a-storage-class" id="first-we-need-to-add-nfs-as-a-storage-class">First, we need to add NFS as a storage class:</h4>

<pre><code>apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: managed-nfs-storage
provisioner: k8s-sigs.io/nfs-subdir-external-provisioner # or choose another name, must match deployment&#39;s env PROVISIONER_NAME&#39;
parameters:
  archiveOnDelete: &#34;false&#34;
</code></pre>

<h4 id="then-we-can-add-the-actual-storage" id="then-we-can-add-the-actual-storage">Then, we can add the actual storage:</h4>

<pre><code>kind: PersistentVolume
apiVersion: v1
metadata:
  name: nfs-persistentvolume
spec:
  capacity:
    storage: 1Gi
  accessModes:
    - ReadWriteMany
  storageClassName: &#34;nfs&#34; # Empty string must be explicitly set otherwise default StorageClass will be set / or custom storageClassName name
  nfs:
    path: &#34;/path/to/share&#34;
    server: &#34;xxx.xxx.xxx.xxx&#34;
    readOnly: false
  claimRef:
    name: nfs-persistentvolumeclaim
    namespace: default
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: nfs-persistentvolumeclaim
  namespace: default
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 1Gi
  storageClassName: &#34;nfs&#34; # Empty string must be explicitly set otherwise default StorageClass will be set / or custom storageClassName name
  volumeName: nfs-persistentvolume

</code></pre>

<p>Hope this helps</p>

<h2 id="bonus-run-a-minecraft-bedrock-inside-k8s-using-your-newly-created-pvc-as-storage" id="bonus-run-a-minecraft-bedrock-inside-k8s-using-your-newly-created-pvc-as-storage">Bonus – run a Minecraft Bedrock inside K8S using your newly created PVC as storage</h2>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: mc-bedrock
  labels:
    app: mc-bedrock
spec:
  replicas: 1
  template:
    metadata:
      name: mc-bedrock
      labels:
        app: mc-bedrock
    spec:
      containers:
        - name: mc-bedrock
          image: itzg/minecraft-bedrock-server
          imagePullPolicy: Always
          resources:
            requests:
              cpu: 500m
              memory: 4Gi
          env:
            - name: EULA
              value: &#34;TRUE&#34;
            - name: GAMEMODE
              value: survival
            - name: DIFFICULTY
              value: normal
            - name: WHITE_LIST
              value: &#34;false&#34;
            - name: ONLINE_MODE
              value: &#34;true&#34;
            - name: ALLOW_CHEATS
              value: &#34;true&#34;
          volumeMounts:
            - mountPath: /data
              name: data
      volumes:
        - name: data
          persistentVolumeClaim:
            claimName: nfs-persistentvolumeclaim
  selector:
    matchLabels:
      app: mc-bedrock
---
apiVersion: v1
kind: Service
metadata:
  name: mc-bedrock
  labels:
    app: mc-bedrock
spec:
  selector:
    app: mc-bedrock
  ports:
    - port: 19132
      protocol: UDP
  type: LoadBalancer
</code></pre>

<h4 id="get-the-ip-assigned-for-the-service" id="get-the-ip-assigned-for-the-service">Get the IP assigned for the service</h4>

<pre><code>kubectl get service mc-bedrock -o jsonpath=&#39;{.status.loadBalancer.ingress[0].ip}&#39;
</code></pre>

<h4 id="restart-the-pods-in-the-deployment" id="restart-the-pods-in-the-deployment">Restart the pods in the deployment</h4>

<pre><code>kubectl logs -f deployment/mc-bedrock
</code></pre>

<p><a href="https://blogs.linux.pizza/tag:linux" class="hashtag"><span>#</span><span class="p-category">linux</span></a> <a href="https://blogs.linux.pizza/tag:k8s" class="hashtag"><span>#</span><span class="p-category">k8s</span></a> <a href="https://blogs.linux.pizza/tag:kubernetes" class="hashtag"><span>#</span><span class="p-category">kubernetes</span></a> <a href="https://blogs.linux.pizza/tag:pvc" class="hashtag"><span>#</span><span class="p-category">pvc</span></a> <a href="https://blogs.linux.pizza/tag:pv" class="hashtag"><span>#</span><span class="p-category">pv</span></a> <a href="https://blogs.linux.pizza/tag:minecraft" class="hashtag"><span>#</span><span class="p-category">minecraft</span></a></p>
]]></content:encoded>
      <guid>https://blogs.linux.pizza/creating-a-pv-and-pvc-on-nfs-for-k8s</guid>
      <pubDate>Tue, 06 Jul 2021 14:18:39 +0000</pubDate>
    </item>
  </channel>
</rss>