Skip to content

Part 2: Provision

What Will You Do

In this section, you will create a new AKS cluster using the UI and see that the System Sync pipeline automatically converts the cluster resource to infrastructure as code and pushes the cluster manifest to the Git repository. We will then increase the minimum node count on the cluster by updating the cluster manifest from Git and see that the cluster node count increases on the cluster.


Step 1: Provision Cluster

In this step, we will provision a new cluster from the UI. Alternatively, you can import and takeover an exisitng cluster rather than creating a new cluster through the UI. To proceed with importing a cluster, follow these instructions

  • In your project, navigate to Infrastructure -> Clusters
  • Click "New Cluster"
  • Select "Create a New Cluster"
  • Click "Continue"

Create Cluster

  • Select "Public Cloud"
  • Select "Azure"
  • Select "Azure AKS"
  • Enter a cluster name
  • Click "Continue"

Create Cluster

  • Enter the "Resource Group" where the cluster will be created
  • Select the previously created "Cloud Credentials"
  • Select the Azure Region for the cluster
  • Select the K8S Version for the cluster
  • Select the "default-aks" blueprint
  • Click "Save Changes"

Create Cluster

  • Click "Provision"

Provisioning in Process

Provisioning will take approximately 10 minutes to complete. The final step in the process is the blueprint sync for the default blueprint. This can take a few minutes to complete because this requires the download of several container images and deployment of monitoring and log aggregation components.


Step 2: Validate GitOps

In this step, we will check that the GitOps pipeline created a cluster specification file and pushed it to the Git repository.

  • In your project, navigate to GitOps -> Pipelines
  • Click on the name of the previously created pipeline

You will see that a second job in the pipeline was initiated. This job was triggered by the system when the new cluster was created. This new job was the system writing the cluster specification file to the Git repo.

Pipeline Cluster

Now, we will check that the Git repo has the cluster spec file.

  • Navigate to your GitHub repository
  • In the repo, navigate to projects -> defaultproject/clusters

Note

The Git path will be different if you used a different project name.

You will see the cluster specification files for all clusters in the project.

Cluster Specs


Step 3: Update Cluster From Git

In this step, we will update the minimum 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/Project Name/clusters/Cluster Name.yaml"
  • Edit the file and update the text for "count" from "count: 1 to "count: 2"
  • Edit the file and update the text for "maxCount" from "maxCount: 1 to "maxCount: 2"
  • Edit the file and update the text for "minCount" from "minCount: 1 to "minCount: 2"
  • Commit the changes to your Git repository
apiVersion: infra.k8smgmt.io/v3
kind: Cluster
metadata:
  name: aks-cluster-gs
  project: defaultproject
spec:
  blueprintConfig:
    name: default-aks
  cloudCredentials: azure-cloud-credential
  config:
    kind: aksClusterConfig
    metadata:
      name: aks-cluster-gs
    spec:
      managedCluster:
        apiVersion: "2022-07-01"
        identity:
          type: SystemAssigned
        location: eastus2
        properties:
          apiServerAccessProfile:
            enablePrivateCluster: true
          dnsPrefix: aks-cluster-gs-dns
          kubernetesVersion: 1.23.15
          networkProfile:
            loadBalancerSku: standard
            networkPlugin: kubenet
        sku:
          name: Basic
          tier: Free
        type: Microsoft.ContainerService/managedClusters
      nodePools:
      - apiVersion: "2022-07-01"
        location: eastus2
        name: primary
        properties:
          count: 2
          enableAutoScaling: true
          maxCount: 2
          maxPods: 40
          minCount: 2
          mode: System
          orchestratorVersion: 1.23.15
          osType: Linux
          type: VirtualMachineScaleSets
          vmSize: Standard_DS2_v2
        type: Microsoft.ContainerService/managedClusters/agentPools
      resourceGroupName: RafayRG-Tim
  proxyConfig: {}
  type: aks
status:
  aks:
    nodepools:
    - createdAt: "2023-03-02T17:18:29Z"
      id: 24wpnvm
      kubeVersion: 1.23.15
      name: primary
      provisionStatus: NODEGROUP_PROVISION_COMPLETE
  blueprint:
    name: default-aks
  conditions:
  - reason: registered
    status: "True"
    type: ClusterRegisterSucceeded
  - reason: checked in
    status: "True"
    type: ClusterCheckInSucceeded
  - reason: all nodes synced
    status: "True"
    type: ClusterNodeSyncSucceeded
  - reason: all namespaces synced
    status: "True"
    type: ClusterNamespaceSyncSucceeded
  - reason: all tasks/workloads synced
    status: "True"
    type: ClusterBlueprintSyncSucceeded
  - reason: blueprint synced
    status: "True"
    type: ClusterReady
  createdAt: "2023-03-02T17:08:10Z"
  displayName: aks-cluster-gs
  extra:
    vaultIntegration: {}
  id: 2q6dljm
  name: aks-cluster-gs
  provisionStatus: CLUSTER_PROVISION_COMPLETE

The commit will trigger the GitOps pipeline and it will automatically update the cluster node pool.

  • In your project, navigate to GitOps -> Pipelines
  • Click on the name of the previously created pipeline

You will see that a third job in the pipeline was initiated. This job was triggered by the system when the new cluster was created. This new job was the system writing the cluster specification file to the Git repo.

Pipeline Cluster

After a few minutes, we can see that that the number of nodes in the cluster was increased to two.

Git Cluster Update


Recap

In this part, you tested bidirectional syncronization between your Git repository and the system when creating and updating an AKS cluster.