description |
---|
PR Pipelines Quickstart |
This guide presents a basic introduction to Harness GitOps PR Pipelines. Together, we will:
-
Create a local Kubernetes cluster.
-
Install GitOps Agent.
-
Demonstrate how we can progress changes through multiple environments by interacting with your GitOps repository and
ApplicationSet
. -
Clean up.
kind create cluster \
--wait 120s \
--config - <<EOF
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
name: pr-quickstart
EOF
k3d cluster create pr-quickstart \
--no-lb \
--k3s-arg '--disable=traefik@server:0' \
--wait
-
In GitOps, click Settings, and then Clusters.
-
Click New Cluster.
-
In Name, enter the name appset-example.
-
In GitOps Agent, select the Agent you installed earlier.
-
Click Continue.
-
In Details, click Use the credentials of a specific Harness GitOps Agent.
-
Click Save and Continue. The connections is verified.
-
Click Finish.
We'll add Harness GitOps Clusters for the two target clusters where we want to add our application.
-
Create a new Harness GitOps Cluster for your dev cluster.
-
Name the cluster dev.
-
In GitOps Agent, select the GitOps Agent you added earlier.
-
In Details, select Specify Kubernetes Cluster URL and credentials.
-
In Master URL, enter the Endpoint URL for the target cluster (you can use
kubectl cluster-info
or your cloud console). Ensure that you use thehttps://
scheme. Here's an example: -
In Authentication, use the authentication method you prefer. In this tutorial, we use the
se-name
namespaceservice-account
token. -
Click Save and Continue. The GitOps Cluster is verified.
-
Click Finish.
You might see a Warning status. This status simply indicates that nothing has been deployed to the cluster yet.
In this step, we will create a GitOps repo on GitHub to house variations of our
application manifests for different environments: dev
, stage
, and
prod
.
Visit https://github.com/mansong1/pr-demo and fork the repository into your own GitHub account.
You can explore the repository and see that the main
branch contains common
configuration in a base/
directory as well as environment-specific overlays in
paths of the form env/<environment name>/
. Kustomize
is used as a configuration management tool that combines base configuration with
environment-specific configuration.
:::note This layout is typical of a GitOps repository using Kustomize and is not at all Harness specific. :::
To clean up, we will simply destroy our kind or k3d cluster:
kind delete cluster --name pr-quickstart
k3d cluster delete pr-quickstart