You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems the latest helm3 from dev-v3 branch doesn't take the --namespace parameter. Basically I try to deploy an example chart onto a different namespace, but it doesn't seem to take effect. Below are the commands and outputs. How is helm3 planning to support namespace and how should namespaces be specified in helm charts for helm3? Thanks for any help / pointers!
Output of helm version:
version.BuildInfo{Version:"v3.0+unreleased", GitCommit:"658c66dc66684a85be787a066c8434ac5212648c", GitTreeState:"clean"}
printer.go:84: [debug] Original chart version: ""
printer.go:84: [debug] CHART PATH: /usr/local/alpineclient.go:94: [debug] building resources from manifest
client.go:99: [debug] creating 1 resource(s)
NAME: alpine
LAST DEPLOYED: 2019-04-19 17:07:30.391894983 +0000 UTC m=+0.063175512
NAMESPACE: default
STATUS: deployed
kubectl get pod -n default
NAME READY STATUS RESTARTS AGE
alpine-alpine 1/1 Running 0 6m
Reacted by Michel Carroll, Matt Calvert, Michael Andrews, David Schneider, Omega Zeng, Christopher Berger, Zakariae Filali, Ziang Guo, Javier Toledo, Andreas Sommer and 5 more
There was a change in Helm 3 where it now takes the current namespace from your local kube config. If it's not present, the default namespace is used.
To change the current namespace for the alpha, you can use
kubectl config set-context NAME --namespace=foo
Helm will pick that up and use that namespace the next time you invoke it.
There's a few design refactors going on within Helm 3 to address prioritization issues with loading settings from CLI flags and the kube config. As I understand it, the --namespace flag was temporarily removed but it's planned to allow some way to change the namespace on-the-fly.
@adamreese do you have any other context I may be missing here on why we removed the --namespace flag?
Thanks @bacongobbler for the info, it works! So I guess the --namespace flag would be added back later to customize the namespace config on the kubectl.
Reacted by 飞走不可, jeff-knurek, Jason Knight, Spyros Trigazis, Michael Andrews, rpeets, Richard Thombs, Nik Voss, Julio Chana, Tomas Markauskas and 10 more
There was a change in Helm 3 where it now takes the current namespace from your local kube config. If it's not present, the default namespace is used.
To change the current namespace for the alpha, you can use
kubectl set-context NAME --namespace=foo
Helm will pick that up and use that namespace the next time you invoke it.
There's a few design refactors going on within Helm 3 to address prioritization issues with loading settings from CLI flags and the kube config. As I understand it, the --namespace flag was temporarily removed but it's planned to allow some way to change the namespace on-the-fly.
@adamreese do you have any other context I may be missing here on why we removed the --namespace flag?
Hi,The command to correctly switch between different contexts should be like this:
It seems also that the namespace is no longer created by helm, even when specifying it through the context - please can someone confirm that this is a breaking change ?
@RyanSiu1995 This is intended behaviour to mimic the same behaviour as kubectl create --namespace foo -f deployment.yaml. Namespaces are a global cluster resource and the user installing resources into that namespace may not have the proper administrative rights to install the namespace itself. Therefore, Helm 3 now requires for the namespace to be created in advance. It is described in more details in #5753 (comment).
Reacted by Ryan, Siu Long Wa, Johanan Liebermann, Andy Suderman and Michel Carroll
Sorry for being late to the party :). I just stumbled over the "namespace creation" issue.
@RyanSiu1995 thank you for the explanation. I have a couple of follow up questions:
It appears that --namespace flag handling behavior had changed from Helm2 -> Helm3. If so, perhaps it warrants "better" or more prominent documentation emphasizing this difference. I was caught by surprise by this change, and it sounds like many others. It is more of a recommendation really)
(More important). In response to:
Namespaces are a global cluster resource and the user installing resources into that namespace may not have the proper administrative rights to install the namespace itself.
While I understand the rationale behind "not allowing" Helm3 users to create "cluster scoped" resources, like namespace(s), I cannot help but notice that this rationale is not used (or not consistently followed) in other aspects like creation of CRD's resources, which are also cluster scoped. I.E., if my chart includes CRD's, those will be created w/out any problems, and yet chart installation will fill on: Error: create: failed to create: namespaces "foo-bar" not found
Those resources are defined by the chart. Helm allows global resources to be installed as templates within a chart, but it is the responsibility of the cluster administrator to determine the correct scope allowed for a user, including what resources they may or may not be allowed to install (and therefore, what charts they may be permitted to install, and if they can register CRDs or not).
In other words, Helm itself does not assume the user has global administrative privileges to create a namespace similar to kubectl. The chart maintainer can make that assumption if they so desire.
If I understand what @bacongobbler saying it appears that Helm3 takes an opinionated approach that it will not create namespace via --namespace option. It also appears that Helm3 makes special accommodations for allowing chart authors to create "cluster scoped" resources, moreover, it prioritizes such operation precedence (crds are installed before the chart/template).
Can I as Helm3 chart author allow a chart user to parameterize namespace artifact?
For example, today w/ Helm3 I can place a namespace.yaml into crds directory to work around to achieve almost the same behavior as in Helm2 "--namespace". The biggest caveat, crds resources are not "templatized", thus such workaround will result in "constant" namespace value, which may be not acceptable.
Parallel with CRD's is even more apparent in terms of installation precedence. Granted, as a chart author I can include various "cluster scoped" components inside my chart template. However, the "namespace" similar to "crds" have specific precedence constraints were it must be created prior to any chart resource that will target (use) that names instance. As a chart author, I can attempt to work around this by add ing namespace.yaml to my template, as such:
It seems helm3 will not prioritize namespace.yaml, i.e. results in Error: create: failed to create: namespaces "foo-bar" not found
It will fail to install if said namespace already exists: Error: rendered manifests contain a resource that already exists. Unable to continue with install: existing resource conflict: kind: Namespace, namespace: , name: foo-bar
To reduce the impact of migrating to v3, couldn't helm v3 still try to create a non-existing namespace like before? It will fail if it doesn't have the right permissions, like kubectl, but will be backwards compatible when the permissions are sufficient.
For example, our cicd tool deploys our charts and has admin privileges. If v3 tried to create the namespace, my deployments would continue working as is. Currently though, I will need to go through all my different deployment scripts and add a kubectl create namespace before every helm install.
Starting from scratch I agree the current v3 behavior seems right, but considering the v2 behavior, maybe an in-between solution would be more justified for v3?
It is hard for me to find good justification behind this change beyond possibly following:
Unlike Helm2 "cluster centric", Helm3 is "namespace centric". I.E.,
in Helm2: helm list shows all charts across all namespaces irrespective of the current kubeconfig context
in Helm3: helm list shows chart only for a specific namespace, and if/when the namespace is not provided then Helm3 defaults to the current kubeconfig context.
If the --namespace functionality is preserved (as in Helm2), I can possibly see how this may lead to somewhat confusing user experience:
helm install test my-chart --namespace foo-bar
helm list
may not show the installed chart if the current kubeconfig context namespace is not foo-bar
However, my $0.02 I think this is a bit "heavy-handed" approach (if this is the main/only rationale), and I would prefer to retain --namespace functionality and use:
helm install test my-chart --namespace foo-bar
helm list --namespace foo-bar
Many of the reasons why this functionality was removed was listed in #5753, particularly in #5753 (comment).
By supporting the auto-creation of the namespace, community members were proposing new features to Helm which would allow them to modify the namespace during creation, including attaching annotations, labels, policies, constraints, quotas, etc. The list goes on. #3503 is one such example. The creation and management of the namespace is clearly out of scope of helm install, whose goal was to fetch, unpack and install a chart into a cluster. Do one thing and do it well.
The same scoping issue and design flaws were apparent in helm init - users wanted to modify the Deployment and Service that Helm 2 would create server-side. Features like --node-selector, --net-host and other ugly hacks were eventually kludged in to accommodate those requests. It turned out to be a massive design flaw and caused more trouble than it was worth, causing issues like #3414 which was easily handled through tooling that was designed for the workflow of creating and manipulating resources, like kubectl.
The gist of the decision came down to scope. The namespace created during helm install overgrew its original design scope. It turned out to be a poor design decision, so we removed it in favour of tooling that are designed around the creation and management of the namespace, e.g. kubectl create and kubectl edit (or a Helm plugin, hint hint).
Starting from scratch I agree the current v3 behavior seems right, but considering the v2 behavior, maybe an in-between solution would be more justified for v3?
I have to disagree with you here, @marckhouzam. I see where you're coming from, but a poor design choice that was made in a previous version of Helm shouldn't mean that every major version of Helm should support it going forward. A major version of a piece of software is intended to make backwards-incompatible changes in order to move the project forward in a sustainable fashion. If we were supposed to retain behaviour from Helm 2, Tiller would still exist today.
That being said, we are open to suggestions and are always happy to discuss alternative solutions. This was a difficult design choice to make, and I discussed with the other core maintainers a few times why it was removed, so it wasn't done without consideration... or because we felt like breaking user's expectations for the fun of it. 😋
Side-note: can we please carry this discussion forward in #5753? This ticket is about the --namespace not being respected in earlier versions of Helm 3, which has since been fixed. This discussion has gone wayyyyyy off track from the OP's bug report. Thanks.
@bacongobbler thank you for the background and context.
I think I understand where you're coming from: "getting the things wrong Helm2, and making them right in Helm3".
I am afraid I still cannot fully grok this, especially in light of Helm3 crds support (which on the surface looks very much Hem2Namespace-ish). I think I am in favor of deprecating namespace creation via --namespace flag, as long as there is an alternative way to create and consume namespace in the same Helm chart, i.e., w/out shelling out to kubectl, etc. I think it is a highly desirable trait for Helm to be a "one-stop-shop."
On the surface, it does seem like a minor issue: "just run kubectl create ns foo-bar and be done with it". And this very well could be for the end-user environment since it is very likely that the user has kubectl installed locally. However, it has slightly different implications for CICD/Pipeline environments, where one cannot make such an assertion. Instead, now, with Helm3, one needs to make additional accommodations to install kubectl. This issue only gets worse when working with multi-cluster/multi-namespace environments. It is precisely for that reason having Helm as a "one-stop-shop" is so important.
This was made to mimic the same behaviour as kubectl create --namespace foo -f deployment.yaml
While I understand the rationale, I cannot fully agree with it.
One can place both a namespace definition and a deployment definition targetting said namespace into a single file.yaml and run kubectl apply -f file.yaml, which will yield the expected result. From what I gather, there is no way to do so in Helm3.
[...] However, it has slightly different implications for CICD/Pipeline environments, where one cannot make such an assertion. Instead, now, with Helm3, one needs to make additional accommodations to install kubectl. [...]
Not really an issue. Imagine you're using Argo CD to declaratively define what's to be installed in cluster(s). In the applications.argoproj.io:Application object (which defines a Git repo with your Helm chart to install), you can specify the target namespace, and create that requirement right next to that object. Typically, you would define 1 "index application" per cluster which lists all the applications to install. That index application can be deployed manually at cluster creation, through Terraform or even by Argo CD itself (if you're adventurous).
Example for how an index application with 2 sub-applications could look lke:
This will ensure the namespace is created before the CD tool tries to install stuff into it – no matter if it's via Helm, kubectl, kustomize or other tooling. Therefore, Helm should not be special.
@AndiDog good example, however, I think slightly off point
Imagine you're using Argo CD to declaratively define what's to be installed in cluster(s).
No, I am not. But more importantly.
This will ensure the namespace is created before the CD tool tries to install stuff into it – no matter if it's via Helm, kubectl, kustomize or other tooling
The entire point fo my "concern" is NOT to use anything else other than "Helm", i.e. - this is what I refer to as to "one-stop-shop". Granted, there are a number of workarounds, but those are just that the "workarounds", the things I rather not have, especially in light of the existing behavior of Helm2.
@ichekrygin you can create umbrella chart yourself, which will create all namespaces you need before you install other other charts. Also, you can store all releases in single namespace, but via templates deploy them into other namespaces.
Side-note: can we please carry this discussion forward in #5753? This ticket is about the --namespace not being respected in earlier versions of Helm 3, which has since been fixed. This discussion has gone wayyyyyy off track from the OP's bug report. Thanks.
As noted earlier, this discussion is getting off topic from the OP's original issue, so to be respectful of other's time I'm locking this thread as OP's issue has long since been resolved. Please carry the discussion forward in #5753. Thanks.
Activity
bacongobbler commentedon Apr 22, 2019
There was a change in Helm 3 where it now takes the current namespace from your local kube config. If it's not present, the default namespace is used.
To change the current namespace for the alpha, you can use
Helm will pick that up and use that namespace the next time you invoke it.
There's a few design refactors going on within Helm 3 to address prioritization issues with loading settings from CLI flags and the kube config. As I understand it, the --namespace flag was temporarily removed but it's planned to allow some way to change the namespace on-the-fly.
@adamreese do you have any other context I may be missing here on why we removed the --namespace flag?
bacongobbler commentedon Apr 22, 2019
For reference:
helm/cmd/helm/helm.go
Lines 108 to 113 in 658c66d
ericvmw commentedon Apr 22, 2019
Thanks @bacongobbler for the info, it works! So I guess the --namespace flag would be added back later to customize the namespace config on the kubectl.
[-]helm3 dev-v3 namespace[/-][+]helm 3: missing --namespace flag[/+]willholley commentedon May 16, 2019
this is quite a confusing breaking change, given the
--namespaceflag is still listed in theclihelp. It would be at least worth calling out in https://github.com/helm/helm/releases/tag/v3.0.0-alpha.1.aliasmee commentedon May 16, 2019
Hi,The command to correctly switch between different contexts should be like this:
EXAMPLE:
thanks 😄
[-]helm 3: missing --namespace flag[/-][+]helm 3: --namespace not respected[/+]kevtaylor commentedon May 17, 2019
It seems also that the namespace is no longer created by helm, even when specifying it through the context - please can someone confirm that this is a breaking change ?
bacongobbler commentedon May 17, 2019
The namespace should still be created as part of
helm install. If you can recreate the issue, would you mind opening a separate ticket?kevtaylor commentedon May 17, 2019
Done: #5753
floretan commentedon May 21, 2019
Note that the same also applies to
helm delete, you need to set the current namespace to that of the release you want to delete or helm won't find it.20 remaining items
hickeyma commentedon Aug 28, 2019
@RyanSiu1995 This is intended behaviour to mimic the same behaviour as
kubectl create --namespace foo -f deployment.yaml. Namespaces are a global cluster resource and the user installing resources into that namespace may not have the proper administrative rights to install the namespace itself. Therefore, Helm 3 now requires for the namespace to be created in advance. It is described in more details in #5753 (comment).ichekrygin commentedon Oct 23, 2019
Sorry for being late to the party :). I just stumbled over the "namespace creation" issue.
@RyanSiu1995 thank you for the explanation. I have a couple of follow up questions:
It appears that
--namespaceflag handling behavior had changed from Helm2 -> Helm3. If so, perhaps it warrants "better" or more prominent documentation emphasizing this difference. I was caught by surprise by this change, and it sounds like many others. It is more of a recommendation really)(More important). In response to:
While I understand the rationale behind "not allowing" Helm3 users to create "cluster scoped" resources, like
namespace(s), I cannot help but notice that this rationale is not used (or not consistently followed) in other aspects like creation of CRD's resources, which are also cluster scoped. I.E., if my chart includes CRD's, those will be created w/out any problems, and yet chart installation will fill on:Error: create: failed to create: namespaces "foo-bar" not foundThank you in advance.
bacongobbler commentedon Oct 23, 2019
Those resources are defined by the chart. Helm allows global resources to be installed as templates within a chart, but it is the responsibility of the cluster administrator to determine the correct scope allowed for a user, including what resources they may or may not be allowed to install (and therefore, what charts they may be permitted to install, and if they can register CRDs or not).
In other words, Helm itself does not assume the user has global administrative privileges to create a namespace similar to
kubectl. The chart maintainer can make that assumption if they so desire.ichekrygin commentedon Oct 23, 2019
If I understand what @bacongobbler saying it appears that Helm3 takes an opinionated approach that it will not create namespace via
--namespaceoption. It also appears that Helm3 makes special accommodations for allowing chart authors to create "cluster scoped" resources, moreover, it prioritizes such operation precedence (crds are installed before the chart/template).Can I as Helm3 chart author allow a chart user to parameterize
namespaceartifact?For example, today w/ Helm3 I can place a
namespace.yamlintocrdsdirectory to work around to achieve almost the same behavior as in Helm2 "--namespace". The biggest caveat,crdsresources are not "templatized", thus such workaround will result in "constant" namespace value, which may be not acceptable.Parallel with CRD's is even more apparent in terms of installation precedence. Granted, as a chart author I can include various "cluster scoped" components inside my chart template. However, the "namespace" similar to "crds" have specific precedence constraints were it must be created prior to any chart resource that will target (use) that names instance. As a chart author, I can attempt to work around this by add ing
namespace.yamlto my template, as such:However, this creates 2 problems.
namespace.yaml, i.e. results inError: create: failed to create: namespaces "foo-bar" not foundError: rendered manifests contain a resource that already exists. Unable to continue with install: existing resource conflict: kind: Namespace, namespace: , name: foo-barinvidian commentedon Oct 23, 2019
Also, installing a release into namespace A, which chart creates namespace B is still possible with helm 3.
marckhouzam commentedon Oct 23, 2019
Sorry if this was discussed and answered before.
To reduce the impact of migrating to v3, couldn't helm v3 still try to create a non-existing namespace like before? It will fail if it doesn't have the right permissions, like kubectl, but will be backwards compatible when the permissions are sufficient.
For example, our cicd tool deploys our charts and has admin privileges. If v3 tried to create the namespace, my deployments would continue working as is. Currently though, I will need to go through all my different deployment scripts and add a
kubectl create namespacebefore every helm install.Starting from scratch I agree the current v3 behavior seems right, but considering the v2 behavior, maybe an in-between solution would be more justified for v3?
ichekrygin commentedon Oct 23, 2019
It is hard for me to find good justification behind this change beyond possibly following:
Unlike Helm2 "cluster centric", Helm3 is "namespace centric". I.E.,
helm listshows all charts across all namespaces irrespective of the currentkubeconfigcontexthelm listshows chart only for a specific namespace, and if/when the namespace is not provided then Helm3 defaults to the currentkubeconfigcontext.If the
--namespacefunctionality is preserved (as in Helm2), I can possibly see how this may lead to somewhat confusing user experience:may not show the installed chart if the current
kubeconfigcontext namespace is notfoo-barHowever, my $0.02 I think this is a bit "heavy-handed" approach (if this is the main/only rationale), and I would prefer to retain
--namespacefunctionality and use:bacongobbler commentedon Oct 23, 2019
Many of the reasons why this functionality was removed was listed in #5753, particularly in #5753 (comment).
By supporting the auto-creation of the namespace, community members were proposing new features to Helm which would allow them to modify the namespace during creation, including attaching annotations, labels, policies, constraints, quotas, etc. The list goes on. #3503 is one such example. The creation and management of the namespace is clearly out of scope of
helm install, whose goal was to fetch, unpack and install a chart into a cluster. Do one thing and do it well.The same scoping issue and design flaws were apparent in
helm init- users wanted to modify the Deployment and Service that Helm 2 would create server-side. Features like--node-selector,--net-hostand other ugly hacks were eventually kludged in to accommodate those requests. It turned out to be a massive design flaw and caused more trouble than it was worth, causing issues like #3414 which was easily handled through tooling that was designed for the workflow of creating and manipulating resources, likekubectl.The gist of the decision came down to scope. The namespace created during
helm installovergrew its original design scope. It turned out to be a poor design decision, so we removed it in favour of tooling that are designed around the creation and management of the namespace, e.g.kubectl createandkubectl edit(or a Helm plugin, hint hint).I have to disagree with you here, @marckhouzam. I see where you're coming from, but a poor design choice that was made in a previous version of Helm shouldn't mean that every major version of Helm should support it going forward. A major version of a piece of software is intended to make backwards-incompatible changes in order to move the project forward in a sustainable fashion. If we were supposed to retain behaviour from Helm 2, Tiller would still exist today.
That being said, we are open to suggestions and are always happy to discuss alternative solutions. This was a difficult design choice to make, and I discussed with the other core maintainers a few times why it was removed, so it wasn't done without consideration... or because we felt like breaking user's expectations for the fun of it. 😋
Side-note: can we please carry this discussion forward in #5753? This ticket is about the
--namespacenot being respected in earlier versions of Helm 3, which has since been fixed. This discussion has gone wayyyyyy off track from the OP's bug report. Thanks.ichekrygin commentedon Oct 24, 2019
@bacongobbler thank you for the background and context.
I think I understand where you're coming from: "getting the things wrong Helm2, and making them right in Helm3".
I am afraid I still cannot fully grok this, especially in light of Helm3
crdssupport (which on the surface looks very much Hem2Namespace-ish). I think I am in favor of deprecating namespace creation via--namespaceflag, as long as there is an alternative way to create and consumenamespacein the same Helm chart, i.e., w/out shelling out tokubectl, etc. I think it is a highly desirable trait for Helm to be a "one-stop-shop."On the surface, it does seem like a minor issue: "just run
kubectl create ns foo-barand be done with it". And this very well could be for the end-user environment since it is very likely that the user haskubectlinstalled locally. However, it has slightly different implications for CICD/Pipeline environments, where one cannot make such an assertion. Instead, now, with Helm3, one needs to make additional accommodations to installkubectl. This issue only gets worse when working with multi-cluster/multi-namespace environments. It is precisely for that reason having Helm as a "one-stop-shop" is so important.#5753 (comment)
While I understand the rationale, I cannot fully agree with it.
One can place both a
namespacedefinition and adeploymentdefinition targetting saidnamespaceinto a singlefile.yamland runkubectl apply -f file.yaml, which will yield the expected result. From what I gather, there is no way to do so in Helm3.AndiDog commentedon Oct 24, 2019
Not really an issue. Imagine you're using Argo CD to declaratively define what's to be installed in cluster(s). In the
applications.argoproj.io:Applicationobject (which defines a Git repo with your Helm chart to install), you can specify the target namespace, and create that requirement right next to that object. Typically, you would define 1 "index application" per cluster which lists all the applications to install. That index application can be deployed manually at cluster creation, through Terraform or even by Argo CD itself (if you're adventurous).Example for how an index application with 2 sub-applications could look lke:
This will ensure the namespace is created before the CD tool tries to install stuff into it – no matter if it's via Helm, kubectl, kustomize or other tooling. Therefore, Helm should not be special.
ichekrygin commentedon Oct 24, 2019
@AndiDog good example, however, I think slightly off point
No, I am not. But more importantly.
The entire point fo my "concern" is NOT to use anything else other than "Helm", i.e. - this is what I refer to as to "one-stop-shop". Granted, there are a number of workarounds, but those are just that the "workarounds", the things I rather not have, especially in light of the existing behavior of
Helm2.invidian commentedon Oct 24, 2019
@ichekrygin you can create umbrella chart yourself, which will create all namespaces you need before you install other other charts. Also, you can store all releases in single namespace, but via templates deploy them into other namespaces.
bacongobbler commentedon Oct 24, 2019
#5628 (comment)
As noted earlier, this discussion is getting off topic from the OP's original issue, so to be respectful of other's time I'm locking this thread as OP's issue has long since been resolved. Please carry the discussion forward in #5753. Thanks.