I use the Jenkins kubernetes plugin to build a job, but when I start build I have to wait for about 15s before the slave is online. Why does this happen?
I had the same problem. I fixed this to a large extent by making sure that my master and slave images were in the Same region, subnet as well VPC. Moreover, I was fetching some config files from AWS S3 and moved the bucket to the same region as well.
All of this combined should make everything much quicker.
You need to be aware that when you use the Kubernetes Plugin, your Jenkins-slave is created on demand when you build a job. Supposing you are using the jnlp-slave as your jenkins-slave image, 15s is the time need for k8s to schedule the pod and to start up the jnlp slave jar.
What you can do in order to optimize the time, is using the option Time in minutes to retain slave when idle
in the Kubernetes Plugin configuration, that holds the pods running for a determined amount of time, so the next builds can reuse that slave.