<p>I have setup k8s cluster using kismatic and created CI/CD pipeline in gitlab. K8s cluster is in aws ec2 single instance. So how to connect gitlab with k8s cluster + helm to deploy the images. </p>

<p>All newer versions of k8 have rbac enabled so the token runner will ultimately be using will have to be clusterbinding or you won't be able to deploy outside of the namespace of the token</p>

<p>1) If you use a runner with persistent state such as an ec2 instance then you can just copy over your working kubeconfig found in ~/.kube/config</p>

<p>2) You can deploy a runner into kubernetes. This is very simple, they have a helm chart for a runner. You'll need to clusterbind the service account the runner is deployed to, chart doesn't do it for you</p>

<p>3) If you're using their runners you can base64 kubeconfig into a CI variable and create the file as a before script</p>

<p>4) Integrate kubernetes the gitlab way (it's on the UI) then gitlab will inject a kubeconfig into jobs that have an environment section. This is what I'm doing, integration is a bit rough but if you would like to have feature branch sandbox deployments there's a way to have a stage to teardown after merge so it's quite nice however I'd skip their add-on buttons such as helm and ingress and do that myself instead as you don't get to tweak any options</p>

<p>Other than option 1; you then use a helm or kubectl image for your deploy jobs</p>
