What code be wrong trying to create PV for our AKS Cluster

Asking for help? Comment out what you need so we can get more information to help you!

Hello Team,

I am trying to Implement PV on our AKS cluster but I am issue with this
apiVersion: apps/v1
kind: Deployment
metadata:
name: {aks.podname}
namespace: {aks.namespace}
labels:
app: {aks.application}
spec:
volumes:
- name: task-pv-storage
persistentVolumeClaim:
claimName: task-pv-storage
selector:
matchLabels:
app: {application}
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
type: RollingUpdate
template:
metadata:
labels:
app: {aks.application}
spec:
containers:
- image: myrepapplication:latest
name: {application}
resources:
requests:
cpu: “500m”
memory: “1200Mi”
limits:
cpu: “1000m”
memory: “2000Mi”
ports:
- containerPort: 8080
name: {aks.application}
volumeMounts:
- mountPath: “/var/log”
name: task-pv-storage

kind: PersistentVolume
metadata:
name: myrepo-pv-volume
labels:
type: local
spec:
storageClassName: manual
capacity:
storage: 10Gi
accessModes:
- ReadWriteOnce
hostPath:
path: “/var/log”


apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: myrepo-pv-claim
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 3Gi

logs for AKS as below

2024-02-08T16:26:15.6451868Z namespace/ace-ui unchanged

2024-02-08T16:26:15.9360854Z The Deployment “caseagent-deployment” is invalid: spec.template.spec.containers[0].volumeMounts[0].name: Not found: “task-pv-storage”

2024-02-08T16:26:16.2272742Z service/caseagent-service unchanged

2024-02-08T16:26:16.5286994Z horizontalpodautoscaler.autoscaling/caseagent-hpa unchanged

2024-02-08T16:26:16.8359905Z persistentvolume/caseagent-pv-volume unchanged

2024-02-08T16:26:16.8415532Z persistentvolumeclaim/caseagent-pv-claim unchanged