I have a init container in which I'm storing file but while running it's showing the file is not present. Is there any way I can exec inside init container and check where the file is being stored.
Use kubectl describe <pod>
to get the id of the initContainer you need to exec into then use kubectl exec -ti <pod> -c <container> sh
to access its shell. You may need to add some kind of delay, like sleep
to the initContainer to access it before it completes or fails.