Scenario: I am deploying apache2 as an RC with 3 replicas. so three pods will be created based on the load. i need each pod to have its own log folder mounted with host-node without being shared. hostpath should be as /{podname-containername}/var/log/apache2/access.log for each pod in runtime while spanning a new replica(new pod).
The recommended way of gathering logs in Kubernetes is using fluentd, and navigate them using Elasticsearch/Kibana.
Nodes are not as ephemeral as pods, but to some extent they can be considered ephemeral in a k8s cluster, so It's highly recommended that you don't drop your log files to volumes on the host node.
That said, the only solution I can think of for your scenario is creating a hostPath
volume on everypod, creating a folder using an arbitrary name, and using that folder to store logs.
If you need to know which pod is writing the logs, you can prefix the folder name with the container/pod name.