2

I want to integrate Kubernetes cluster configured in on-premises environment with gitlab.

When adding a cluster, I clicked Add Existing Cluster and filled in all other spaces, and the API URL entered the IP output by the following command.

kubectl cluster-info | grep 'Kubernetes master' | awk '/http/ {print $NF}'
https://10.0.0.xxx:6443

However, it did not proceed with the error "platform kubernetes api url is blocked: requests to the local network are not allowed".

I saw an article in the admin area to do a webhook check, but I'm on the gitlab website, and no matter where I find it, I can't find the admin area. I'm guessing that it only comes with gitlab to install.

https://edenmal.moe/post/2019/GitLab-Kubernetes-Using-GitLab-CIs-Kubernetes-Cluster-feature/

When I saw and followed the example, I entered the API URL as "https: //kubernetes.default.svc.cluster.local: 443" and the cluster connection was established. But helm won't install.

So I tried to install helm on a Kubernetes cluster manually, but gitlab does not recognize helm.

What is the difference between the two API URLs above??

How can i solve it ??

윤태일
  • 537
  • 1
  • 9
  • 21
  • Are you trying to connect from the public gitlab.com service to your on prem cluster? – Matt Feb 19 '20 at 06:05
  • Yes, it is. Do you have a problem ?? – 윤태일 Feb 19 '20 at 06:07
  • You would need a publicly accessible IP that gitlab can access the cluster on (Maybe a NAT forward on a router or a firewall somewhere). The 10.0.0.x address is only for local/private access. – Matt Feb 19 '20 at 06:13
  • Are you saying that you need external exposure? services like nodeport ?? – 윤태일 Feb 19 '20 at 06:15

1 Answers1

1

As mentioned in comments, you are running your CI job on someone else's network. As such, it cannot talk to your private IPs in your own network. You will need to expose your kube-apiserver to the internet somehow. This is usually done using a LoadBalancer service called kubernetes that is created automatically. However that would only work if you have set up something that supports LoadBalancer services like MetalLB.

coderanger
  • 52,400
  • 4
  • 52
  • 75
  • If I download and use gitlab, is it possible to do CI work without exposing kube-apiserver externally? – 윤태일 Feb 19 '20 at 07:33
  • I want to install metallb to create an IP that exposes Kubernetes itself to the outside. Am I doing it right? – 윤태일 Feb 19 '20 at 08:38