What to do with the cluster before joining it to a federation v2?

4/20/2019

I'm using federation v2. I installed a federation control plane and join the host cluster into the federation. When I joined the second cluster with below code

kubefed2 join federated01 --cluster-context federated01 --host-cluster-context xxxx --add-to-registry --v=2

I got

I0420 22:05:19.420250   24789 join.go:184] Failed to get joining cluster config: context "federated01" does not exist
F0420 22:05:19.420269   24789 join.go:133] Error: context "federated01" does not exist

How to add joining cluster config? Can anyone help me?

-- Xiang Li
federation
kubernetes

1 Answer

5/14/2019

I assume that you have to provide cluster, context and authentication details to federation control plane in order to join new member:

Furthermore, federation control plane requires credentials of the joined clusters to operate on them. These credentials are obtained from the local kubeconfig. kubefed join uses the cluster name specified as the argument to look for the cluster’s context in the local kubeconfig. If it fails to find a matching context, it exits with an error.

You might be able to check kubeconfig on the cluster you are willing to join with a command:

kubectl config view.

Next, you can manually inject sufficient cluster information into the host cluster kubeconfig:

kubectl config set-cluster

kubectl config set-context

kubectl config set-credentials

Find more information about multi cluster access in the related official documentation.

-- mk_sta
Source: StackOverflow