Continuous declarative IaC using an Environment repository
As we know by now, we must create a GKE cluster to host our microservices. So far, we’ve been using gcloud
commands to do this; however, because gcloud
commands are not declarative, using them is not ideal when implementing GitOps. Instead, we’ll use Terraform to create the GKE cluster for us. This will ensure we can deploy and manage the cluster declaratively using a Git Environment repository. So, let’s go ahead and create one.
Creating and setting up our Environment repository
Navigate to https://github.com and create a repository using a name of your choice. For this exercise, we will use mdo-environments
. Once you have done that, navigate to Google Cloud Shell, generate a ssh-key
pair using the ssh-keygen
command, copy the public key to GitHub (refer to Chapter 2, Source Code Management with Git and GitOps, for step-by-step instructions), and clone the repository using the following commands...