Hi team I have a question <#CDR4R9Z7E|ckad-certified-kub-app-dev> if we have a l . . .

Rachel Whitmore:
Hi team I have a question <#CDR4R9Z7E|ckad-certified-kub-app-dev> if we have a liveness probe and I needed it to run a ls. I saw that you can do this ->

exec:
     command: 
        - ls 

I thought you would always need to add "/bin/sh " “-c” before running anything… What is the rule for when you use /binsh verse just writing like ls?

Sunil Yadav:
According to me, Using [“sh”, “-c”] allows you to run a more complex command or take advantage of shell features like environment variable expansion, command substitution. This option is beneficial when you need to perform multiple commands or execute commands that involve shell features.

command: [“sh”, “-c”, “echo Hello, $USER && sleep 1000”]

In general, if your command is straightforward and doesn’t require shell processing, it is more efficient to use the direct command.

Alistair Mackay:
ls is a binary executable command. An equivalent command on Windows (they do exist) would be ls.exe
Anything that is executable can be run directly as command:
If what you want to run is a shell script then you need to use sh -c to run that.