Skip to content

Part 2: Sync from Git

This is Part 2 of a multi-part, self-paced quick start exercise.


What Will You Do

In part 2, you will create and update an EKS cluster using system sync. You will commit a cluster specification file for a new cluster to your Git repository and see that the GitOps pipeline automatically detects the addition and begins creating a new cluster in your project. We will then increase the node count on the cluster by updating the cluster spec from Git.


Step 1: Initial Sync

First, we will manually run the pipeline in order to sync the existing system resources to the GitHub repository. Note, only the resources that were included in the pipeline stage will be synced. In this case, only cluster resources will be synced.

  • Navigate to GitOps -> Pipelines
  • Click on the previously created pipeline
  • Click "Run"

Initial Pipeline

  • Navigate to your GitHub Repository

We can see that the blueprint and workload manifest have been created in the Git repository

Initial Repo


Step 2: Create Cluster From Git

In this step, we will add a cluster spec file to the Git repository and then witness the cluster being created automatically in the system.

  • Add the following spec file to "projects/defaultproject/clusters/Cluster Name.yaml" in your Git Repo

The following items may need to be updated to match your environment

  • name: ss-cluster
  • project: defaultproject
  • cloudCredentials: awscc
  • name: ss-cluster
  • region: us-west-2
apiVersion: infra.k8smgmt.io/v3
kind: Cluster
metadata:
  name: ss-cluster
  project: defaultproject
spec:
  blueprintConfig:
    name: default
  cloudCredentials: awscc
  cniProvider: aws-cni
  config:
    metadata:
      name: ss-cluster
      region: us-west-2
      version: "1.21"
    nodeGroups:
    - amiFamily: AmazonLinux2
      desiredCapacity: 1
      iam:
        withAddonPolicies:
          autoScaler: true
          imageBuilder: true
      instanceType: t3.medium
      maxSize: 3
      minSize: 1
      name: ng1
      volumeSize: 80
      volumeType: gp3
    vpc:
      cidr: 192.168.0.0/16
      clusterEndpoints:
        privateAccess: true
        publicAccess: false
      nat:
        gateway: Single
  type: aws-eks
  • Commit the file to your Git repository

The commit will trigger the GitOps pipeline and it will automatically create the cluster. We can see that the cluster is being provisioned.

Git Cluster

Navigate to GitOps -> Pipelines in the console to see that a second job in the pipeline was initiated. This job was triggered via a GitHub webhook when we commited the cluster YAML file.

Pipeline Cluster


Step 3: Update Cluster From Git

In this step, we will update the desired node count in the cluster spec file on the Git repository and then witness the cluster being updated automatically in the system.

  • Navigate to your Git repo -> "projects/defaultproject/clusters/Cluster Name.yaml"
  • Update the text for "desiredcapacity" from "desiredCapacity: 1" to "desiredCapacity: 2"
  • Commit the changes to your Git repository
apiVersion: infra.k8smgmt.io/v3
kind: Cluster
metadata:
  name: ss-cluster
  project: defaultproject
spec:
  blueprintConfig:
    name: default
  cloudCredentials: awscc
  cniProvider: aws-cni
  config:
    metadata:
      name: ss-cluster
      region: us-west-2
      version: "1.21"
    nodeGroups:
    - amiFamily: AmazonLinux2
      desiredCapacity: 2
      iam:
        withAddonPolicies:
          autoScaler: true
          imageBuilder: true
      instanceType: t3.medium
      maxSize: 3
      minSize: 1
      name: ng1
      volumeSize: 80
      volumeType: gp3
    vpc:
      cidr: 192.168.0.0/16
      clusterEndpoints:
        privateAccess: true
        publicAccess: false
      nat:
        gateway: Single
  type: aws-eks

The commit will trigger the GitOps pipeline and it will automatically update the cluster node Group. After a few minutes, we can see that that the number of nodes on the cluster was increased to two.

Git Cluster Update


Recap

In this part, you tested syncronization between your Git repository and the system to create and update an EKS cluster.