gpt4 book ai didi

kubernetes - gitlab + GKE + AutoDevops 自动部署部署失败。错误 : arguments in resource/name form must have a single resource and name. 如何查找错误?

转载 作者:行者123 更新时间:2023-12-03 17:16:37 25 4
gpt4 key购买 nike

我是 gitlab CI 的新手。所以我想用 https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/gitlab/ci/templates/Jobs/Deploy.gitlab-ci.yml , 使用自定义聊天将简单的测试 django 应用程序部署到附加到我的 gitlab 项目的 kubernetes 集群 https://gitlab.com/aidamir/citest/tree/master/chart .一切顺利,但最后一刻它显示了来自 kubectl 的错误消息并且失败了。这是管道的输出:

Running with gitlab-runner 12.2.0 (a987417a)
on docker-auto-scale 72989761
Using Docker executor with image registry.gitlab.com/gitlab-org/cluster-integration/auto-deploy-image:v0.1.0 ...
Running on runner-72989761-project-13952749-concurrent-0 via runner-72989761-srm-1568200144-ab3eb4d8...
Fetching changes with git depth set to 50...
Initialized empty Git repository in /builds/myporject/kubetest/.git/
Created fresh repository.
From https://gitlab.com/myproject/kubetest
* [new branch] master -> origin/master
Checking out 3efeaf21 as master...

Skipping Git submodules setup
Authenticating with credentials from job payload (GitLab Registry)
$ auto-deploy check_kube_domain
$ auto-deploy download_chart
Creating /root/.helm
Creating /root/.helm/repository
Creating /root/.helm/repository/cache
Creating /root/.helm/repository/local
Creating /root/.helm/plugins
Creating /root/.helm/starters
Creating /root/.helm/cache/archive
Creating /root/.helm/repository/repositories.yaml
Adding stable repo with URL: https://kubernetes-charts.storage.googleapis.com
Adding local repo with URL: http://127.0.0.1:8879/charts
$HELM_HOME has been configured at /root/.helm.
Not installing Tiller due to 'client-only' flag having been set
"gitlab" has been added to your repositories
No requirements found in /builds/myproject/kubetest/chart/charts.
No requirements found in chart//charts.
$ auto-deploy ensure_namespace
NAME STATUS AGE
kubetest-13952749-production Active 46h
$ auto-deploy initialize_tiller
Checking Tiller...
Tiller is listening on localhost:44134
Client: &version.Version{SemVer:"v2.14.0", GitCommit:"05811b84a3f93603dd6c2fcfe57944dfa7ab7fd0", GitTreeState:"clean"}
[debug] SERVER: "localhost:44134"

Kubernetes: &version.Info{Major:"1", Minor:"13+", GitVersion:"v1.13.7-gke.24", GitCommit:"2ce02ef1754a457ba464ab87dba9090d90cf0468", GitTreeState:"clean", BuildDate:"2019-08-12T22:05:28Z", GoVersion:"go1.11.5b4", Compiler:"gc", Platform:"linux/amd64"}
Server: &version.Version{SemVer:"v2.14.0", GitCommit:"05811b84a3f93603dd6c2fcfe57944dfa7ab7fd0", GitTreeState:"clean"}

$ auto-deploy create_secret
Create secret...
secret "gitlab-registry" deleted
secret/gitlab-registry replaced
$ auto-deploy deploy
secret "production-secret" deleted
secret/production-secret replaced
Deploying new release...
Release "production" has been upgraded.
LAST DEPLOYED: Wed Sep 11 11:12:21 2019
NAMESPACE: kubetest-13952749-production
STATUS: DEPLOYED

RESOURCES:
==> v1/Deployment
NAME READY UP-TO-DATE AVAILABLE AGE
production-djtest 1/1 1 1 46h

==> v1/Job
NAME COMPLETIONS DURATION AGE
djtest-update-static-auik5 0/1 3s 3s

==> v1/PersistentVolumeClaim
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
nginx-storage-pvc Bound nfs 10Gi RWX 3s

==> v1/Pod(related)
NAME READY STATUS RESTARTS AGE
djtest-update-static-auik5-zxd6m 0/1 ContainerCreating 0 3s
production-djtest-5bf5665c4f-n5g78 1/1 Running 0 46h

==> v1/Service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
production-djtest ClusterIP 10.0.0.146 <none> 5000/TCP 46h


NOTES:
1. Get the application URL by running these commands:
export POD_NAME=$(kubectl get pods --namespace kubetest-13952749-production -l "app.kubernetes.io/name=djtest,app.kubernetes.io/instance=production" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl port-forward $POD_NAME 8080:80

error: arguments in resource/name form must have a single resource and name
ERROR: Job failed: exit code 1

请帮我找出错误消息的原因。

我确实从镜像 registry.gitlab.com/gitlab-org/cluster-integration/auto-deploy-image:v0.1.0 中查看了自动部署脚本。有一个设置变量可以禁用推出状态检查
  if [[ -z "$ROLLOUT_STATUS_DISABLED" ]]; then
kubectl rollout status -n "$KUBE_NAMESPACE" -w "$ROLLOUT_RESOURCE_TYPE/$name"
fi


所以设置
variables: 
ROLLOUT_STATUS_DISABLED: "true"

防止作业失败。但我仍然不知道为什么脚本不能与我的自定义聊天一起工作?。当我从笔记本电脑执行状态检查命令时,它没有显示任何错误。
kubectl rollout status -n kubetest-13952749-production -w "deployment/production-djtest"
deployment "production-djtest" successfully rolled out


我还发现了对类似问题的投诉
https://gitlab.com/gitlab-com/support-forum/issues/4737 ,但帖子上没有事件。

这是我的 gitlab-ci.yaml:
image: alpine:latest

variables:
POSTGRES_ENABLED: "false"
DOCKER_DRIVER: overlay2
ROLLOUT_RESOURCE_TYPE: deployment
DOCKER_TLS_CERTDIR: "" # https://gitlab.com/gitlab-org/gitlab-runner/issues/4501

stages:
- build
- test
- deploy # dummy stage to follow the template guidelines
- review
- dast
- staging
- canary
- production
- incremental rollout 10%
- incremental rollout 25%
- incremental rollout 50%
- incremental rollout 100%
- performance
- cleanup

include:
- template: Jobs/Deploy.gitlab-ci.yml # https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/gitlab/ci/templates/Jobs/Deploy.gitlab-ci.yml


variables:
CI_APPLICATION_REPOSITORY: eu.gcr.io/myproject/django-test


最佳答案

error: arguments in resource/name form must have a single resource and name



您链接的那个问题有 Closed (moved)状态,因为它是从 issue 66016 移走的,我相信这是真正的答案:

Please try adding the following to your .gitlab-ci.yml:


variables:
ROLLOUT_RESOURCE_TYPE: deployment

使用 只是 Jobs/Deploy.gitlab-ci.yml省略 the variables: block from Auto-DevOps.gitlab-ci.yml 正确设置该变量

在你的情况下,我认为你只需要移动 variables:直到顶部,因为(afaik)一个不能有两个顶级 variables:块。我真的很惊讶你的 .gitlab-ci.yml通过验证

另外,如果你还没有看过,可以设置 TRACE变量为 switch auto-deploy into set -x mode这对于准确了解它正在尝试做什么非常有帮助。我相信你的命令试图运行 rollout status /whatever-name只是一个斜线,它不知道那是什么类型的名字。

关于kubernetes - gitlab + GKE + AutoDevops 自动部署部署失败。错误 : arguments in resource/name form must have a single resource and name. 如何查找错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57889590/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com