A Kubernetes volume is essentially a directory that is accessible to all the containers running in a pod. To configure custom volumes, use the customVolumes and customVolumeMounts sections for each product. Under these sections, you can create a volume configuration as it is, based on the official Kubernetes volume parameters.
Artifactory Example
In this example, we will use a configMap
to mount as a custom volume, but you can use any supported Kubernetes volume:
To create a configMap called
log-config
that contains atest.yaml
file, run the following command:kubectl create configmap log-config --from-file=test.yaml
To create a custom volume, update the customVolumes section as follows:
artifactory: customVolumes: | - name: config-vol ## Name of the custom volume configMap: ## Predefined paramter of the configMap name: log-config
To define the mount path (
/tmp/etc/
) for the volume, update the customVolumeMounts section as follows:artifactory: customVolumes: | - name: config-vol ## Name of the custom volume configMap: ## Predefined parameter of the configMap name: log-config customVolumeMounts: | - name: config-vol ## Name of the custom volume mountPath: /tmp/etc/test.yaml subPath: test.yaml
These settings will bootstrap the configMap under the
/tmp/etc
folder. To further work with such custom volumes, use thepreStartCommand
and interact with them:artifactory: customVolumes: | - name: config-vol configMap: name: log-config customVolumeMounts: | - name: config-vol ## The name here must match the name set under customVolumes mountPath: /tmp/etc/test.yaml subPath: test.yaml preStartCommand: "cat /tmp/etc/test.yaml"
Follow the similar steps to manage custom volumes for Xray and Distribution. However, update the relevant configurations under the correct parent keys.
Xray Example
xray: common: customVolumes: | - name: config-vol configMap: name: log-config customVolumeMounts: | - name: config-vol ## The name here must match the name set under customVolumes mountPath: /tmp/etc/test.yaml subPath: test.yaml preStartCommand: "cat /tmp/etc/test.yaml"
Distribution Example
distribution: common: customVolumes: | - name: config-vol configMap: name: log-config customVolumeMounts: | - name: config-vol ## The name here must match the name set under customVolumes mountPath: /tmp/etc/test.yaml subPath: test.yaml preStartCommand: "cat /tmp/etc/test.yaml"