What is the best way for mounting a configuration directory such as /etc/apache2 as a volume in kubernetes? The pod containing apache2 container may be scheduled in different nodes. I want to persist the configuration files between container restarts.
You can use Configmap to achieve this. You can create the Configmap from your apache config directory. This is the official documentation which should cover how you can configure it and add to your Pod: https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/#create-configmaps-from-directories