A Deployment named web-app
in the frontend
namespace is already running, but it does not use persistent storage.
Your task is to:
-
Create a PersistentVolumeClaim (PVC) named
web-pvc
in thefrontend
namespace with 250Mi storage. -
Use the existing retained PersistentVolume (there is only one PV).
-
Modify the existing Deployment (
web-app
) to mount the PVC at/usr/share/nginx/html
. -
Apply the updated Deployment YAML to the cluster.
Step 1: Create Namespace
frontend
apiVersion: v1kind: Namespacemetadata: name: frontend
Step 2: Create PersistentVolume
web-pv
apiVersion: v1kind: PersistentVolumemetadata: name: web-pvspec: capacity: storage: 250Mi accessModes: - ReadWriteOnce persistentVolumeReclaimPolicy: Retain storageClassName: manual hostPath: path: "/mnt/data/web" # This directory must exist on the node
Step 3: Create PersistentVolumeClaim web-pvc
Comments
Post a Comment