Skip to content

[Feature] Implement templating of the tenant clusters kubeconfig files #1604

Open

Description

@kinseii

The admin-kubeconfig file now looks like this:

apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: XXXYYYZZZ1
    server: https://kubernetes-qwerty-xxx-xxx-xxx-3.qwerty.com:443
  name: kubernetes-qwerty-xxx-xxx-xxx-3
contexts:
- context:
    cluster: kubernetes-qwerty-xxx-xxx-xxx-3
    user: kubernetes-admin
  name: kubernetes-admin@kubernetes-qwerty-xxx-xxx-xxx-3
current-context: kubernetes-admin@kubernetes-qwerty-xxx-xxx-xxx-3
kind: Config
preferences: {}
users:
- name: kubernetes-admin
  user:
    client-certificate-data: XXXYYYZZZ2
    client-key-data: XXXYYYZZZ3

The main problem is that if you have several clusters and want to combine them into one kubeconfig or write them all to the shell environment variable: KUBECONFIG, then because kubectl matches the context not by the context itself, but by the user, kubectl will not be able to find the right cluster and will return a certificate error. This means that each user must be unique. Currently, I have to manually add any suffix to the user name like that: kubernetes-admin@qwerty-xxx-xxx-xxx-3, and then kubectl successfully connects to the desired cluster.

The second problem is that the context name contains the “@” symbol: name: kubernetes-admin@kubernetes-qwerty-xxx-xxx-xxx-3. Some tools, such as juju, return an error for such contexts.

So, it would be better to add a prefix to the user, as is done with the context, but remove this prefix from the context itself. In addition, I would prefer to remove the kubernetes prefix, as it lengthens the name and is completely useless in terms of naming.
For example, admin-config could look like this:

apiVersion: v1
kind: Config
clusters:
- cluster:
    certificate-authority-data: XXXYYYZZZ1
    server: https://kubernetes-qwerty-xxx-xxx-xxx-3.qwerty.com:443
  name: qwerty-xxx-xxx-xxx-3
contexts:
- context:
    cluster: qwerty-xxx-xxx-xxx-3
    user: kubernetes-admin@qwerty-xxx-xxx-xxx-3
  name: qwerty-xxx-xxx-xxx-3
current-context: qwerty-xxx-xxx-xxx-3
users:
- name: kubernetes-admin@qwerty-xxx-xxx-xxx-3
  user:
    client-certificate-data: XXXYYYZZZ2
    client-key-data: XXXYYYZZZ3
preferences: {}

I also think that many users are already accustomed to the current naming of kubeconfig generation in the CozyStack, so perhaps it would be better to implement a templating settings.

Activity

  1. changed the title [-][Feature] Required templating of the kubfeconfig file[/-] [+][Feature] Implement templating of the tenant clusters kubfeconfig files[/+] on Nov 6, 2025
  2. changed the title [-][Feature] Implement templating of the tenant clusters kubfeconfig files[/-] [+][Feature] Implement templating of the tenant clusters `kubeconfig` files[/+] on Nov 6, 2025
  3. added
    kind/featureCategorizes issue or PR as related to a new feature
    on Nov 6, 2025
  4. dosubot commented on Feb 18, 2026

    @dosubot

    Hi, Petr Dondukov (@kinseii). I'm Dosu, and I'm helping the cozystack team manage their backlog and am marking this issue as stale.

    Issue Summary:

    • You proposed improving tenant cluster kubeconfig templating to avoid certificate errors by ensuring unique user names, such as adding prefixes to users but not to context names.
    • You also suggested removing the "kubernetes" prefix from names to shorten them and prevent issues with tools like juju that have trouble with "@" symbols in context names.
    • There has been no further activity or comments on this issue since your initial proposal.
    • The issue remains unresolved and open for discussion.

    Next Steps:

    • Please let me know if this issue is still relevant to the latest version of the cozystack repository by commenting here to keep the discussion open.
    • If I do not hear back within 7 days, I will automatically close this issue.

    Thank you for your understanding and contribution!

  5. added
    lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale
    on Feb 18, 2026
  6. kinseii commented on Feb 18, 2026

    @kinseii
    Author

    bump

  7. removed
    lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale
    on Feb 18, 2026
  8. dosubot commented on Feb 18, 2026

    @dosubot

    Timofei Larkin (@lllamnyp) The user has indicated this issue is still relevant and needs attention regarding tenant cluster kubeconfig templating and context name improvements. Could you please assist?

  9. github-actions commented on May 2, 2026

    @github-actions

    This issue has had no activity for 60 days and was marked lifecycle/stale.
    It will be closed in 14 days unless commented or labelled lifecycle/frozen.

  10. added
    lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale
    on May 2, 2026
  11. dosubot commented on Aug 1, 2026

    @dosubot

    Hi, Petr Dondukov (@kinseii). I'm Dosu, and I'm helping the cozystack team manage their backlog and am marking this issue as stale.

    Issue Summary

    • You requested templating tenant cluster kubeconfig files so each cluster gets a unique user name, avoiding kubectl certificate conflicts when multiple kubeconfigs are merged or used via KUBECONFIG.
    • You also asked to remove @ from context names for better compatibility with tools like juju.
    • A related cleanup request was to shorten names by dropping the kubernetes prefix.
    • The issue has already been marked stale before, and there has not been a resolution or recent follow-up confirming the change is still needed.

    Next Steps

    • Please let us know if this is still relevant on the latest version of the cozystack repository.
    • If it is still needed, you can keep the discussion open by commenting here; otherwise, this issue will be automatically closed in 7 days.

    Thanks for your understanding and contribution.

  12. added
    area/kubernetesIssues or PRs related to the tenant Kubernetes app
    area/kamajiIssues or PRs related to Kamaji (hosted control planes for tenant Kubernetes)
    triage/acceptedIndicates an issue is ready to be actively worked on
    priority/backlogGeneral backlog priority. Lower than priority/important-longterm
    lifecycle/frozenIndicates that an issue or PR should not be auto-closed due to staleness
    and removed
    lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale
    triage/needs-triageIndicates an issue needs triage by a maintainer
    on Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/kamajiIssues or PRs related to Kamaji (hosted control planes for tenant Kubernetes)area/kubernetesIssues or PRs related to the tenant Kubernetes appkind/featureCategorizes issue or PR as related to a new featurelifecycle/frozenIndicates that an issue or PR should not be auto-closed due to stalenesspriority/backlogGeneral backlog priority. Lower than priority/important-longtermtriage/acceptedIndicates an issue is ready to be actively worked on

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions