Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to use Secret through volume

Shulou Source: shulou.com Published: 2022-06-01 00:57:56 10月05日 Update

This article shows you how to use Secret through volume. The content is concise and easy to understand. It will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

Pod can use Secret in the form of Volume or environment variables. Learn the Volume method first today.

The configuration file for Pod is as follows:

① defines volume foo, and the source is secret mysecret.

② will foo mount to the container path / etc/foo, and the read and write permission can be specified as readOnly.

Create Pod and read Secret in container

Kubernetes creates a file for each sensitive data under the specified path / etc/foo. The file name is the Key of the data entry, where / etc/foo/username and / etc/foo/password,Value are stored in clear text in the file.

We can also customize the file name where the data is stored, such as changing the configuration file to:

The data will be stored in / etc/foo/my-group/my-username and / etc/foo/my-group/my-password, respectively.

Secret used in Volume supports dynamic updates: after the Secret is updated, the data in the container is also updated.

Update password to abcdef,base64 Encoding to YWJjZGVm

In a few seconds, the new password will be synchronized to the container.

The above content is how to use Secret through volume. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Tags: Files methods data containers updates content that is skills file names knowledge paths configuration concise concise dynamic variables can be passed articles plaintext more Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia OPPO Reno Xiaomi Docker Huawei