Volumes
For more details, check the official documentation
emptyDir
$volume = K8s::volume()->emptyDirectory('some-volume');
$container->addMountedVolumes([
$volume->mountTo('/some-path'),
]);
$pod->addVolumes([$volume]);
ConfigMap
$cm = K8s::configMap()
->setName('some-config-map')
->setData([
'some-key' => 'value-for-file',
]);
$volume = K8s::volume()->fromConfigMap($cm);
$container->addMountedVolumes([
$volume->mountTo('/some-path/file.txt', 'some-key'),
]);
$pod->addVolumes([$volume]);
Secret
$secret = K8s::secret()
->setName('some-secret')
->setData([
'some-key' => 'value-for-file',
]);
$volume = K8s::volume()->fromSecret($secret);
$container->addMountedVolumes([
$volume->mountTo('/some-path/file.txt', 'some-key'),
]);
$pod->addVolumes([$volume]);
GCE Persistent Disk
$volume = K8s::volume()->gcePersistentDisk('some-disk', 'ext4');
$container->addMountedVolumes([
$volume->mountTo('/some-path'),
]);
$pod->addVolumes([$volume]);
AWS Elastic Block Store
$volume = K8s::volume()->awsEbs('vol-1234', 'ext4');
$container->addMountedVolumes([
$volume->mountTo('/some-path'),
]);
$pod->addVolumes([$volume]);
Last updated