Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

1.2K
Views
Validating Error on deployment in Kubernetes

I have tried to deploy the producer-service app with MySQL database in the Kubernetes cluster. When i try to deploy producer app then the following validation error has thrown.

error: error validating "producer-deployment.yml": error validating data: apiVersion not set; if you choose to ignore these errors, turn validation off with --validate=false

producer-deployment.yml

apiVerion: v1
kind: Service
metadata:
  name: producer-app
  labels:
    name: producer-app
spec:
  ports:
    -nodePort: 30163
    port: 9090
    targetPort: 9090
    protocol: TCP
  selector:
    app: producer-app
  type: NodePort

---

apiVersion: apps/v1
kind: Deployment
metadata:
  name: producer-app
spec:
  selector:
    matchLabels:
      app: producer-app
  replicas: 3
  template:
    metadata:
      labels:
        app: producer-app
    spec:
      containers:
        - name: producer
          image: producer:1.0
          ports:
            - containerPort: 9090
          env:
            - name: DB_HOST
              valueFrom:
               configMapKeyRef:
                name: db-config
                key: host
            - name: DB_NAME
              valueFrom:
               configMapKeyRef:
                name: db-config
                key: name
            - name: DB_USERNAME
              valueFrom:
               secretKeyRef:
                name: db-user
                key: username
            - name: DB_PASSWORD
              valueFrom:
               secretKeyRef:
                name: db-user
                key: password

i have tried to find the error or typo within the config file but still, couldn't. What is wrong with the producer-deployment.yml file

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Multiple issues:

  1. It would be apiVersion: v1 not apiVerion: v1 in the Service

  2. wrong Spec.ports formation of Service. As nodePort, port, targetPort and protocol are under the ports as a list but your did wrong formation.

your service yaml should be like below:

apiVersion: v1
kind: Service
metadata:
  name: producer-app
  labels:
    name: producer-app
spec:
  ports:
    - nodePort: 30163
      port: 9090
      targetPort: 9090
      protocol: TCP
  selector:
    app: producer-app
  type: NodePort

So your overall yaml should be:

apiVersion: v1
kind: Service
metadata:
  name: producer-app
  labels:
    name: producer-app
spec:
  ports:
    - nodePort: 30163
      port: 9090
      targetPort: 9090
      protocol: TCP
  selector:
    app: producer-app
  type: NodePort

---

apiVersion: apps/v1
kind: Deployment
metadata:
  name: producer-app
spec:
  selector:
    matchLabels:
      app: producer-app
  replicas: 3
  template:
    metadata:
      labels:
        app: producer-app
    spec:
      containers:
        - name: producer
          image: producer:1.0
          ports:
            - containerPort: 9090
          env:
            - name: DB_HOST
              valueFrom:
                configMapKeyRef:
                  name: db-config
                  key: host
            - name: DB_NAME
              valueFrom:
                configMapKeyRef:
                  name: db-config
                  key: name
            - name: DB_USERNAME
              valueFrom:
                secretKeyRef:
                  name: db-user
                  key: username
            - name: DB_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: db-user
                  key: password
over 4 years ago · Santiago Trujillo Report

0

  • Please change the first line in producer-deployment.yml. Letter s is missing.

From

apiVerion: v1

To

apiVersion: v1

over 4 years ago · Santiago Trujillo Report

0

There is a typo in the first line: "apiVerion" should be "apiVersion".

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!