Can anyone share their experience using GitOps workflows on DigitalOcean Kubernetes clusters? Which tools and practices worked best for managing application, deployments and setting up infrastructure with GitOps principles?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hey,
I’ve recently answered a similar question here:
Implementing GitOps workflows on DigitalOcean Kubernetes clusters can significantly simplify your deployment processes, ensuring a more manageable, transparent, and scalable infrastructure. Here’s a focused approach using one of the most popular tools in the GitOps space: Argo CD. This tool automates the deployment of applications to Kubernetes, maintaining the desired state specified in a Git repository.
kubectl
configured to communicate with your DOKS clusterFirst, install Argo CD on your DOKS cluster. This can be done via a single command using kubectl
:
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
This command creates a new namespace for Argo CD and applies the Argo CD installation manifests.
To access the Argo CD UI, you’ll need to change the Argo CD server service from ClusterIP
to LoadBalancer
:
kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "LoadBalancer"}}'
Wait a few moments, then retrieve the external IP:
kubectl get svc argocd-server -n argocd
The initial password for the admin account is auto-generated and stored as a pod name. Retrieve it with:
kubectl get pods -n argocd -l app.kubernetes.io/name=argocd-server -o name | cut -d'/' -f 2
Use the Argo CD CLI or UI to log in. If using the CLI:
argocd login <ARGOCD_SERVER_IP>
Replace <ARGOCD_SERVER_IP>
with the external IP from earlier. Use admin
as the username and the retrieved pod name as the password.
Now, let’s create an application in Argo CD that points to your Git repository. This can be done via the Argo CD CLI or UI. Here’s how you might do it via the CLI:
argocd app create myapp \
--repo https://github.com/yourusername/yourrepo.git \
--path manifests \
--dest-server https://kubernetes.default.svc \
--dest-namespace default
Replace the repository URL (--repo
) with your Git repository URL and --path
with the directory within your repository where your Kubernetes manifests are stored.
Finally, synchronize your application to match the desired state specified in your Git repository:
argocd app sync myapp
Repository Structure: Keep your application manifests, Helm charts, or Kustomize configurations in a dedicated repository or a distinct directory within an existing repository. This separation of concerns helps in managing changes and versioning.
Branching Strategy: Utilize a branching strategy (e.g., GitFlow or Trunk Based Development) that fits your team’s workflow. Typically, having a separate branch for each environment (dev, staging, production) can help manage deployments across different stages.
CI/CD Integration: Integrate Argo CD with your CI pipeline to automatically trigger deployments upon changes to your manifests. This could involve updating image tags in your deployment manifests after a successful build.
Monitoring and Alerts: Set up monitoring and alerts for your Argo CD instances and managed applications. Monitoring tools like Prometheus and Grafana can be integrated with Argo CD to track the health and performance of your deployments.
Best,
Bobby
I’ve been using GitOps with DO’s Kubernetes for a while now. For managing deployments and apps, ArgoCD is fantastic. It integrates well with Git and keeps things version controlled.Terraform is a great tool for infrastructure as code, allowing you to define your cluster and resources in Git.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.