0

I know when Pod's lifecycle hooks are executed, but even after reading the official docs (this) I am not able to figure out when "Command and Arguments" execute, does anyone know?


UPDATE 1: I want to know specifically that at what point "Command and Argument" gets executed - is it before container creation starts or in parallel to container creations?

pjj
  • 2,015
  • 1
  • 17
  • 42
  • Does this answer the question? https://stackoverflow.com/questions/44316361/difference-between-docker-entrypoint-and-kubernetes-container-spec-command – Manuel Mar 23 '21 at 17:11
  • @ManuelPolacek: Thanks, this was helpful but I want to know more. What this answer tell is this - "The command and arguments that you define in the configuration file override the default command and arguments provided by the container image.", which is also written in link I have mentioned in my question. I want to know specifically that at what point "Command and Argument" gets executed - is it before container creation starts or in parallel to container creations? – pjj Mar 23 '21 at 18:26
  • Ok, got it. I'm currently on my phone, so i will answer you when i'm back home. – Manuel Mar 23 '21 at 18:47
  • @ManuelPolacek: ok thanks, will wait. – pjj Mar 23 '21 at 19:17
  • I see, you already got an answer. – Manuel Mar 23 '21 at 21:25

1 Answers1

3

When you create a pod using kubectl, then kube-apiserver stores the Pod definition in the etcd store.

Then the kube-scheduler updates the pod definition with the nodeName on which it should run

Then the kubelet system Daemon running on that nodeName takes the Pod Definition and asks the Container Runtime like Docker to create the Containers mentioned in the Pod Definition.

Then the Container Runtime like Docker creates the Container and When the Container Starts at that time, the Command is run with the Arguments as the first process of the Container.

If you inspect the Container on the NodeName then you will see that the container Entrypoint contains the Command and Arguments defined in the spec of the container inside the pod spec.

Sagar Velankar
  • 845
  • 5
  • 5