Deploy into terraform managed Azure aks cluster using gilab CI/CD

I’m have a terraform project in gitlab that I use to manage an Azure aks(Azure k8s service) resource. Then I want my application which is another project in gitlab to deploy into infrastrucure configured by the terraform project.

I’m not sure how to use the use the kubernates cluster created by terraform project in the CI/CD of the application project. First I thought of output the kubeconfig to a variable and use it in the CI/CD of application using some sharing mechanism. But while I’m doing research I saw this(GitOps with GitLab: Connect with a Kubernetes cluster | GitLab) article by Victor Nagy about using agentk. Still I’m finding the set up bit confusing.

  • Is this the best way to achieve my purpose?
  • If so does the Kubernetes Agent Terraform module support Azure aks ? ( In example code it seems like it only works with un managed kubernates cluster )

I’m not a devops or very experienced in handling infrastructure but I was curious on using terraform with gitlab and start experimenting so please excuse me if my question is ambigious.

1 Like