Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

1.2K
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório

0

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

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda