繁体   English   中英

Gitlab安装的Helm: Error: context deadline exceeded

[英]Gitlab-installed Helm: Error: context deadline exceeded

我在 AWS 中使用 Kops 安装了一个 Kubernetes 集群。 我已经使用 Gitlab UI 安装了 Helm Tiller。 Tiller 服务似乎是通过 Gitlab 工作的,例如我已经从 Gitlab UI 安装了 Ingress。

但是,当尝试从我的 CLI 使用相同的 Tiller 时,我无法让它工作。 当我helm init时,它说它已经安装(这完全有道理):

helm init --tiller-namespace gitlab-managed-apps --service-account tiller
$HELM_HOME has been configured at C:\Users\danie\.helm.
Warning: Tiller is already installed in the cluster.
(Use --client-only to suppress this message, or --upgrade to upgrade Tiller to the current version.)
Happy Helming!

但是,例如,当尝试列出图表时,需要 5 分钟然后超时:

$ helm list --tiller-namespace gitlab-managed-apps --debug
[debug] Created tunnel using local port: '60471'

[debug] SERVER: "127.0.0.1:60471"

Error: context deadline exceeded

我缺少什么,所以我可以从我的 CLI 使用 Gitlab 安装的 Tiller?

您确定您的 Tiller 服务器安装在“gitlab-managed-apps”命名空间中吗? 默认情况下,它会根据 GitLab 网站上的官方安装说明安装到“kube-system”,这意味着这就是导致您的helm ls命令失败的原因(只需跳过它)

验证它的最佳方法是通过:

kubectl get deploy/tiller-deploy -n gitlab-managed-apps

您是否在该命名空间中看到任何与 tiller 相关的部署对象?

假设您可以使用当前的 kube 上下文操作 KOPS 集群,那么在本地运行 helm 客户端应该没有问题。 您始终可以在 helm 命令中显式使用--kube-context参数。

更新:

我想我知道是什么导致了你的问题,当通过 GitLab UI 安装 Helm 时,Helm 在 helm 和 tiller 之间使用安全连接(SSL)(证明在这里)。

知道了这一点,这意味着您应该从安装在 Tiller Pod 上的 Secret 对象中检索一组证书:

#The CA
ca.cert.pem
ca.key.pem
#The Helm client files
helm.cert.pem
helm.key.pem
#The Tiller server files
tiller.cert.pem
tiller.key.pem

然后使用以下命令将 helm 客户端连接到 tiller 服务器,如此所述:

helm ls --tls --tls-ca-cert ca.cert.pem --tls-cert helm.cert.pem --tls-key helm.key.pem

这是我一直这样做的方式。

首先在gitlab的tiller pod中打开一个shell:

# replace the pod name, tiller-deploy-5bb888969c-7bzpl with your own
kubectl exec -n gitlab-managed-apps tiller-deploy-5bb888969c-7bzpl -it -- sh

然后使用 pod 的本地 helm 和 certs... 连接到 tiller

$ env | grep TILLER_TLS_CERTS
#cd to the result, in my case /etc/certs
$ cd /etc/certs
# connect to tiller with the certs using the native helm (/helm) in my case:
$ /helm ls --tls --tls-ca-cert ./ca.crt --tls-cert ./tls.crt --tls-key ./tls.key

暂无
暂无

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

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