# Which command would you use to create a secret from a file?

Kubernetes, Medium (Advanced), Commands. https://k8wiz.com/uquiz/which-command-would-you-use-to-create-a-secret-from-a-file

- A. kubectl create secret generic my-secret --from-file=path/to/file
- B. kubectl apply secret my-secret --file=path/to/file
- C. kubectl secret create my-secret --from-file=path/to/file
- D. kubectl generate secret my-secret --file=path/to/file

**Answer:** kubectl create secret generic my-secret --from-file=path/to/file

**Explanation:** The 'kubectl create secret generic my-secret --from-file=path/to/file' command creates a secret from the contents of a file. This is useful for storing configuration files, certificates, or other sensitive data that needs to be accessed by pods.
