What is expected distribution for a Kubernetes pod startup time

3/26/2018

On my test cluster, starting a pod seems to consistently take ~12 seconds, give or take one. I would like to know if that is reasonable, or if I am doing something wrong, either in configuring the pod, or in measuring the time, or configuring the cluster.

According to https://github.com/kubernetes/kubernetes/issues/3952 and https://medium.com/google-cloud/profiling-gke-startup-time-9052d81e0052, I believe what I am getting is excessively slow.

The way I measure startup is by running the following script and counting how many times it prints "Pending", and that is my startup time in seconds. Since due to the sleep command, I get almost exactly one "Pending" per second.

id=mypod1
tee job.yaml <<EOF
apiVersion: v1
kind: Pod
metadata:
  name: clusterrunner-build-${id}
spec:
  containers:
  - name: clusterrunner-slave
    image: jdanekrh/clusterrunner-slave
    command: ["bash", "-c", "echo bof; sleep 5; echo lek"]
  restartPolicy: Never
EOF

kubectl create -f job.yaml
while kubectl get pod/clusterrunner-build-${id} -o jsonpath='{.status.phase}' | grep Pending; do
    sleep 1
done
kubectl logs -f po/clusterrunner-build-${id}
kubectl delete -f job.yaml
-- user7610
kubernetes

0 Answers