How to know how long it takes to create a pod in Kubernetes ? Is there any command please?

1/12/2019

I have my Kubernetes cluster and I need to know how long it takes to create a pod? Is there any Kubernetes command show me that ? Thanks in advance

-- MOBT
kubernetes

1 Answer

1/14/2019

What you are asking for is not existing.

I think you should first understand the Pod Overview.

A Pod is the basic building block of Kubernetes–the smallest and simplest unit in the Kubernetes object model that you create or deploy. A Pod represents a running process on your cluster.

A Pod encapsulates an application container (or, in some cases, multiple containers), storage resources, a unique network IP, and options that govern how the container(s) should run. A Pod represents a unit of deployment: a single instance of an application in Kubernetes, which might consist of either a single container or a small number of containers that are tightly coupled and that share resources.

While you are deploying a POD it's going through phases

Pending The Pod has been accepted by the Kubernetes system, but one or more of the Container images has not been created. This includes time before being scheduled as well as time spent downloading images over the network, which could take a while.

Running The Pod has been bound to a node, and all of the Containers have been created. At least one Container is still running, or is in the process of starting or restarting.

Succeeded All Containers in the Pod have terminated in success, and will not be restarted.

Failed All Containers in the Pod have terminated, and at least one Container has terminated in failure. That is, the Container either exited with non-zero status or was terminated by the system.

Unknown For some reason the state of the Pod could not be obtained, typically due to an error in communicating with the host of the Pod.

As for Pod Conditions it have a type which can have following values:

  • PodScheduled: the Pod has been scheduled to a node;
  • Ready: the Pod is able to serve requests and should be added to the load balancing pools of all matching Services;
  • Initialized: all init containers have started successfully;
  • Unschedulable: the scheduler cannot schedule the Pod right now, for example due to lacking of resources or other constraints;
  • ContainersReady: all containers in the Pod are ready.

Please refer to the documentation regarding Pod Lifecycle for more information.

When you are deploying your POD, you have to consider how many containers will be running in it. The image will have to be downloaded, depending on the size it might take longer. Also default pull policy is IfNotPresent, which means that Kubernetes will skip the image pull if it already exists. You can find more about Updating Images can be found here.

You also need to consider how much resources your Master and Node has.

-- Crou
Source: StackOverflow