Getting the below error during the execution of release pipeline
error validating data: [ValidationError(Deployment.spec.template.spec.containers[0].env[0]): unknown field "volumeMounts" in io.k8s.api.core.v1.EnvVar, ValidationError(Deployment.spec.template.spec.containers[0].env[0]): missing required field "name" in io.k8s.api.core.v1.EnvVar]; if you choose to ignore these errors, turn validation off with --validate=false. Below is the yaml file content:
apiVersion: apps/v1
kind: Deployment
metadata:
name: xxx
spec:
replicas: 2
selector:
matchLabels:
app: xxx
template:
metadata:
labels:
app: xxx
spec:
nodeSelector:
"kubernetes.io/os": linux
containers:
- name: xxx
image: "xxx.azurecr.io/xxx:$(Build.BuildId)"
env:
- volumeMounts:
- mountPath: "/app"
name: xxx
securityContext:
runAsNonRoot: true
runAsUser: 1000
ports:
- containerPort: 8080
imagePullPolicy: Always
resources:
limits:
cpu: "4000m"
memory: "16Gi"
requests:
cpu: "3500m"
memory: "12Gi"
imagePullSecrets:
- name: xxx
---
apiVersion: v1
kind: Service
metadata:
name: xxx
annotations:
service.beta.kubernetes.io/azure-load-balancer-internal: "true"
spec:
type: LoadBalancer
ports:
- port: 8080
targetPort: 8080
selector:
app: xxx
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: default
automountServiceAccountToken: false