Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: INSTALLATION FAILED: namespaces "k8tz" already exists #5

Closed
si458 opened this issue Oct 23, 2021 · 3 comments
Closed

Error: INSTALLATION FAILED: namespaces "k8tz" already exists #5

si458 opened this issue Oct 23, 2021 · 3 comments
Assignees
Labels
good first issue Good for newcomers

Comments

@si458
Copy link

si458 commented Oct 23, 2021

when you try to install it by setting the same namespace in the command and --create-namespace
it generates an error because the helm chart is also trying to create the namespace for it

Simon@SiMacBookPro calico % helm install k8tz k8tz/k8tz -n k8tz --create-namespace --set timezone=Europe/London 
Error: INSTALLATION FAILED: namespaces "k8tz" already exists

you should allow the user to specify which namespace it should run in and not create the namespace

EDIT: the idea with helm is it will automatically install the helm chart into the namespace you are using (defaults as default)
but when you look at your resources, the helm chart is in default, but the software is running on k8tz?

@si458 si458 mentioned this issue Oct 23, 2021
@yonatankahana
Copy link
Member

Hi @si458, I am very happy to see your contribution!
But actually, this is not a mistake, there is a reason behind this decision and I'll be happy to explain it to you.

The helm chart is creating a webhook (MutatingWebhookConfiguration) that is being called on every Pod creation event. If for some reason, the service is not available (and unless the failPolicy is explicitly Ignore), all pod creation requests will fail with an error.
The problem is that at the same time, the helm chart is creating the admission server Deployment, and the deployment must be able to create its Pods. But it will not be able to do that and the cluster will be stuck without being able to create any pods at all - Deadlocked.
To solve that, we must create a special namespace for the admission server and have this namespace filtered using namespaceSelector. You can read about it here: https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#avoiding-deadlocks-in-self-hosted-webhooks.

Because we MUST create our own namespace, we have to ignore the helm's namespace and create the required namespace. We do support changing the namespace name using .Values.namespace, for example:

helm install k8tz k8tz/k8tz \
    --set timezone=Europe/London \
    --set namespace=othername

You can see another example of the same solution implemented in linkerd2.
Unfortunately, it conflicts with helm's --create-namespace flag and the helm chart may be installed in a different namespace than the chart objects.
If there is a better solution, I will be happy to hear but I don’t think another solution is required...

@si458
Copy link
Author

si458 commented Oct 24, 2021

Ok no worries
Maybe you could edit the read me and explain it this?

@yonatankahana
Copy link
Member

@si458 I might do some FAQ soon and add it there.
Anyway, does it limit you in any way? or does just not using --create-namespace solve the issue for you?

@yonatankahana yonatankahana self-assigned this Oct 30, 2021
SISheogorath added a commit to SISheogorath/k8tz that referenced this issue Oct 12, 2023
This patch should resolve
k8tz#5 (comment) using the
existing ignore-namespace feature to resolve both. True, it's not
backwards compatible, and if required, we can achieve this, but it
should allow to use this helm chart, without requiring the chart to be
used to create the namespace.

BREAKING CHANGE: Drop in-chart namespace creation
SISheogorath added a commit to SISheogorath/k8tz that referenced this issue Oct 12, 2023
This patch should resolve
k8tz#5 (comment) using the
existing ignore-namespace feature to resolve both. True, it's not
backwards compatible, and if required, we can achieve this, but it
should allow to use this helm chart, without requiring the chart to be
used to create the namespace.

BREAKING CHANGE: Drop in-chart namespace creation
SISheogorath added a commit to SISheogorath/k8tz that referenced this issue Oct 12, 2023
This patch should resolve
k8tz#5 (comment) using the
existing ignore-namespace feature to resolve both. True, it's not
backwards compatible, and if required, we can achieve this, but it
should allow to use this helm chart, without requiring the chart to be
used to create the namespace.

BREAKING CHANGE: Drop in-chart namespace creation
SISheogorath added a commit to SISheogorath/k8tz that referenced this issue Oct 12, 2023
This patch should resolve
k8tz#5 (comment) using the
existing ignore-namespace feature to resolve both. True, it's not
backwards compatible, and if required, we can achieve this, but it
should allow to use this helm chart, without requiring the chart to be
used to create the namespace.

BREAKING CHANGE: Drop in-chart namespace creation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants