title: How to Integrate GitLab-Ci w/ Azure Kubernetes + Kubectl + ACR for Deployments?
body: <blockquote>
    <p>Our previous GitLab based CI/CD utilized an Authenticated curl request to a specific REST API endpoint to trigger the redeployment of an updated container to our service, if you use something similar for your Kubernetes based deployment this Question is for you.</p>
  </blockquote>
  
  <h2>More Background</h2>
  
  <p>We run a production site / app (Ghost blog based) on an Azure AKS Cluster.  Right now we manually push our updated containers to a private ACR (Azure Container Registry) and then update from the command line with Kubectl.</p>
  
  <p>That being said we previously used Docker Cloud for our orchestration and fully integrated re-deploying our production / staging services using GitLab-Ci.</p>
  
  <p>That GitLab-Ci integration is the goal, and the 'Why' behind this question.</p>
  
  <h1>My Question</h1>
  
  <p>Since we previously used Docker Cloud (doh, should have gone K8s from the start) how should we handle the fact that GitLab-Ci was able to make use of Secrets created the Docker Cloud CLI and then authenticate with the Docker Cloud API to trigger actions on our Nodes (ie. re-deploy with new containers etc).</p>
  
  <p>While I believe we can build a container (to be used by our GitLab-Ci runner) that contains Kubectl, and the Azure CLI, I know that Kubernetes also has a similar (to docker cloud) Rest API that can be found here (<a href="https://kubernetes.io/docs/tasks/access-application-cluster/access-cluster" rel="noreferrer">https://kubernetes.io/docs/tasks/access-application-cluster/access-cluster</a>) — specifically the section that talks about connecting WITHOUT Kubectl appears to be relevant (as does the piece about the HTTP REST API).</p>
  
  <p>My Question to anyone who is connecting to an Azure (or potentially other managed Kubernetes service):</p>
  
  <blockquote>
    <p>How does your Ci/CD server authenticate with your Kubernetes service provider's Management Server, and then how do you currently trigger an update / redeployment of an updated container / service?</p>
  </blockquote>
  
  <p>If you have used the Kubernetes HTTP Rest API to re-deploy a service your thoughts are particularly value-able!</p>
  
  <h1>Kubernetes Resources I am Reviewing</h1>
  
  <ol>
  <li><a href="https://stackoverflow.com/questions/37426096/how-should-i-manage-deployments-with-kubernetes?rq=1">How should I manage deployments with kubernetes</a></li>
  <li><a href="https://stackoverflow.com/questions/34773609/kubernetes-deployments">Kubernetes Deployments</a></li>
  </ol>
  
  <p>Will update as I work through the process.</p>