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

Kind cluster inside gitlab seems unreachable #630

Closed
TheErk opened this issue Jun 19, 2019 · 7 comments
Closed

Kind cluster inside gitlab seems unreachable #630

TheErk opened this issue Jun 19, 2019 · 7 comments
Labels
kind/support Categorizes issue or PR as a support question.

Comments

@TheErk
Copy link

TheErk commented Jun 19, 2019

What happened:

Use kind inside a gitlab CI runner.
The cluster is created fine but I cannot use it after creation

kubectl cluster-info

spit out

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
The connection to the server localhost:40819 was refused - did you specify the right host or port?

What you expected to happen:

Create an in-CI cluster and populate the k8s cluster as usual.

How to reproduce it (as minimally and precisely as possible):

Start a gitlab CI job with kind inside.
Create a kind cluster:

kind create cluster --config=kind-config.yaml --name kind39f9b9
Creating cluster "kind39f9b9" ...
 • Ensuring node image (kindest/node:v1.14.2) 🖼  ...
 ✓ Ensuring node image (kindest/node:v1.14.2) 🖼
 • Preparing nodes 📦📦  ...
 ✓ Preparing nodes 📦📦
 • Creating kubeadm config 📜  ...
 ✓ Creating kubeadm config 📜
 • Starting control-plane 🕹️  ...
 ✓ Starting control-plane 🕹️
 • Installing CNI 🔌  ...
 ✓ Installing CNI 🔌
 • Installing StorageClass 💾  ...
 ✓ Installing StorageClass 💾
 • Joining worker nodes 🚜  ...
 ✓ Joining worker nodes 🚜
Cluster creation complete. You can now use the cluster with:

export KUBECONFIG="$(kind get kubeconfig-path --name="kind39f9b9")"
kubectl cluster-info

Then try

kubectl cluster-info

and you'll get

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
The connection to the server localhost:40819 was refused - did you specify the right host or port?

Anything else we need to know?:

This behavior really looks like the one described in #52 but I don't know how to properly apply the VOLUME trick. At least I tried with no success.

Environment:

  • kind version: v0.3.0
  • Kubernetes version: v1.14.3
  • Docker version: 18.09.6
  • OS : Debian Jessie
@TheErk TheErk added the kind/bug Categorizes issue or PR as related to a bug. label Jun 19, 2019
@BenTheElder
Copy link
Member

What gitlab CI runner?

This is almost definitely because the cluster binds to localhost by default (for security reasons) and the localhost is somewhere other than where your kubectl binary is running.

The solution to this is to either change your setup so that this is not true, or to configure the kind apiServerListenAddress in the config

@BenTheElder BenTheElder added kind/support Categorizes issue or PR as a support question. and removed kind/bug Categorizes issue or PR as related to a bug. labels Jun 19, 2019
@TheErk
Copy link
Author

TheErk commented Jun 20, 2019

Currently we use: gitlab/gitlab-runner:alpine-v10.7.0.
I think I see, let's suppose I find the context in which kubectl is running.
Where can I find documentation on how to specify apiServerListenAddress in my yaml config for kind?

@aojea
Copy link
Contributor

aojea commented Jun 20, 2019

just Ben replied in slack to this 😄

apiVersion: kind.sigs.k8s.io/v1alpha3
networking:
   apiServerAddress: 0.0.0.0

to obtain the kubeconfig using the internal ip address , to use per example from other internal containers, we just merged a new command
#478

@TheErk
Copy link
Author

TheErk commented Jun 20, 2019

Thanks @aojea I've just joined k8s slack, I'll try to find my way in all those channels.
Nice for #478 how can I monitor the next kind release that will ship this?

@BenTheElder
Copy link
Member

we are currently tracking release efforts with github milestones. the next release is tentatively slated to be by the 24th but we have a little flexibility. In particular still aiming to land the initial ipv6 support.

https://github.com/kubernetes-sigs/kind/milestone/6

@TheErk
Copy link
Author

TheErk commented Aug 6, 2019

I did update my config with:

  • kind version: v0.4.0
  • Kubernetes version: v1.15.0

and follow: https://github.com/kind-ci/examples/blob/master/.gitlab-ci.yml
I still have issue as explained here:
#620 (comment)

I'll come back here when I find my solution. Since this may be very gitlab configuration specific, feel free to close this ticket and I'll propose some explanation/solution (when I find them) in https://github.com/kind-ci/examples/

@BenTheElder
Copy link
Member

SGTM, it would be very helpful to document there and post a link back to here then.

I'm hoping to direct more of the CI specific config etc. there, we're starting to link out to it in https://kind.sigs.k8s.io/docs/user/resources/#using-kind-in-ci

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

No branches or pull requests

3 participants