首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >kubectl部署失败

kubectl部署失败
EN

Stack Overflow用户
提问于 2019-04-22 16:34:24
回答 4查看 6.1K关注 0票数 2

我正在为GKE上的Spring boot应用程序设置CI CD管道。CI生成步骤工作正常,但交付生成步骤由于“error : no objects passed to apply”错误而失败。我可以在云构建中看到以下日志

代码语言:javascript
复制
Starting Step #0 - "Deploy"
Step #0 - "Deploy": Already have image (with digest): gcr.io/cloud-builders/kubectl
Step #0 - "Deploy": Running: gcloud container clusters get-credentials --project="location-finder-kubernetes" --zone="us-central1-b" "location-finder"
Step #0 - "Deploy": Fetching cluster endpoint and auth data.
Step #0 - "Deploy": kubeconfig entry generated for location-finder.
Step #0 - "Deploy": Running: kubectl apply -f kubernetes.yaml
Step #0 - "Deploy": error: no objects passed to apply
Finished Step #0 - "Deploy"
ERROR
ERROR: build step 0 "gcr.io/cloud-builders/kubectl" failed: exit status 1

其中location-finder是群集的名称。

为了设置这个管道,我遵循了https://cloud.google.com/kubernetes-engine/docs/tutorials/gitops-cloud-build中提到的所有指导原则

这个失败步骤的cloudbuild.yaml内容是

代码语言:javascript
复制
steps:
- name: 'gcr.io/cloud-builders/kubectl'
  id: Deploy
  args:
  - 'apply'
  - '-f'
  - 'kubernetes.yaml'
  env:
  - 'CLOUDSDK_COMPUTE_ZONE=us-central1-b'
  - 'CLOUDSDK_CONTAINER_CLUSTER=location-finder'

Kubectl版本:

代码语言:javascript
复制
kubectl version
Client Version: version.Info{Major:"1", Minor:"11+", GitVersion:"v1.11.9-dispatcher", GitCommit:"e3f5193e8f1091a162af7e17a781e6a3129bcfd0", GitTreeState:"clean", BuildDate:"2019-03-28T18:13:46Z", GoVersion:"go1.10.8", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"11+", GitVersion:"v1.11.8-gke.6", GitCommit:"394ee507d00f15a63cef577a14026096c310698e", GitTreeState:"clean", BuildDate:"2019-03-30T19:31:43Z", GoVersion:"go1.10.8b4", Compiler:"gc", Platform:"linux/amd64"}

我是否遗漏了任何配置?

EN

回答 4

Stack Overflow用户

发布于 2019-05-02 12:44:13

为了测试,我运行了相同的kubectl apply -f kubernetes.yaml,但传递了一个空的yaml文件,并得到了与您相同的错误。在你的yaml文件中有没有什么内容?

票数 6
EN

Stack Overflow用户

发布于 2019-04-22 17:43:52

很可能是因为kubernetes.yaml文件中的对象定义不正确。

请检查该文件并验证您是否能够手动部署它。如果它有效,那么连续交付也应该有效。

票数 2
EN

Stack Overflow用户

发布于 2019-11-04 14:31:39

我也面临着同样的问题,参考GKE上的Google Docs for CI/CD。

你有同样的解决方案吗?

代码语言:javascript
复制
BUILD Starting Step #0 - "Deploy"
Step #0 - "Deploy": Already have image (with digest): gcr.io/cloud-builders/kubectl
Step #0 - "Deploy": Running: gcloud container clusters get-credentials --project="amcartecom" --zone="us-central1-b" "hello-cloudbuild"
Step #0 - "Deploy": Fetching cluster endpoint and auth data.
Step #0 - "Deploy": kubeconfig entry generated for hello-cloudbuild.
Step #0 - "Deploy": Running: kubectl apply -f kubernetes.yaml
Step #0 - "Deploy": error: no objects passed to apply
Finished Step #0 - "Deploy"
ERROR
ERROR: build step 0 "gcr.io/cloud-builders/kubectl" failed: exit status 1
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55791485

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档