kubestellar / kubeflex

A flexible and scalable platform for running Kubernetes control plane APIs.
Apache License 2.0
46 stars 13 forks source link

bug: Unable to `kflex ctx` to control plane of type "host" #260

Closed eaepstein closed 3 months ago

eaepstein commented 3 months ago

Describe the bug

After using the core helm chart to deploy a kubestellar core control plane with its1 configured as type=host, there is no way to access an its1 context or create an its1 context with kflex.

Steps To Reproduce

  1. on a VM or bare metal machine, install k3s

    sudo curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="--disable traefik,servicelb"  sh -
    export KUBECONFIG=~/.kube/config
    sudo kubectl --kubeconfig=/etc/rancher/k3s/k3s.yaml config view --raw > "$KUBECONFIG"
  2. install ingress nginx

    helm upgrade --install ingress-nginx ingress-nginx --repo https://kubernetes.github.io/ingress-nginx --namespace ingress-nginx --create-namespace \
       --set controller.updateStrategy.type=RollingUpdate --set controller.updateStrategy.rollingUpdate.maxUnavailable=1 --set controller.service.type=NodePort \
       --set controller.publishService.enabled=false --set controller.hostPort.enabled=true --set controller.hostPort.ports.https=9443 \
       --set controller.extraArgs.enable-ssl-passthrough=true
  3. Install core chart with wds1 and its1 of type=host helm upgrade --install ks-hub oci://ghcr.io/francostellari/kubestellar/hub-chart --version 0.1.2 --set-json='ITSes=[{"name":"its1","type":"host"}]' --set-json='WDSes=[{"name":"wds1"}]'

  4. Try to create contexts for wds1 and its1 for cpname inkubectl get controlplane -o name; do cpname=${cpname##*/}; echo "Getting the kubeconfig of Control Planes \"$cpname\"..."; kflex ctx $cpname; done

Expected Behavior

I would expect that given a valid control plane ($cpname) the command kflex ctx $cpname would create the kubectl context if necessary.

Additional Context

No response

pdettori commented 3 months ago

I was able to replicate. It looks like the issue happens for its1 and not for wds1:

$ kflex ctx wds1
kubeconfig context context wds1 not found not found, trying to load from server...
✔ Switching to context wds1...
$ echo $?
0
$ kflex ctx its1
kubeconfig context context its1 not found not found, trying to load from server...
◐ Switching to context its1...Error switching kubeconfig context after loading from server: context its1 not found
$ echo $?
1

So, yes, the issue is for control planes of type host.