mountPath 覆盖同一文件夹中的其余文件 [英] mountPath overrides the rest of the files in that same folder

查看:49
本文介绍了mountPath 覆盖同一文件夹中的其余文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为 config-volume 的机密卷.我想将该文件放在/home/code/config 文件夹中,这是其余配置文件所在的位置.为此,我将其安装如下:

I have a volume with a secret called config-volume. I want to have that file in the /home/code/config folder, which is where the rest of the configuration files are. For that, I mount it as this:

volumeMounts:
  - name: config-volumes
  - mountPath: /home/code/config

问题是,部署后,在/home/code/config中我只有秘密文件,其余的都不见了

The issue is that, after deploying, in the /home/code/config I only have the secret file and the rest of them are gone

所以/home/code/config 是一个现有文件夹(非空),我怀疑 volumeMount 覆盖了该文件夹.

So the /home/code/config is an existing folder (not empty), I suspect that the volumeMount overwrites the folder.

有没有一种方法可以在不覆盖所有内容的情况下完成此操作?

Is there a way that this can be done without overwriting everything?

推荐答案

Kubernetes Secrets 作为目录挂载,使用 每个密钥作为该目录中的一个文件.因此,在您的情况下,config-volumes 机密被挂载到 /home/code/config,隐藏该目录之前的任何内容.

Kubernetes Secrets are mounted as a directory, with each key as a file in that directory. So in your case, the config-volumes secret is mounted to /home/code/config, shadowing whatever that directory was before.

您可以将卷挂载指定为:

You could specify your volume mount as:

volumeMounts:
  - name: config-volumes
  - mountPath: /home/code/config/config-volumes

这将在 config 目录中提供一个 config-volumes 目录,其中包含用于您的密钥的文件.

which would provide a config-volumes directory inside the config directory with files for your secret's keys inside.

这篇关于mountPath 覆盖同一文件夹中的其余文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆