skip to Main Content

I’m working on a microservices app by docker , kubernetes and skaffold
and this is my skaffold config file

apiVersion: skaffold/v2alpha3
kind: Config
deploy:
  kubectl:
    manifests:
      - ./infra/k8s/*
build:
  local:
    push: false
  artifacts:
    - image: mohamedl3zb/auth
      context: auth
      docker:
        dockerfile: Dockerfile
      sync:
        manual:
          - src: "src/**/*.ts"
            dest: .
    - image: mohamedl3zb/tickets
      context: tickets
      docker:
        dockerfile: Dockerfile
      sync:
        manual:
          - src: "src/**/*.ts"
            dest: .

I get this error

exiting dev mode because first deploy failed: kubectl create: running [kubectl --context docker-desktop create --dry-run=client -oyaml -f C:UsersMohamed SalahDesktopticket-appinfrak8sauth-depl.yaml -f C:UsersMohamed SalahDesktopticket-appinfrak8sauth-mongo-depl.yaml -f C:UsersMohamed SalahDesktopticket-appinfrak8singress-srv.yaml -f C:UsersMohamed SalahDesktopticket-appinfrak8snats-depl.yaml -f C:UsersMohamed SalahDesktopticket-appinfrak8stickets-depl.yaml -f C:UsersMohamed SalahDesktopticket-appinfrak8stickets-mongo.depl.yaml]
 - stdout: "apiVersion: apps/v1nkind: Deploymentnmetadata:n  name: auth-depln  namespace: defaultnspec:n  replicas: 1n  selector:n    matchLabels:n      app: authn  template:n    metadata:n      labels:n        app: authn    spec:n      containers:n      - env:n        - name: MONGO_URIn  
        value: mongodb://auth-mongo-srv:27017/authn        - name: JWT_KEYn          valueFrom:n            secretKeyRef:n              key: JWT_KEYn              name: jwt-secret-keyn        image: mohamedl3zb/authn        name: authn---napiVersion: v1nkind: Servicenmetadata:n  name: auth-srvn  namespace: defaultnspec:n  ports:n  - name: authn    port: 3000n    protocol: TCPn    targetPort: 3000n  selector:n    app: authn---napiVersion: apps/v1nkind: Deploymentnmetadata:n  name: auth-mongo-depln  namespace: defaultnspec:n  replicas: 1n  selector:n    matchLabels:n      app: auth-mongon  template:n    metadata:n      labels:n        app: auth-mongon    spec:n      containers:n      - image: mongon        name: auth-mongon---napiVersion: v1nkind: Servicenmetadata:n  name: auth-mongo-srvn  namespace: defaultnspec:n  ports:n  - name: dbn    port: 27017n    protocol: TCPn    targetPort: 27017n  selector:n    app: auth-mongon---napiVersion: extensions/v1beta1nkind: Ingressnmetadata:n  annotations:n    kubernetes.io/ingress.class: nginxn    nginx.ingress.kubernetes.io/use-regex: "true"n  name: ingress-servicen  namespace: defaultnspec:n  rules:n  - host: ticketing.devn    http:n      paths:n      - backend:n          serviceName: auth-srvn          servicePort: 3000n        path: /api/users/?(.*)n      - backend:n          serviceName: tickets-srvn          servicePort: 3000n        path: /api/tickets/?(.*)n      - backend:n          serviceName: orders-srvn          servicePort: 3000n        path: /api/orders/?(.*)n      - backend:n          serviceName: payments-srvn          servicePort: 3000n        path: /api/payments/?(.*)n      - backend:n          serviceName: client-srvn          servicePort: 3000n        path: /?(.*)n---napiVersion: v1nkind: Servicenmetadata:n  name: nats-srvn  namespace: defaultnspec:n  ports:n  - name: clientsn    port: 4222n    protocol: TCPn  
  targetPort: 4222n  - name: monitoringn    port: 8222n    protocol: TCPn    targetPort: 8222n  selector:n    app: natsn---napiVersion: apps/v1nkind: Deploymentnmetadata:n  name: tickets-mongo-depln  namespace: defaultnspec:n  replicas: 1n  selector:n    matchLabels:n      app: tickets-mongon  template:n    metadata:n      labels:n        app: tickets-mongon    spec:n      containers:n      - image: mongon        name: tickets-mongon---napiVersion: v1nkind: Servicenmetadata:n  name: tickets-mongo-srvn  namespace: defaultnspec:n  ports:n  - name: dbn    port: 27017n    protocol: TCPn    targetPort: 27017n  selector:n    app: tickets-mongon"
 - stderr: "unable to recognize "C:\\Users\\Mohamed Salah\\Desktop\\ticket-app\\infra\\k8s\\nats-depl.yaml": no matches for kind "Deplyment" in version "apps/v1"nerror validating "C:\\Users\\Mohamed Salah\\Desktop\\ticket-app\\infra\\k8s\\tickets-depl.yaml": error validating data: ValidationError(Deployment.spec.template.spec.containers[0].env[4].valueFrom): unknown field "fielsRef" in io.k8s.api.core.v1.EnvVarSource; if you choose to ignore these errors, turn validation off with --validate=falsen"
 - cause: exit status 1

I’m working with docker desktop and kubernetes

2

Answers


  1. You’ve got two typos in your manifests that the admission controller is rejecting.

    The first is nats-depl.yaml where Deployment is misspelled.

    The second you mentioned already fixing in a comment, but I’ll leave the relevant part of the error here for completeness:

    "C:\\Users\\Mohamed Salah\\Desktop\\ticket-app\\infra\\k8s\\tickets-depl.yaml": error validating data: ValidationError(Deployment.spec.template.spec.containers[0].env[4].valueFrom): unknown field "fielsRef" in io.k8s.api.core.v1.EnvVarSource

    Login or Signup to reply.
  2. Error seems to be this
    "unknown field "fielsRef" in io.k8s.api.core.v1.EnvVarSource"

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search