由于缺少配置,运行kubectl补丁--local失败 [英] Running kubectl patch --local fails due to missing config

查看:189
本文介绍了由于缺少配置,运行kubectl补丁--local失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个GitHub Actions工作流,用于替换部署清单中的值.我使用kubectl patch --local=true更新图像.直到现在,它一直可以完美地工作.今天,工作流程开始失败,并显示Missing or incomplete configuration info错误.

I have a GitHub Actions workflow that substitutes value in a deployment manifest. I use kubectl patch --local=true to update the image. This used to work flawlessly until now. Today the workflow started to fail with a Missing or incomplete configuration info error.

我正在使用--local标志运行kubectl,因此不需要配置.有谁知道kubectl突然开始需要配置的原因可能是什么?我在Kubernetes GitHub问题中找不到任何有用的信息,而且数小时的搜索无济于事.

I am running kubectl with --local flag so the config should not be needed. Does anyone know what could be the reason why kubectl suddenly started requiring a config? I can't find any useful info in Kubernetes GitHub issues and hours of googling didn't help.

GitHub Actions工作流程中失败步骤的输出:

Output of the failed step in GitHub Actions workflow:

Run: kubectl patch --local=true -f authserver-deployment.yaml -p '{"spec":{"template":{"spec":{"containers":[{"name":"authserver","image":"test.azurecr.io/authserver:20201230-1712-d3a2ae4"}]}}}}' -o yaml > temp.yaml && mv temp.yaml authserver-deployment.yaml

error: Missing or incomplete configuration info.  Please point to an existing, complete config file:


  1. Via the command-line flag --kubeconfig
  2. Via the KUBECONFIG environment variable
  3. In your home directory as ~/.kube/config

To view or setup config directly use the 'config' command.
Error: Process completed with exit code 1.

kubectl version的输出:

Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.0", 
GitCommit:"ffd68360997854d442e2ad2f40b099f5198b6471", GitTreeState:"clean", 
BuildDate:"2020-11-18T13:35:49Z", GoVersion:"go1.15.0", Compiler:"gc", 
Platform:"linux/amd64"}

推荐答案

我最终使用sed将字符串替换为image

I ended up using sed to replace the string with image

  - name: Update manifests with new images
    working-directory: test/cloud
    run: |
      sed -i "s~image:.*$~image: ${{ steps.image_tags.outputs.your_new_tag }}~g" your-deployment.yaml

现在就像魅力一样.

这篇关于由于缺少配置,运行kubectl补丁--local失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆