AKHIL KUMAR
AKHIL KUMAR

Reputation: 23

ValidationError(Deployment.spec.template.spec.containers[0].env[13])

I have a manifest of a Kubernetes Deployment. When I try to deploy it from Azure Devops, I get the following error:

error: error validating "/home/vsts/work/r1/a/_MozCom-Ace-QTR/beta/ace-ui-deploy.yaml": error validating data: ValidationError(Deployment.spec.template.spec.containers[0].env[13]): missing required field "name" in io.k8s.api.core.v1.EnvVar; if you choose to ignore these errors, turn validation off with --validate=false

enter image description here

enter image description here enter image description here

apiVersion: apps/v1
kind: Deployment
metadata:
  name: abc-ui
  namespace: abcqat-frontend
spec:
  replicas: 1
  selector:
    matchLabels:
      app: abc-ui
  template:
    metadata:
      labels:
        app: abc-ui
    spec:
      containers:
        - name: abc-ui
          image: abc.azurecr.io/mozcom-abc-ui-mig:65272
          imagePullPolicy: Always
          ports:
            - containerPort: 3883
              name: abc-ui
          readinessProbe:
               httpGet:
                   path: /health-probe
                   port: 3883
               initialDelaySeconds: 15
               periodSeconds: 10
               timeoutSeconds: 5
          livenessProbe:
              httpGet:
                  path: /health-probe
                  port: 3883
              initialDelaySeconds: 15
              periodSeconds: 10
              timeoutSeconds: 5
          env:
            - name: ENVIRONMENT
              value: PROD
            - name: PORT
              value: "3883"
            - name: DISABLE_CONSTRUCT_API_URL
              value: "true"
            - name: APP_API_HOST
              value: https://afgabcqtr-webapi-beta.mozcomtest.com
            - name: APP_API_PROTOCOL
              value: "https:"
            - name: SITE_NAME_SEPARATOR
              value: "-"
            - name: AUTH_SERVER_HOST
              value: https://afgabcqtr-cas-beta.mozcomtest.com
            - name: GOOGLE_MAP_KEY
              valueFrom:
                secretKeyRef:
                  name: mozcom-env-secret
                  key: googleMapKey
            - name: BASIC_AUTH_ENABLED
              value: "true"
            - name: BASIC_AUTH_USER
              value: mozcomabc
            - name: BASIC_AUTH_PASSWORD
              value: afgabclive
            - name: AKS_UNIQUE_KEY_DEPLOY_DATE
              value: REPLabc_WITH_DATE_STAMP
            - name: SENTRY_DNS 
              value: "https://[email protected]/5658030"
            - name: APPLE_PAY_MERCHANT_ID
              value: merchant.com.alfuttaim.abcuae
            - name: LOG_ROCKET_ID
              value: pjpo3x/abc
            - name: APP_API_INTERNAL_HOST
              value: 'http://web-api:8071'
            - name: AUTH_SERVER_INTERNAL_HOST
              value: 'http://cas-server:6443'
            - name: ALGOLIA_BRAND
              value: mozanta_abc
            - name: BRAND
              value: abc
            - name: APPLICATION_ID
              value: 6DAMKJX8YE
            - name: SEARCH_API_KEY
              value: 85e7bf88034b7bc60b7f0085683a19af

Upvotes: 0

Views: 2843

Answers (1)

Taimoor Mirza
Taimoor Mirza

Reputation: 1117

The error indicates that you're missing name attribute/field in 14th environment variable (spec.containers[0].env[13]) of the container. However, in the manifest shared above there are no environment variables written.

Can you share the complete manifest file?

Upvotes: 1

Related Questions