Search⌘ K

Creating Generic Secrets

Explore how to create generic Kubernetes Secrets using literals, files, and environment variables. Understand the encoding and decoding of secret data, and practice retrieving stored credentials securely within your cluster.

Creating Secrets

The commands to create Secrets are almost the same as those we used to create ConfigMaps. For example, we can generate Secrets based on literal values.

Shell
kubectl create secret \
generic my-creds \
--from-literal=username=jdoe \
--from-literal=password=incognito

Note: The major difference is that we specified the type of the Secret as generic.

It could also be docker-registry or tls. We won’t explore those two. However, please note that the former can be used to provide ...