Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

karmada kubeconfig server #6048

Open
sashalarsoo opened this issue Jan 14, 2025 · 6 comments
Open

karmada kubeconfig server #6048

sashalarsoo opened this issue Jan 14, 2025 · 6 comments
Labels
kind/question Indicates an issue that is a support question.

Comments

@sashalarsoo
Copy link

Hey i deployed karmada in kubernetes using the helm chart with nodeport service.
I'd like as a kubeconfig output the ip of the service not the DNS in the server field.
image
How can i do that automatically ?
Thanks

@sashalarsoo sashalarsoo added the kind/question Indicates an issue that is a support question. label Jan 14, 2025
@sashalarsoo
Copy link
Author

By the way when i get the kubeconfig from the cluster and do a cluster info i got :
image

@sashalarsoo
Copy link
Author

image

@chaosi-zju
Copy link
Member

someone finally shares my concerns, I used to created a similar issue: #4013

For now, you can handle it this way: #4013 (comment)

I also look forward to hearing your solution as well

@sashalarsoo
Copy link
Author

is this it for this DNS problem i have got "server misbehaving" ?

@sashalarsoo
Copy link
Author

If i want to automate this stage, should i run the karmada join in the cluster. Or should i install karmada using cli ?

@chaosi-zju
Copy link
Member

chaosi-zju commented Jan 15, 2025

If i want to automate this stage, should i run the karmada join in the cluster. Or should i install karmada using cli ?

I'm also curious about how others successfully install karmada by helm chart. In my case, I do it automaticly by:

# 1. this script try to deploy karmada-apiserver by host-network
# so, it needs to get host-network ip (node ip) from kube-apiserver, and then add this ip to values.yaml as SANs of certificate
export KUBECONFIG=${KARMADA_HOST_KUBECONFIG}
HOST_IP=$(kubectl get ep kubernetes -o jsonpath='{.subsets[0].addresses[0].ip}')
sed -i'' -e "/localhost/{n;s/      \"127.0.0.1/      \"${HOST_IP}\",\n&/g}" ${CHARTDIR}/values.yaml

# 2. install karmada at karmada-host cluster by helm
# pay attention to apiServer.hostNetwork=true
helm install karmada -n karmada-system \
  --kubeconfig "${KARMADA_HOST_KUBECONFIG}" \
  --create-namespace \
  --dependency-update \
  --set apiServer.hostNetwork=true,components={"metricsAdapter,search,descheduler"} \
  ${CHARTDIR}

# 3.verify: wait for karmada control plane ready
while [[ $(kubectl get po -A | grep -c karmada-system ) -ne $(kubectl get po -n karmada-system | grep -c Running) ]]; do
  echo "waiting for karmada control plane ready..."; sleep 5;
done
kubectl get po -n karmada-system -o wide

# 4. export kubeconfig of karmada-apiserver to local path and change service name to apiserver ip.
KARMADA_APISERVER_KUBECONFIG="${HOME}/.kube/karmada-apiserver.config"
kubectl get secret -n karmada-system karmada-kubeconfig -o jsonpath={.data.kubeconfig} | base64 -d > "${KARMADA_APISERVER_KUBECONFIG}"
KARMADA_APISERVER_ADDR=$(kubectl get ep karmada-apiserver -n karmada-system | tail -n 1 | awk '{print $2}')
sed -i'' -e "s/karmada-apiserver.karmada-system.svc.*:5443/${KARMADA_APISERVER_ADDR}/g" "${KARMADA_APISERVER_KUBECONFIG}"

the variable KARMADA_HOST_KUBECONFIG and CHARTDIR should set according to you own environment.

Of course, if you choose install karmada by cli or operator, you won't have this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/question Indicates an issue that is a support question.
Projects
None yet
Development

No branches or pull requests

2 participants