Certified Kubernetes Administrator (CKA) Practice Test

Session length

1 / 20

How is a Kubernetes secret created?

Using a YAML file with the secret details

Using the command kubectl create secret generic <secret-name> --from-literal=<key>=<value>

Creating a Kubernetes secret can be accomplished using the command line, specifically with the `kubectl` command. The method highlighted in the chosen answer involves using the command `kubectl create secret generic <secret-name> --from-literal=<key>=<value>`, which allows users to create a secret by providing a specific key-value pair directly in the command. This is particularly useful for quickly adding sensitive information that may need to be accessed by pods or other components within the cluster, like passwords, tokens, or SSH keys.

This approach offers an immediate and interactive way to create secrets without needing to manage YAML files or other configurations first. By using the command line, administrators can also easily incorporate this into scripts or automated processes, streamlining secret management.

In contrast, while a YAML file can be used to define a secret (the option that references a YAML file), this method is more structured and typically suited for deployments where configuration files are managed. Using a dashboard interface is less common for creating secrets, as command-line operations are generally preferred for the flexibility they provide. Lastly, Helm charts serve a different purpose, primarily focusing on application deployment, not specifically the creation of secrets. Thus, the command-line tool command is often the most straightforward and efficient method

Get further explanation with Examzify DeepDiveBeta

Using the dashboard interface

Using a Helm chart

Next Question
Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy