We recently started using Argo Rollouts to use a proper BlueGreen deployment strategy instead of using a homegrown bash script to mimic the BlueGreen deployment strategy ourselves.
Argo has been a great success so far! The only thing we were missing is the
ability to monitor the status of the rollout. Previously we could achieve it
via kubectl rollout status deployment/xxx
. Unfortunately, at the time of
writing, the Kubectl Argo Rollout
plugin doesn’t support such a command yet. So we had to find a way around since
our developers wanted to be notified when the rollout is completed.
The hacky solution
So to monitor the Argo Rollout, we wrote a little bash with a loop which will check the status of the rollout
deploying=true
while $deploying; do
sleep 10
status="$(kubectl argo rollouts --cluster="$KUBERNETES_CLUSTER" \
--namespace="$KUBERNETES_NAMESPACE" \
get rollout web | \
grep 'Status' | \
awk '{print $3}')"
echo "Status: $status"
if [ "$status" = "Healthy" ]; then
deploying=false
fi
done
It’s straightforward. We start a while loop and sleep for a couple of seconds.
Next, we will retrieve the details of the rollout, which we can retrieve using
the Kubectl Argo Rollouts
plugin. We need to manipulate the output with Grep and AWK to filter out the
status since JSON output isn’t available yet. The loop exits after the rollout
transitions back to the Healthy
state, which indicates the Argo Rollout
finished. After that, you can extend your bash script to notify your
developers/ CI / Github / …
It’s not pretty, but it works so far until Argo Rollouts will support monitoring the rollout natively.