How to Create a Secret in Kubernetes
Secrets allow applications to not hardcode usernames
, passwords
or additional information such as hostnames
, IP addresses
or other protected/sensitive information.
Create a Secret in Kubernetes
It’s simple to create a secret in Kubernetes. It can either be done --from-file
or --from-literal
.
Option 1: From a File
The result will be something like:
|
|
By default, the key name is the filename, but we could also be explicit about this:
Option 2: From a Literal
We don’t have to create a file to create a secret, we can also create one on the fly:
The result will be something like:
|
|