Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 935
NafazBenzema Avatar asked Apr 07 '26 21:04

NafazBenzema


1 Answers

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

From

apiVerion: v1

To

apiVersion: v1

like image 61
Sagar Velankar Avatar answered Apr 09 '26 11:04

Sagar Velankar