简体   繁体   English

Kubernetes头盔-将运行头盔安装在运行的吊舱中

[英]Kubernetes helm - Running helm install in a running pod

I want to spin up a single installer pod with helm install that once running, will apply some logic and install other applications into my cluster using helm install . 我想使用helm install启动一个安装程序吊舱 ,一旦运行,它将应用一些逻辑并使用helm install将其他应用程序安装到我的集群中。

I'm aware of the helm dependencies, but I want to run some business logic with the installations and I'd rather do it in the installer pod and on the host triggering the whole installation process. 我知道掌舵的依赖性,但是我想在安装过程中运行一些业务逻辑,我宁愿在安装程序窗格中以及在主机上触发整个安装过程。

I found suggestions on using the Kubernetes REST API when inside a pod, but helm requires kubectl installed and configured. 我发现了在Pod中使用Kubernetes REST API的建议,但helm需要安装和配置kubectl

Any ideas? 有任何想法吗?

It seems this was a lot easier than I thought... 看来这比我想象的容易得多...

On a simple pod running Debian, I just installed kubectl , and with the default service account's secret that's already mounted, the kubectl was already configured to the cluster's API. 在运行Debian的简单pod上,我刚刚安装了kubectl ,并且已经安装了默认服务帐户的密码,该kubectl已经配置为集群的API。

Note that the configured default namespace is the one that my installer pod is deployed to. 请注意,配置的默认名称空间是我的安装程序安装程序部署到的名称空间。

Verified with 已验证

$ kubectl cluster-info
$ kubectl get ns

I then installed helm , which was already using the kubectl to access the cluster for installing tiller . 然后,我安装了头盔头盔已经在使用kubectl来访问群集以安装 er

Verified with 已验证

$ helm version
$ helm init

I installed a test chart 我安装了测试图

$ helm install --name my-release stable/wordpress

It works!! 有用!!

I hope this helps 我希望这有帮助

You could add kubectl to your installer pod . 您可以将kubectl添加到安装程序pod中

"In cluster" credentials could be provided via service account in "default-token" secret: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/ 可以通过服务帐户以“默认令牌”秘密提供“在群集中”凭据: https : //kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/

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

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