I'm not sure if there is a ready condition in DaemonSet. By that, I mean all pods owned by that DaemonSet are ready.
I'm aware of kubectl wait
, but it seems can not check the readiness of DaemonSet.
I would suggest to get pods from your DaemonSet by using following command:
kubectl get pods -l <daemonset-selector-key>=<daemonset-selector-value>
And then check status of those pods in loop looking if they are ready.
Try this out
function wait-for-daemonset(){
retries=10
while [[ $retries -ge 0 ]];do
sleep 3
ready=$(kubectl -n $1 get daemonset $2 -o jsonpath="{.status.numberReady}")
required=$(kubectl -n $1 get daemonset $2 -o jsonpath="{.status.desiredNumberScheduled}")
if [[ $ready -eq $required ]];then
#echo "Succeeded"
break
fi
((retries--))
done
}