k8wiz
Kubernetes
Medium
Commands

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

Select your answer:

Show answer and explanation

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.

Read more about Kubernetes