Using Codefresh with GKE Autopilot for native Kubernetes pipelines and GitOps deployment
Tags: kubernetes, gke, gitops, argo
Published: 2021-12-06 18:16:39

<p>Several companies nowadays offer a cloud-native solution that manages Kubernetes applications and services. While these solutions seem easy at first glance, in reality, they still require manual maintenance.</p>
<p>As an example, an important decision for any Kubernetes cluster is the number of nodes and the autoscaling rules you define. You want to ensure that the size is just right and matches your workload, otherwise, this could become costly, unstable, and decrease the availability of your workload when you need it most!</p>
<h4>GKE Autopilot Cluster</h4>
<p>A solution to these problems is <a href="https://cloud.google.com/blog/products/containers-kubernetes/introducing-gke-autopilot">Google Kubernetes Engine (GKE) Autopilot</a> from Google Cloud. GKE's cluster autoscaler adjusts the node pools based on whatever the demand is for your workload. For example, if the workload is high or low GKE Autopilot will scale depending on which and provide control on costs.</p>
<a href="https://codefresh.io/wp-content/uploads/2021/12/Screen-Shot-2021-11-16-at-3.30.21-PM.png"><img src="https://codefresh.io/wp-content/uploads/2021/12/Screen-Shot-2021-11-16-at-3.30.21-PM.png" alt="" width="728" height="679" class="alignnone size-full wp-image-20705" /></a>
<p>This allows you and your teams to no longer worry about maintaining your node pools or provisioning them - with Autopilot clusters these jobs are automatically done. This streamlined approach follows best practices for a cluster and workload setup, in addition to other best practices about security and observability. Allowing you to specify configurations needed for deployment to production and simplifying operations needed to manage an application&rsquo;s infrastructure, nodes, and the control plane.&nbsp;</p>
<p>The Codefresh platform fully supports GKE Autopilot. By combining the two platforms you can easily:</p>
<ul>
<li>Run CI/CD pipelines on your cluster to compile source code, run unit tests, perform security checks, etc.</li>
<li>Deploy your containers to your cluster by following the <a href="https://codefresh.io/gitops/">GitOps principles</a>.</li>
</ul>
<h2>Deploying applications to your GKE Autopilot cluster following the GitOps principles</h2>
<h4>Codefresh GitOps Controller</h4>
<p>Like any Kubernetes cluster integrations or the GKE Standard cluster, the GKE Autopilot Cluster integrates the same way with the Codefresh GitOps dashboard. The GitOps dashboard allows you to look at all your deployments in greater detail and instantly know the critical information such as:</p>
<ul>
<li>What Git commit was deployed</li>
<li>Which cluster was affected</li>
<li>Who initiated the change</li>
<li>What features were shipped</li>
<li>Which pipelines took part in the deployment</li>
<li>What Kubernetes services were affected</li>
</ul>
<p><br />To achieve this level of GitOps visibility, a GKE autopilot cluster can be the target of the <a href="https://codefresh.io/docs/docs/integrations/argo-cd/">Codefresh GitOps Controller</a>, which is an agent installed in the cluster that monitors both the cluster and any defined Git repositories for changes. It installs an ArgoCD instance within the cluster and the associated GitOps Controller. This is done through the Codefresh CLI and can be authenticated with a Codefresh account, simply by creating an API token. This agent can also manage the runtime environment for a pipeline.</p>
<a href="https://codefresh.io/wp-content/uploads/2021/12/Screen-Shot-2021-11-17-at-7.01.44-PM.png"><img src="https://codefresh.io/wp-content/uploads/2021/12/Screen-Shot-2021-11-17-at-7.01.44-PM.png" alt="" width="972" height="654" class="alignnone size-full wp-image-20707" /></a>

<p>Once the GitOps controllers are installed, you can easily deploy any kind of application to your GKE Autopilot cluster using GitOps. This means that you can combine all the benefits of GitOps such as audibility, visibility, reduced downtime with the easy management of the GKE Autopilot capabilities.</p>

<a href="https://codefresh.io/wp-content/uploads/2021/12/GitOpsDashboard.png"><img src="https://codefresh.io/wp-content/uploads/2021/12/GitOpsDashboard.png" alt="" width="1369" height="750" class="alignnone size-full wp-image-20708" /></a>

<h2>Summary</h2>
<p>GKE Autopilot cluster allows you to pursue a production-ready and scalable workflow for both your application and infrastructure systems. Its ability to configure cluster autoscaling and node auto-provisioning can improve resource utilization and reduce day-to-day challenges for organizations. These features reduce the operational cost of managing clusters and optimize them for production.</p>
<p><br />Google Cloud also provides a user-friendly experience, creating, configuring, and operating a Kubernetes cluster that you can integrate with the <a href="https://codefresh.io/codefresh-argo-platform/">Codefresh DevOps Platform</a> with a GitOps Controller, powered by <a href="https://codefresh.io/argo-codefresh/">ArgoCD</a>.</p>