<p>I would like to setup the AutoDevops functionality of Gitlab CI/CD, and for that  I am trying to setup the existing kubernetes cluster as my environment. </p>

<p>However, the Gitlab requires Kubernetes Master API URL that uses to access the Kubernetes API. Kubernetes
exposes several APIs, we want the "base" URL that is common to all of them,
e.g., <a href="https://kubernetes.example.com" rel="nofollow noreferrer">https://kubernetes.example.com</a> rather than <a href="https://kubernetes.example.com/api/v1" rel="nofollow noreferrer">https://kubernetes.example.com/api/v1</a>.
we will get the API URL by running this command:</p>

<p><code>kubectl cluster-info | grep 'Kubernetes master' | awk '/http/ {print $NF}</code></p>

<p>which returns a https://</p>

<p>in my case, I have a private Ip which is <a href="https://172.10.1.x" rel="nofollow noreferrer">https://172.10.1.x</a></p>

<p>There aren't any documentations to help setup the gitlab CI for a Private GKE cluster.</p>

<p>How can I set the gitlab to access my kubernetes master with the help of a running VM instance or a pod's service IP ? or if there are any solutions/workarounds suggestions to achieve this, please help.</p>

<p><a href="https://gitlab.com/help/user/project/clusters/add_remove_clusters.md#add-existing-cluster" rel="nofollow noreferrer">Add Existing GKE cluster as Environment</a></p>

<p>There is now (Sept. 2020) an alternative, but it was not free (GitLab.com Premium/Ultimate only), is free in part in 14.5+ (Nov. 2021). Then fully with 15.3 (Aug. 2022)</p>
<p>See <a href="https://about.gitlab.com/releases/2020/09/22/gitlab-13-4-released/#introducing-the-gitlab-kubernetes-agent" rel="nofollow noreferrer">GitLab 13.4</a></p>
<blockquote>
<h2>Introducing the GitLab Kubernetes Agent</h2>
<p>GitLab’s Kubernetes integration has long enabled deployment to Kubernetes clusters without manual setup. Many users have enjoyed the ease-of-use, while others have run into some challenges.</p>
<p>The current integration requires your cluster to be open to the Internet for GitLab to access it. For many organizations, this isn’t possible, because they must lock down their cluster access for security, compliance, or regulatory purposes. To work around these restrictions, users needed to create custom tooling on top of GitLab, or they couldn’t use the feature.</p>
<p>Today, we’re announcing the GitLab Kubernetes Agent: a new way to deploy to Kubernetes clusters. The Agent runs inside of your cluster, so you don’t need to open it to the internet. The Agent orchestrates deployments by pulling new changes from GitLab, rather than GitLab pushing updates to the cluster. No matter what method of GitOps you use, GitLab has you covered.</p>
<p>Note this is the first release of the Agent. Currently, the GitLab Kubernetes Agent has a configuration-driven setup, and enables deployment management by code. Some existing Kubernetes integration features, such as Deploy Boards and GitLab Managed Apps, are not yet supported. <a href="https://about.gitlab.com/direction/configure/kubernetes_management/" rel="nofollow noreferrer">Our vision</a> is to eventually implement these capabilities, and provide new security- and compliance-focused integrations with the Agent.</p>
<p><a href="https://about.gitlab.com/images/13_4/gitops-header.png" rel="nofollow noreferrer">https://about.gitlab.com/images/13_4/gitops-header.png</a> -- Introducing the GitLab Kubernetes Agent</p>
<p>See <a href="https://docs.gitlab.com/ee/user/clusters/agent" rel="nofollow noreferrer">Documentation</a> and <a href="https://gitlab.com/gitlab-org/gitlab/-/issues/223061" rel="nofollow noreferrer">Issue</a>.</p>
</blockquote>
<hr />
<p>See also <a href="https://about.gitlab.com/releases/2020/10/22/gitlab-13-5-released/#install-the-gitlab-kubernetes-agent-with-omnibus-gitlab" rel="nofollow noreferrer">GitLab 13.5</a> (October 2020)</p>
<blockquote>
<h2>Install the GitLab Kubernetes Agent with Omnibus GitLab</h2>
<p>Last month we introduced the <a href="/releases/2020/09/22/gitlab-13-4-released/#introducing-the-gitlab-kubernetes-agent">GitLab Kubernetes Agent</a> for self-managed GitLab instances installed with Helm.</p>
<p>This release adds support for the <a href="https://about.gitlab.com/install/" rel="nofollow noreferrer">official Linux package</a>.</p>
<p>In this new Kubernetes integration, the Agent orchestrates deployments by pulling new changes from GitLab, rather than GitLab pushing updates to your cluster.</p>
<p>You can learn more about <a href="https://docs.gitlab.com/ee/user/clusters/agent/" rel="nofollow noreferrer">how the Kubernetes Agent works now</a> and <a href="/direction/configure/kubernetes_management/">check out our vision</a> to see what’s in store.</p>
<p>See <a href="https://docs.gitlab.com/ee/user/clusters/agent/" rel="nofollow noreferrer">Documentation</a> and <a href="https://gitlab.com/gitlab-org/gitlab/-/issues/223060" rel="nofollow noreferrer">Issue</a>.</p>
</blockquote>
<hr />
<p>This is confirmed with <a href="https://about.gitlab.com/releases/2021/04/22/gitlab-13-11-released/#gitlab-kubernetes-agent-available-on-gitlabcom" rel="nofollow noreferrer">GitLab 13.11</a> (April 2021):</p>
<blockquote>
<h2>GitLab Kubernetes Agent available on GitLab.com</h2>
<p>The GitLab Kubernetes Agent is finally available on GitLab.com. By using the Agent, you can benefit from fast, pull-based deployments to your cluster, while GitLab.com manages the necessary server-side components of the Agent.</p>
<p>The GitLab Kubernetes Agent is the core building block of GitLab’s Kubernetes integrations.<br />
The Agent-based integration today supports pull-based deployments and Network Security policy integration and alerts, and will soon receive support for push-based deployments too.</p>
<p>Unlike the legacy, certificate-based Kubernetes integration, the GitLab Kubernetes Agent does not require opening up your cluster towards GitLab and allows fine-tuned RBAC controls around GitLab’s capabilities within your clusters.</p>
</blockquote>
<p>See <a href="https://docs.gitlab.com/ee/user/clusters/agent/" rel="nofollow noreferrer">Documentation</a> and <a href="https://gitlab.com/gitlab-org/gitlab/-/issues/249596" rel="nofollow noreferrer">issue</a>.</p>
<hr />
<p>See <a href="https://about.gitlab.com/releases/2021/11/22/gitlab-14-5-released/#gitlab-kubernetes-agent-available-in-gitlab-free" rel="nofollow noreferrer">GitLab 14.5</a> (November 2021)</p>
<blockquote>
<h2>GitLab Kubernetes Agent available in GitLab Free</h2>
<p>Connecting a Kubernetes cluster with the GitLab Kubernetes Agent simplifies the setup for cluster applications and enables secure GitOps deployments to the cluster.</p>
<p>Initially, the GitLab Kubernetes Agent was available only for Premium users.</p>
<p>In our commitment to the open source ethos, we moved the core features of the GitLab Kubernetes Agent and the CI/CD Tunnel to GitLab Free.<br />
We expect that the open-sourced features are compelling to many users without dedicated infrastructure teams and strong requirements around cluster management.<br />
Advanced features remain available as part of the GitLab Premium offering.</p>
<p>See <a href="https://docs.gitlab.com/ee/user/clusters/agent/" rel="nofollow noreferrer">Documentation</a> and <a href="https://gitlab.com/groups/gitlab-org/-/epics/6290" rel="nofollow noreferrer">Epic</a>.</p>
</blockquote>
<hr />
<p>See <a href="https://about.gitlab.com/releases/2022/02/22/gitlab-14-8-released/#the-agent-server-for-kubernetes-is-enabled-by-default" rel="nofollow noreferrer">GitLab 14.8</a> (February 2022)</p>
<blockquote>
<h2>The agent server for Kubernetes is enabled by default</h2>
<p>The first step for using the agent for Kubernetes in self-managed instances is to enable the agent server, a backend service for the agent for Kubernetes. In GitLab 14.7 and earlier, we required a GitLab administrator to enable the agent server manually. As the feature matured in the past months, we are making the agent server enabled by default to simplify setup for GitLab administrators. Besides being enabled by default, the agent server accepts various configuration options to customize it according to your needs.</p>
<p>See <a href="https://docs.gitlab.com/ee/administration/clusters/kas.html" rel="nofollow noreferrer">Documentation</a> and <a href="https://gitlab.com/gitlab-org/gitlab/-/issues/273372" rel="nofollow noreferrer">Issue</a>.</p>
</blockquote>
<hr />
<p>With <a href="https://about.gitlab.com/releases/2022/08/22/gitlab-15-3-released/#gitops-features-are-now-free" rel="nofollow noreferrer">GitLab 15.3</a> (August 2022):</p>
<blockquote>
<h2>GitOps features are now free</h2>
<p>When you use GitOps to update a Kubernetes cluster, also called a pull-based deployment, you get an improved security model, better scalability and stability.</p>
<p>The GitLab agent for Kubernetes has supported <a href="https://docs.gitlab.com/ee/user/clusters/agent/gitops.html" rel="nofollow noreferrer">GitOps workflows</a> from its initial release, but until now, the functionality was available only if you had a GitLab Premium or Ultimate subscription. Now if you have a Free subscription, you also get pull-based deployment support. The features available in GitLab Free should serve small, high-trust teams or be suitable to test the agent before upgrading to a higher tier.</p>
<p>In the future, we plan to add <a href="https://gitlab.com/gitlab-org/gitlab/-/issues/337904" rel="nofollow noreferrer">built-in multi-tenant support</a> for Premium subscriptions. This feature would be similar to the impersonation feature already available for the <a href="https://docs.gitlab.com/ee/user/clusters/agent/ci_cd_workflow.html#restrict-project-and-group-access-by-using-impersonation" rel="nofollow noreferrer">CI/CD workflow</a>.</p>
<p>See <a href="https://docs.gitlab.com/ee/user/clusters/agent/gitops.html" rel="nofollow noreferrer">Documentation</a> and <a href="https://gitlab.com/gitlab-org/gitlab/-/issues/346567" rel="nofollow noreferrer">Issue</a>.</p>
</blockquote>
<hr />
<p>See <a href="https://about.gitlab.com/releases/2022/09/22/gitlab-15-4-released/#deploy-helm-charts-with-the-agent-for-kubernetes" rel="nofollow noreferrer">GitLab 15.4</a> (September 2022)</p>
<blockquote>
<h2>Deploy Helm charts with the agent for Kubernetes</h2>
<p>You can now <a href="https://docs.gitlab.com/ee/user/clusters/agent/gitops/helm.html" rel="nofollow noreferrer">use the agent for Kubernetes to deploy
Helm charts to your Kubernetes cluster</a>.</p>
<p>Until now, the agent for Kubernetes only supported vanilla Kubernetes manifest files in its GitOps workflow.<br />
To benefit from the GitOps workflow, Helm users had to use a CI/CD job to render and commit resources.</p>
<p>The current release ships with Alpha support for Helm.<br />
Because Helm is a mature product, we consider the solution performant. However, <a href="https://docs.gitlab.com/ee/user/clusters/agent/gitops/helm.html#known-issues" rel="nofollow noreferrer">known issues</a> exist and the API might change without prior notice. We welcome your feedback in <a href="https://gitlab.com/groups/gitlab-org/-/epics/7938" rel="nofollow noreferrer">the
related epic</a>, where we discuss future improvements and next steps.</p>
<p>See <a href="https://docs.gitlab.com/ee/user/clusters/agent/gitops/helm.html" rel="nofollow noreferrer">Documentation</a> and <a href="https://gitlab.com/gitlab-org/gitlab/-/issues/371019" rel="nofollow noreferrer">Issue</a>.</p>
</blockquote>
