Getting error in release deployment in Azure Devops

Sabyasachi Mukherjee 21 Reputation points
2022-11-02T14:07:27.83+00:00

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
Not Monitored
Not Monitored
Tag not monitored by Microsoft.
36,990 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Dave Patrick 426.3K Reputation points MVP
    2022-11-02T14:10:49.427+00:00

    Devops / TFS is not currently supported here on Q&A. The product group for Azure DevOps / TFS actively monitors questions over at
    https://developercommunity.visualstudio.com/report?space=21&entry=problem
    https://developercommunity.visualstudio.com/report?space=22&entry=problem
    https://azure.microsoft.com/en-in/support/devops/

    --please don't forget to upvote and Accept as answer if the reply is helpful--

    0 comments No comments