简体   繁体   English

删除名称空间并删除头盔部署?

[英]Delete namespace and also delete helm deployment?

I deploy my helm deploys to isolated namespaces 我将头盔部署到隔离的名称空间

Deleting a namespace deletes all the resources in it- except the helm deployment 删除名称空间会删除其中的所有资源-除了helm部署

Deleting a helm deployment deletes all resource in it- except the namespace 删除Helm部署会删除其中的所有资源-除了名称空间

I have to do this which seems redundant: 我必须这样做,这似乎是多余的:

helm del `helm ls NAMESPACE --short` --purge
kubectl delete namespace NAMESPACE

Id rather just delete my namespace and have the helm deploy also purged- is this possible? 我宁愿只删除我的名称空间,也清除头盔部署-这可能吗?

Deleting a namespace deletes all the resources in it- except the helm deployment 删除名称空间会删除其中的所有资源-除了helm部署

This can't be (deleting a namespace implies deleting everything in it, there aren't any exceptions), and must means that the state representing Helm's concept of a deployment doesn't live in that namespace. 这不可能是(删除名称空间意味着删除其中的所有内容,没有任何例外),并且必须表示代表Helm的部署概念的状态不存在于该名称空间中。 Helm stores these as config maps in the TILLER_NAMESPACE . Helm将这些作为配置映射存储在TILLER_NAMESPACE See here and here . 看到这里这里

It's not surprising that if you create some resources with helm and then go "under the hood" and delete those resources directly via kubectl , Helm's state of the world won't result in that deployment disappearing. 毫不奇怪,如果您创建了一些带有helm资源,然后“通过kubectl ”直接通过kubectl删除了这些资源,那么Helm的世界状态将不会导致该部署消失。

Deleting a helm deployment deletes all resource in it- except the namespace 删除Helm部署会删除其中的所有资源-除了名称空间

That sounds like expected behaviour. 这听起来像是预期的行为。 Presumably you created the namespace out of band with kubectl , it's not part of your Helm deployment. 大概是您使用kubectl带外创建了名称空间,它不是Helm部署的一部分。 So deleting the Helm deployment wouldn't delete that namespace. 因此,删除Helm部署不会删除该命名空间。

If you kubectl create namespace NS and helm install CHART --namespace NS then it's not surprising that to clean up, you need to helm delete the release and then kubectl delete the namespace. 如果您kubectl create namespace NShelm install CHART --namespace NS那么清理它就不足为奇了,您需要先helm delete版本,然后kubectl delete命名空间。

The only way I could imagine to do that would be for the Helm chart itself to both create a namespace and create all subsequent namespace-scoped resources within that namespace. 我能想到的唯一方法是让Helm图表本身创建一个名称空间,并在该名称空间内创建所有后续的基于名称空间的资源。 Here is an example that appears to do such a thing. 是一个看起来可以做到一点的例子。

There is a PR created to cleanup all resources deployed from helm. 创建了一个PR来清理从helm部署的所有资源。 follow the link --> https://github.com/helm/helm/issues/1464 按照链接-> https://github.com/helm/helm/issues/1464

hopefully in the future release it will be addressed 希望在将来的版本中可以解决

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

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