MusicDin / kubitect

Kubitect provides a simple way to set up a highly available Kubernetes cluster across multiple hosts.

Home Page:https://kubitect.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

duplicate cluster name

artarik opened this issue · comments

when i applied my config from previous issue via command

kubitect apply --config local_k8s.yaml --local 

i got a duplicated cluster name while i tried to get any commands e.g.

~: kubitect ls clusters
Clusters:
  - local-k8s (active)
  - local-k8s (active, local)

~: kubitect export config --cluster local-k8s
 Error: multiple clusters (2) have been found with the name 'local-k8s'

but in clusters dir i see one folder

~: ls -l .kubitect/clusters
итого 4
drwxr-xr-x 5 user user 4096 июн  1 22:19 local-k8s
~: kubitect --version
kubitect version v3.1.0

Hi @artarik,

based on the provided output, one of the clusters is located in the current directory.

Clusters:
  - local-k8s (active).       # ~/.kubitect/clusters/local-k8s
  - local-k8s (active, local) # ./.kubitect/clusters/local-k8s

With version 3.0.0 global clusters (those in ~/.kubitect directory) can no longer be created with local- prefix. This prefix is now reserved exclusively for clusters that are created using --local flag.

This means if the cluster named k8s is created using --local flag, the resulting name would be local-k8s. Note that local clusters are created in the current directory (./.kubitect/)

wow, thank you for explain this situation.
But i have the same error then trying to create cluster from preset example-multi-worker

~: kubitect ls clusters
Clusters:
  - k8s-cluster (active)
  - k8s-cluster (active, local)

~: kubitect export kubeconfig --cluster k8s-cluster
┌
│ Error: multiple clusters (2) have been found with the name 'k8s-cluster'
└

or, if i creating cluster via command kubitect apply --config example-config-multi-worker.yaml --local

~: kubitect ls clusters
Clusters:
  - local-k8s-cluster (active)
  - local-k8s-cluster (active, local)

Yes, I haven't realized till now that local and global paths conflict in the home directory.
Will fix that asap.

In the mean time, you can workaround this problem by changing into any directory that is not home (~) and it should work.

Thanks @artarik for opening this issue.

It has been fixed in v3.1.1.