Reputation: 850
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.
Upvotes: 6
Views: 5911
Reputation: 377
Simpler method from https://starkandwayne.com/blog/silly-kubectl-trick-5-waiting-for-things-to-finish-up-2/ ->
kubectl rollout status daemonset \
rke2-ingress-nginx-controller \
-n kube-system \
--timeout 60s
Upvotes: 8
Reputation: 964
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
}
Upvotes: 2
Reputation: 4628
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.
Upvotes: 3