Argo Rollouts Setup on Kubernetes
- 5 minsSetting Up and Using Argo Rollouts on Kubernetes
Introduction
Argo Rollouts is an open-source tool for Kubernetes designed to enable advanced deployment strategies like blue-green and canary deployments. While Kubernetes offers native rolling update mechanisms, they have limitations such as restricted control over rollout speed and traffic distribution. Argo Rollouts overcomes these constraints, giving you greater flexibility and control over deployments.
In this article, we’ll cover the setup of Argo Rollouts and demonstrate how to use it for deploying applications.
Workflow of Argo Rollouts
Argo Rollouts integrates with tools like Ingress Controllers, Argo CD for visualization, and Prometheus for monitoring. Below is an explanation of its workflow:
- An application is already running in the cluster.
- To initiate a rollout, update the image or configuration in the manifest file.
- Argo Rollouts deploys the updated version alongside the existing version.
- Traffic is gradually shifted from the old to the new version based on the strategy defined in the manifest.
- The Ingress Controller manages traffic routing, while Prometheus collects metrics during the rollout process.
Installing Argo Rollouts
Prerequisites
- A functional Kubernetes cluster.
-
kubectl
configured to interact with the cluster.
Installation Steps
To keep Argo Rollouts isolated, create a dedicated namespace:
kubectl create namespace argo-rollouts
Step 2: Install Argo Rollouts
- Run the following command to install Argo Rollouts in the namespace:
kubectl apply -n argo-rollouts -f https://raw.githubusercontent.com/argoproj/argo-rollouts/stable/manifests/install.yaml
- This command installs the latest stable version of Argo Rollouts in the argo-rollouts namespace
Step 3: Install the Argo Rollouts Plugin (Linux-amd64) for kubectl
- Download the plugin
curl -LO https://github.com/argoproj/argo-rollouts/releases/latest/download/kubectl-argo-rollouts-linux-amd64
- Make it executable
chmod +x ./kubectl-argo-rollouts-linux-amd64
- Move the binary to your PATH
sudo mv ./kubectl-argo-rollouts-linux-amd64 /usr/local/bin/kubectl-argo-rollouts
- Verify the installation
kubectl argo rollouts version
Deploying Applications with Argo Rollouts
Step 1: Deploy the Initial Application
- Create the Manifest File
- Create a file named nginx-rollouts.yaml with the following content:
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
name: nginx-rollout
namespace: default
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx-container
image: nginx:1.24-alpine
ports:
- containerPort: 80
strategy:
canary:
steps:
- setWeight: 20
- pause: {duration: 10}
- setWeight: 50
- pause: {duration: 10}
- setWeight: 70
- pause: {duration: 10}
- setWeight: 100
- This deploys an older version (nginx:1.24-alpine) with 3 replicas. The Canary strategy distributes traffic incrementally, starting at 20% for the new version.
- Apply the Manifest File
kubectl apply -f nginx-rollouts.yaml
- Monitor the Rollout
kubectl argo rollouts get rollout nginx-rollout --watch
Step 2: Roll Out a New Version
- Update the Manifest File, Edit the nginx-rollouts.yaml file to update the nginx container image to the latest version:
image: nginx:latest
- Apply the Updated Manifest File
kubectl apply -f nginx-rollouts.yaml
- Monitor the Rollout
kubectl argo rollouts get rollout nginx-rollout --watch
- Traffic gradually shifts in the steps defined (20%, 50%, 70%, and finally 100%).
- Additionally You do not have to wait until new verison’s deployment You can Promote or Abort
- Promote Immediately: If the new version is stable and ready
kubectl argo rollouts promote nginx-rollout
- Abort Rollout: If issues arise with the new version:
kubectl argo rollouts abort nginx-rollout
Using the Argo Rollouts Dashboard
- Arge Rollout also has a simple GUI that you can follow up deployments and check details.
- You can run below command and lunch GUI
kubectl argo rollouts dashboard
- Open the dashboard at http://localhost:3100 to inspect the rollout process in detail.
- If you cluster is in remote host You need to open tunnel
- You can click and check rollout’s details.
Conclusion
By following these steps, you can install Argo Rollouts, set up the kubectl plugin, and deploy applications using advanced strategies like Canary. With features like traffic control and monitoring, Argo Rollouts ensures reliable and flexible application deployments.
Thanks for reading…
Guneycan Sanli.