I'm looking to replace our overly complex in-house CI/CD system with something more sensible, focusing specifically on the continuous deployment aspect. I'm considering main Kubernetes-native solutions like ArgoCD, FluxCD, and Rancher Fleet. Our current deployment pipeline goes like this: we have a Jenkins Multibranch Pipeline that triggers builds from specific branches in our app repository. For the `main`, `develop`, and `uat` branches, it builds Docker images, generates manifests using Kustomize, and applies them with `kubectl`.
For GitHub pull requests, it builds the same Docker image but targets a specific Kustomize directory and creates a temporary namespace for the PR. Once PRs are closed, a cron job cleans up by deleting these namespaces based on labels. In the production scenario, we tackle it a bit differently with manually initiated jobs that use tags to deploy.
I get how to map the first and last steps to a GitOps workflow, but I'm stuck on the PR environments. How would those fit into either ArgoCD or FluxCD for deployment and cleanup? Would it be enough to push generated Kustomize manifests to a repo and let the tool handle cleanup when PRs are merged or closed? Also, we've often run into issues where `kubectl apply` doesn't handle resource removals well, leading to tedious manual deletions. I keep wondering if it all would've been easier with an Operator SDK approach or by using Helm charts from the start. Any advice on these transitions would be hugely appreciated!
4 Answers
For your question about PRs, definitely look into ArgoCD's ApplicationSet, especially the PR generator. It makes it super easy to manage resources based on pull requests. Once the PR is merged or closed, you can have Argo handle the cleanup for you, which simplifies things a ton. Check out the documentation for a detailed setup guide.
I've had a great experience with FluxCD, particularly because it automatically cleans up after itself when you push PR-specific manifests. Just generate the manifests, commit them, and Flux will manage deployments and cleanup without much hassle. It's really a straightforward process after you get the hang of it!
I think you're right to transition towards GitOps. Any solution, including Flux or Argo, will handle the PR generation and cleanup quite well with the right configurations in place. With FluxCD, for instance, you can align with your branching strategy easily. It's helped us a lot with managing static environments and tracking drift.
Exactly! Keeping it simple with a trunk-based approach could save you a lot of hassle. Each environment can be kept clean without manual intervention. Just focus on how to align your workflow with these tools.
I wouldn't recommend Rancher Fleet for this. It's not as robust for handling PRs and automatic cleanup as Argo or Flux are. Just something to keep in mind while you decide.
Can you elaborate on why you feel that way? I'm curious to hear more about your experience with it.

I totally agree! We've implemented this with GitLab PRs and it works flawlessly. Just follow the guidelines for the PR generator to get started.