Skip to content

BUG: After SA token renewal the register cluster command overwrites the secret, addon-controller looking for re-kubeconfig key #1323

@mahauber

Description

@mahauber

Problem Description

  1. Register cluster initially via sveltosctl
# kubectl pointing to workload cluster
sveltosctl generate kubeconfig --create --expirationSeconds=86400 > ./sveltos-cluster.config

# kubectl pointing to management cluster
sveltosctl register cluster --namespace=$NAMESPACE --cluster=$CLUSTER_NAME --kubeconfig=./sveltos-cluster.config --labels key=value

kubectl patch sveltoscluster $CLUSTER_NAME -n $NAMESPACE --type='merge' --patch '{"spec":{"tokenRequestRenewalOption":{"renewTokenRequestInterval":"1h0m0s","saName":"projectsveltos", "saNamespace":"projectsveltos"}}}'`
  1. Wait for a token renewal of the service account -> will update kubeconfig secret with key re-kubeconfig
  2. Step 1 again (eg. to update labels) --> sveltosctl will update kubeconfig secret with key kubeconfig
  3. Addon controller cannot find the secret key re-kubeconfig (Failure: data section does not contain key: re-kubeconfig)

To solve: edit secret and rename the key kubeconfig to re-kubeconfig
Question: After initial registration should the labels be set via kubectl patch/label and sveltosctl register be avoided? Is there a better way to manage authentication with AKS clusters (workload identity etc.)?

System Information

INSTRUCTIONS: Provide the system and application information below.

CLUSTERAPI VERSION: not used
SVELTOS VERSION: v0.57.2
KUBERNETES VERSION: v1.33.2

Logs

INSTRUCTIONS: Provide any additional information you think would be helpful below. Large files, logs, etc. can be attached to this issue so long as they meet the GitHub attachment guidelines described here: https://help.github.com/en/github/managing-your-work-on-github/file-attachments-on-issues-and-pull-requests

# kubectl describe clustersummary xy --> status
Failure Message:       data section does not contain key: re-kubeconfig                                                                                                                        

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions