harness-gitops
Skill19 starsChanged 6 months agoMITView on GitHub
Implement and operate GitOps workflows using Harness GitOps (ArgoCD-backed) for Kubernetes deployments. Use this skill whenever the user mentions GitOps, ArgoCD, ApplicationSet, drift detection, sync policy, self-healing, Git as source of truth, multi-cluster GitOps, Harness GitOps agent, app-of-apps pattern, or managing Kubernetes state declaratively from a Git repository. Also trigger when the user wants to audit what is running in a cluster vs what is in Git.
- Commits and pushes
In this repository37 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- workflow-orchestratorSkill
- user-flow-writingSkill
- ba-requirements-analysisSkill
- taste-memory-managementSkill
- progress-trackerSkill
- harness-pipeline-designSkill
- harness-service-onboardingSkill
- harness-delegate-managementSkill
- harness-secrets-managementSkill
- harness-feature-flagsSkill
- harness-template-librarySkill
- security-scanningSkill
- cloakbrowser-testingSkill
- performance-load-testingSkill
- chaos-experiment-designSkill
- chaos-hypothesis-validationSkill
- chaos-blast-radius-controlSkill
- chaos-steady-state-definitionSkill
- chaos-infrastructure-faultsSkill
- chaos-application-faultsSkill
- chaos-game-day-planningSkill
- harness-cv-verificationSkill
- chaos-observability-integrationSkill
- alerting-recommendationsSkill
- harness-policy-governanceSkill
- harness-cloud-costSkill
- chaos-resilience-scoringSkill
- chaos-postmortem-learningSkill
- release-managementSkill
- disaster-recovery-business-continuitySkill
- compliance-auditSkill
- strategic-creatorSkill
- deep-researchSkill
- system-optimizationSkill
- documentation-writingSkill
- devils-advocateSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 349
When Harness AI is unavailable: Use static pipeline templates from s09 Template Library and manual YAML construction following Harness …
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Harness GitOps
Purpose
Establish Git as the single source of truth for Kubernetes cluster state. All changes flow through Git PRs — never direct kubectl apply. Harness GitOps continuously reconciles cluster state to match the Git repository.
Input Contract
| Input | Source | Required |
| Service definitions | s05 (workflow_context.artifacts) | Yes |
| Deploy templates | s09 output | No |
| Pipeline YAML | s04 output | Yes |
| Git repository details | s01 or user | Yes |
| GitOps preference (s02 taste) | s02 taste (deployment category) | No |
Output Contract
| Output | Destination | Format |
| GitOps Application YAML | .commandcode/artifacts/app-<service>.yaml | YAML |
| ApplicationSet YAML | .commandcode/artifacts/applicationset.yaml | YAML |
| GitOps Agent config | .commandcode/artifacts/gitops-agent.yaml | YAML |
| Drift alert notification rule | s21 (alerting context) | YAML |
| Pipeline GitOps sync step | s04 (pipeline updates) | YAML |
Prerequisites
- Kubernetes cluster accessible by Harness delegate
- Git repository with Kubernetes manifests or Helm charts
- Harness GitOps Agent installed in cluster
- ArgoCD CRDs installed (done automatically by Harness GitOps agent)
GitOps Architecture
Developer
│ git push / PR merge → main branch
▼
Git Repository (GitHub / GitLab / Bitbucket)
│ Harness GitOps watches for changes
▼
Harness GitOps (ArgoCD engine)
│ Detects drift OR manual sync triggered
▼
Harness GitOps Agent (runs in cluster)
│ Applies manifests via kubectl
▼
Kubernetes Cluster
│ Reconciles to match Git state
▼
Drift Alert → Harness notification → Auto-heal OR manual reviewStep 1 — Install GitOps Agent
# Generate agent token in Harness UI:
# GitOps → Agents → New Agent → Kubernetes → Download YAML
# Apply to cluster
kubectl apply -f harness-gitops-agent.yaml
# Verify
kubectl get pods -n harness-gitops-agent
# Expected: gitops-agent-xxxx Running
kubectl logs -n harness-gitops-agent <AGENT_POD> | grep -i "registered"
# Expected: "Agent registered successfully"Step 2 — Create GitOps Repository
repository:
name: <SERVICE_NAME> Manifests
identifier: <service_identifier>_manifests
orgIdentifier: <ORG_ID>
projectIdentifier: <PROJECT_ID>
agentIdentifier: <GITOPS_AGENT_IDENTIFIER>
repo: https://github.com/<ORG>/<REPO>
connectionType: HTTPS
authType: USERNAME_PASSWORD
username: <+secrets.getValue("github_username")>
password: <+secrets.getValue("github_pat")>
insecure: false
enableLfs: false
inherit: falseStep 3 — Create GitOps Cluster
cluster:
name: Production EKS Cluster
identifier: prod_eks
orgIdentifier: <ORG_ID>
projectIdentifier: <PROJECT_ID>
agentIdentifier: <GITOPS_AGENT_IDENTIFIER>
server: https://<EKS_API_SERVER>
name: in-cluster # Use "in-cluster" if agent is IN the target cluster
namespaces:
- <TARGET_NAMESPACE>Step 4 — Create Application
application:
name: <SERVICE_NAME>-production
identifier: <service_identifier>_production
orgIdentifier: <ORG_ID>
projectIdentifier: <PROJECT_ID>
agentIdentifier: <GITOPS_AGENT_IDENTIFIER>
clusterIdentifier: prod_eks
repoIdentifier: <service_identifier>_manifests
spec:
source:
repoURL: https://github.com/<ORG>/<REPO>
targetRevision: main # Branch / tag / commit
path: k8s/production/ # Path within repo
# For Helm:
# chart: my-chart
# helm:
# valueFiles: [values-production.yaml]
# parameters:
# - name: image.tag
# value: <+artifact.tag>
destination:
server: https://kubernetes.default.svc # in-cluster
namespace: <TARGET_NAMESPACE>
syncPolicy:
automated:
prune: true # Remove resources deleted from Git
selfHeal: true # Auto-revert manual kubectl changes
allowEmpty: false # Never sync an empty repo
syncOptions:
- CreateNamespace=true
- PrunePropagationPolicy=foreground
- PruneLast=true # Prune only after other resources sync
- RespectIgnoreDifferences=true
retry:
limit: 5
backoff:
duration: 5s
factor: 2
maxDuration: 3m
ignoreDifferences:
# Ignore fields managed by controllers (not by GitOps)
- group: apps
kind: Deployment
jsonPointers:
- /spec/replicas # HPA manages replicas
- group: ""
kind: Service
jsonPointers:
- /spec/clusterIP # Assigned by K8s, not in GitStep 5 — ApplicationSet (Multi-Cluster / Multi-Env)
ApplicationSets generate multiple Applications from a single template:
# app-of-apps pattern: one ApplicationSet manages all services
applicationSet:
name: All Services
identifier: all_services
agentIdentifier: <GITOPS_AGENT_IDENTIFIER>
spec:
generators:
# Generate one app per service directory
- git:
repoURL: https://github.com/<ORG>/gitops-config
revision: main
directories:
- path: services/*/production
template:
metadata:
name: "{{path.basenameNormalized}}-production"
labels:
managed-by: hcprm
generated-by: applicationset
spec:
source:
repoURL: https://github.com/<ORG>/gitops-config
targetRevision: main
path: "{{path}}"
destination:
server: https://kubernetes.default.svc
namespace: "{{path.basename}}"
syncPolicy:
automated:
prune: true
selfHeal: trueStep 6 — GitOps in CD Pipeline
Trigger GitOps sync as part of a Harness CD pipeline step:
- step:
name: Update Image Tag in Git
identifier: update_image_tag_git
type: ShellScript
spec:
shell: Bash
source:
type: Inline
spec:
script: |
# Clone GitOps config repo
git clone https://$GIT_USERNAME:$GIT_TOKEN@github.com/<ORG>/gitops-config.git
cd gitops-config
# Update image tag using yq
yq e -i '.image.tag = "<+artifact.tag>"' \
services/<+service.name>/production/values.yaml
# Commit and push
git config user.email "harness-bot@company.com"
git config user.name "Harness Pipeline"
git add .
git commit -m "chore: update <+service.name> to <+artifact.tag> [skip ci]"
git push origin main
envVariables:
GIT_USERNAME: <+secrets.getValue("github_username")>
GIT_TOKEN: <+secrets.getValue("github_pat")>
onDelegate: true
- step:
name: Wait for GitOps Sync
identifier: wait_gitops_sync
type: GitOpsSync
spec:
prune: true
dryRun: false
applicationsList:
- <service_identifier>_production
retrySteps: 10
retryInterval: 30sDrift Detection and Alerting
Configure alerts when cluster state diverges from Git:
# Harness GitOps notification rule
notificationRule:
name: Drift Alert
identifier: drift_alert
spec:
conditions:
- type: SyncStatusChange
conditions:
- operator: Equals
value: OutOfSync
destinations:
- type: Slack
spec:
webhookUrl: <SLACK_WEBHOOK>
channel: "#gitops-alerts"
message: |
⚠️ GitOps Drift Detected!
Application: {{app.name}}
Status: {{app.status.sync.status}}
Review: {{app.url}}Rollback via GitOps
GitOps rollback = revert the Git commit:
# Option 1: Git revert (preserves history — preferred)
git revert HEAD
git push origin main
# GitOps agent will sync back to previous state automatically
# Option 2: Pin to previous commit
git checkout <PREVIOUS_COMMIT> -- services/<SERVICE>/production/
git commit -m "revert: rollback <SERVICE> to <PREVIOUS_COMMIT>"
git push origin mainNever do: kubectl rollout undo — this creates drift and will be reverted by self-heal.
AI Agent Integration
Autonomy Level
| Aspect | Level | Description |
| Current | L2 | AI generates ArgoCD Application YAML and GitOps operations |
| Target | L3 | AI manages GitOps sync and drift detection |
Harness AI Agent
Agent: Harness AI DevOps Agent Capabilities:
- GitOps operations for 13 resource types
- ArgoCD Application YAML generation
- Sync policy configuration
- Drift detection and alerting
Human Gates
- Production sync policies
- Drift resolution in production
- GitOps repo access changes
Fallback
When Harness AI is unavailable: Use static pipeline templates from s09 Template Library and manual YAML construction following Harness schema documentation.
Success Criteria
- GitOps agent running with
Connectedstatus in Harness - Application syncing automatically within 3 minutes of Git push
selfHeal: true— verified by making a manualkubectlchange and observing auto-revert- Drift detection alerts flowing to Slack / PagerDuty
- Image tag updates flowing through pipeline → Git → GitOps sync chain
- Multi-env ApplicationSet or separate apps per environment configured
- Rollback procedure tested and documented
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

