我正在使用 gitlab CI/CD 和 GKE。我正在尝试通过 gitlab 创建一个 secret 。我收到如下错误
The connection to the server localhost:8080 was refused - did you specify the right host or port?
下面是yaml文件中的代码。
deploy to dev:
stage: Dev-Deploy
image: dtzar/helm-kubectl
script:
- kubectl create secret docker-registry pradeep_secret --docker-server=$ARTIFACTORY_DOCKER_REPOSITORY --docker-username=$ARTIFACTORY_USER --docker-password=$ARTIFACTORY_PASS --docker-email="<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="accdcecfeccbc1cdc5c082cfc3c1" rel="noreferrer noopener nofollow">[email protected]</a>"
我该如何调试或修复它。
最佳答案
看起来您没有正确配置集群的配置。
您可以运行 kubectl config view
来查看 CI 当前使用的配置,并确保其正确。
该错误意味着 CI 正在尝试连接到监听 http://localhost:8080
的集群,但该集群没有响应。我想这不是一个正确的配置 - 这解释了为什么它不起作用。这是在未提供配置的情况下使用的默认配置。
关于gitlab - kubectl 通过 gitlab 创建 secret 抛出错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55700795/