hardkubectl

Create a secret with a specific key mapped to a file's contents

command

kubectl create secret generic SECRET_NAME --from-file KEY=FILE_PATH

also accepted

kubectl create secret generickubectl create secret generic SECRET_NAME --from-file

Command breakdown

Part of the Kubernetes CLI (kubectl) — ConfigMaps & Secrets category.

kubectlcreatesecretgenericSECRET_NAME--from-fileKEY=FILE_PATH
FlagPurpose
--from-fileBoolean flag

Test your recall — not just your reading.

Practice with interactive quiz →