简体   繁体   English

解析 skaffold 配置:解析 skaffold 配置文件时出错

[英]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:因此,我正在尝试自动化 docker 构建和推送过程以及 kubectl 应用部署过程,为此,我在主文件夹中创建了一个 skaffold 配置文件,如下所示:

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:当我尝试在文件夹中使用skaffold dev命令时,出现以下错误:

parsing skaffold config: error parsing skaffold configuration file

Artifacts use context: to reference the source locations.工件使用context:来引用源位置。

I think you must be using an old version of Skaffold.我认为您必须使用旧版本的 Skaffold。 Newer versions of Skaffold provide more detail:较新版本的 Skaffold 提供了更多详细信息:

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.您可能想查看IntelliJ 和 VS Code 的 Cloud Code或在线Cloud Shell Editor ,它提供skaffold.yaml编辑帮助,包括突出显示文件中的错误。

You have content not context in the key underneath - image: change that and it should work.您在下面的键中有content而不是context - image:更改它,它应该可以工作。

This workflow worked for me:这个工作流程对我有用:

  1. Changed first line to: apiVersion: skaffold/v2beta17将第一行更改为:apiVersion: skaffold/v2beta17
  2. Execute 'skaffold init' first首先执行'skaffold init'
  3. Execute 'sakffold dev'执行“sakffold dev”

I recommend checking this documentation: https://skaffold.dev/docs/workflows/我建议查看此文档: https://skaffold.dev/docs/workflows/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM