Hi, Can anybody please explain while executing commands inside pods when to use args and when to use command? I see several examples in which args are used and in few command is used. I especially want to know for normal commands like sleep 3600. Any help and explanation is much apprecitaed.
I have gone through but I am unable to understand why in some questions we run the linux commands using args and why in some questions we run the linux commands using commands declaration ?
in kubernetes command corresponds to docker entrypoint and args corresponds to docker commands. But when to use which in CKAD exam ?
IMHO there is no one perfect answer when to use which in CKAD exam - it all depends of the image you use
• if you use both (e.g. command as [“sh”, “-c”] and args as “sleep 3600” then you are sure
• if you use just args - then be sure that you know the ENTRYPOINT of the image you used (because container runtime will use it)
• If you use just command - then be sure that you know the CMD of the iamge (because container runtime will use it)
• if you don’t use any - well it means that you know both (ENTRYPOINT and CMD of the image) - e.g php-fpm docker image
safest option IMHO - use both
but if you are sure you know entrypoint on cmd from the image and it suits your needs - then you don’t need to put command/args in the manifest (runtime will use the one from image) - it can be faster sometimes (like with the example with php-fpm img)