Search code examples
dockerkubernetesyamlweb-deploymentskaffold

parsing skaffold config: error parsing skaffold configuration file


So, I'm trying to automate docker build and push process and as well as the kubectl apply deployment process and for this, I have created a skaffold config file in main folder as follows:

apiVersion: skaffold/v2alpha3
kind: Config
deploy:
  kubectl:
    manifests:
      - ./infra/k8s/*
build:
  local:
    push: false
  artifacts:
    - image: xyz/client
      context: client
      docker:
        dockerfile: Dockerfile
      sync:
        manual:
          - src: 'src/**/*.js'
            dest: .
    - image: xyz/comments
      context: comments
      docker:
        dockerfile: Dockerfile
      sync:
        manual:
          - src: '*.js'
            dest: .
    - image: xyz/event-bus
      context: event-bus
      docker:
        dockerfile: Dockerfile
      sync:
        manual:
          - src: '*.js'
            dest: .
    - image: xyz/moderation
      context: moderation
      docker:
        dockerfile: Dockerfile
      sync:
        manual:
          - src: '*.js'
            dest: .
    - image: xyz/posts
      context: posts
      docker:
        dockerfile: Dockerfile
      sync:
        manual:
          - src: '*.js'
            dest: .
    - image: xyz/query
      context: query
      docker:
        dockerfile: Dockerfile
      sync:
        manual:
          - src: '*.js'
            dest: .

And when i try to use skaffold dev command in folder I'm getting the following error:

parsing skaffold config: error parsing skaffold configuration file

Solution

  • Artifacts use context: to reference the source locations.

    I think you must be using an old version of Skaffold. Newer versions of Skaffold provide more detail:

    parsing skaffold config: unable to parse config: yaml: unmarshal errors:
      line 4: field content not found in type v2alpha3.Artifact
      line 12: field content not found in type v2alpha3.Artifact
      line 20: field content not found in type v2alpha3.Artifact
      line 28: field content not found in type v2alpha3.Artifact
      line 36: field content not found in type v2alpha3.Artifact
      line 44: field content not found in type v2alpha3.Artifact
    

    You might like to check out Cloud Code for IntelliJ and VS Code or the online Cloud Shell Editor which provides skaffold.yaml editing assistance, including highlighting errors in the file.