Part 3: Sync Workload
This is Part 3 of a multi-part, self-paced quick start exercise.
What Will You Do¶
In part 3, you will test bidrectional syncing of a workload. You will then update the workload manifest in the Git repository and see it automatically applied on the cluster.
Step 1: Update workload From Git¶
In this step, we will update the workload in the Git repository and then witness the update being applied automatically on the cluster.
- Navigate to your Git repo -> "projects/defaultproject/workloads/Workload Name.yaml"
- Edit the workload YAML file
- Update the version from "Workload Name.-v1" to "Workload Name.-v2"
- Commit the changes to your Git repository
- Navigate to your Git repo -> "projects/defaultproject/workloads/artifacts/Workload Name.yaml"
- Edit the workload YAML file
- Update the replica count from "2" to "4"
- Commit the changes to your Git repository
The update will trigger the Gitops pipeline and it will automatically update the running workload.
- Navigate to Infrastructure -> Clusters
- Click "Kubectl" for your cluster
- Type the following Kubectl command
kubectl get po -n nginx
You should see something like the following:
nginx-deployment-6d8787d7d-6jb5p 1/1 Running 0 55m
nginx-deployment-6d8787d7d-dngpw 1/1 Running 0 55m
nginx-deployment-6d8787d7d-dv5bn 1/1 Running 0 73m
nginx-deployment-6d8787d7d-hffp9 1/1 Running 0 55m
Step 2: Update Workload From System¶
In this step, we will update the workload from the system and then witness the update being applied automatically in the Git repository.
- Navigate to Applications -> Workloads
- Click on your NGINX workload
- Click "Edit"
- Update the replica count from "2" to "3"
- Click "Update"
- Click "Save And Go To Placement"
- Click Save And Go To Publish"
- Click "Republish"
The update will trigger the GitOps pipeline and it will automatically update the workload application spec file in the Git repository.
- Navigate to your Git repo -> "projects/defaultproject/workloads/artifacts/Workload Name"
- View the updated workload spec file showing the updated version
Recap¶
In this part, you tested two-way, bidirectional syncronization between the system and your Git repository for workloads.