How do you integrate Tekton with ArgoCD for GitOps-based continuous delivery?
Quick Answer
Tekton handles the CI phase by building, testing, and publishing artifacts, then updates a GitOps repository with the new image tag or manifest changes. ArgoCD watches the GitOps repository and automatically reconciles the Kubernetes cluster state to match the declared configuration. The integration point is the Git commit that Tekton pushes to the deployment repository, creating a clean separation between continuous integration and continuous delivery.
Detailed Answer
The Tekton-ArgoCD integration represents the canonical implementation of the GitOps model where CI and CD are deliberately separated with Git as the single source of truth between them. This separation is not merely architectural elegance but a fundamental security and auditability requirement. The CI system (Tekton) has permissions to access source code repositories, build infrastructure, and artifact registries, while the CD system (ArgoCD) has permissions to deploy to Kubernetes clusters. Neither system needs the other's credentials. The Git repository that sits between them serves as an auditable, version-controlled contract that captures every deployment decision as a git commit with full attribution and rollback capability.
The integration workflow begins when a developer pushes code to the payments-api source repository. A Tekton EventListener receives the webhook from GitHub or GitLab and triggers a PipelineRun. The Tekton pipeline clones the source code, runs unit tests and security scans, builds the container image, pushes it to the registry with a digest-based tag, and then executes the critical handoff step: updating the GitOps deployment repository. This update step clones the deployment repository containing the Kubernetes manifests or Helm values for the payments-api, modifies the image tag to reference the newly built image digest, commits the change with a meaningful message linking back to the source commit and pipeline run, and pushes to the deployment repository. This git commit is the integration point between Tekton and ArgoCD.
ArgoCD is configured with an Application resource that points to the payments-api directory in the GitOps deployment repository. ArgoCD continuously polls the repository or receives webhook notifications when changes are pushed. When ArgoCD detects that the desired state in Git differs from the actual state in the Kubernetes cluster, it performs a sync operation that applies the updated manifests. For the order-processing-service and checkout-service, separate ArgoCD Application resources point to their respective directories in the same or different deployment repositories. ArgoCD's sync policies can be configured for automatic sync with auto-prune and self-heal enabled for development environments, while production environments use manual sync with required approvals through ArgoCD's sync windows and RBAC policies.
The deployment repository structure is critical for this integration to work cleanly at scale. A well-designed GitOps repository uses a directory hierarchy that separates environments and services. The base directory contains the common Kubernetes manifests for each service, while overlay directories for dev, staging, and production contain environment-specific patches using Kustomize. When Tekton updates the image tag, it modifies only the environment-specific overlay, allowing the same pipeline to promote images through environments by targeting different overlay directories. For Helm-based deployments, the deployment repository contains values files per environment, and Tekton updates the image.tag value in the appropriate values file. This structure allows ArgoCD to manage dozens of services across multiple environments from a single repository with clear separation of concerns.
Operational considerations for the Tekton-ArgoCD integration include handling deployment failures, managing secrets, and implementing progressive delivery. When ArgoCD detects a failed deployment through health checks on the newly deployed pods of the inventory-sync service, it can be configured to automatically roll back by reverting the git commit. The Tekton pipeline can include a final notification step that queries the ArgoCD API to verify the sync completed successfully, closing the feedback loop. Secrets management requires careful coordination because the GitOps repository must not contain plaintext secrets. Solutions include Sealed Secrets, External Secrets Operator, or HashiCorp Vault with the ArgoCD Vault plugin, where secret references in the GitOps repository are resolved at deployment time. For progressive delivery of the user-auth-service, ArgoCD integrates with Argo Rollouts to perform canary or blue-green deployments, with Tekton triggering the initial rollout and ArgoCD managing the progressive traffic shifting based on metric analysis from Prometheus.