traefik-helm-chart
traefik-helm-chart copied to clipboard
Defining namespace in the command "helm template" doesn't add namespace to metadata
Defining namespace in the command in helm template doesn't add namespace metadata in the generated files. I'm using helm version 3.2.4.
Here's the commands I ran:
helm fetch traefik/traefik --version 9.1.0
helm template traefik-9.1.0.tgz --output-dir . -f ~/kubernetes-charts/traefik.yml --name-template traefik --namespace traefik --include-crds
Here's a snippet of the deployment.yaml and no namespace is added to the metadata of the generated file:
---
# Source: traefik/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: traefik
labels:
app.kubernetes.io/name: traefik
helm.sh/chart: traefik-9.1.0
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/instance: traefik
annotations:
spec:
helm template does not add namespaces. v3 never has.
But then shouldn't the Service and Deployment be templated for the namespace, like other resources are?
Is the expectation then to just always install traefik to the default namespace?
I am facing a similar issue. I'm quite sure this is on my side but I can't get my head around it. I deployed the chart with helm specifying the namespace (--namespace). Everything gets deployed correctly into this namespaces, except the service. The service is deployed into the default namespace. Did anyone else face a similar issue and figured out why?
I am facing a similar issue. I'm quite sure this is on my side but I can't get my head around it. I deployed the chart with helm specifying the namespace (--namespace). Everything gets deployed correctly into this namespaces, except the service. The service is deployed into the default namespace. Did anyone else face a similar issue and figured out why?
This is not a chart issue as the chart does not specify a namespace (as it shouldn't), but in the spirit of helpfulness: If you are using CLI, the safest way to install a helm chart is not to use --namespace but to change current namespace to the desired namespace in question and then helm install. Many automation systems do most of this work for you, but manually this is a battle-tested assurance. (kubectl config set-context --current --namespace=<yournamespacehere).
With current version of Helm and this Chart, all objects are deployed in the target namespace, Service included.