How to: Secret <a name="secret"></a>
- Secret objects store the sensitive and secure information like username, password, ssh-tokens, certificates.     
- Secrets (that you defined) and pods (that you defined) should be in the same namespace (e.g. if defined secret is in the "default" namespace, pod should be also in the "default" namepace). 
- There are 8 different secret types (basic-auth, tls, ssh-auth, token, service-account-token, dockercfg, dockerconfigjson, opaque). Opaque type is the default one and mostly used.
- Secrets are called by the pod in 2 different ways: volume and environment variable   
- Imperative way, run on the terminal (geneneric in the command = opaque): 

```shell
kubectl create secret generic mysecret2 --from-literal=db_server=db.example.com --from-literal=db_username=admin --from-literal=db_password=P@ssw0rd!
```     
      
- Imperative way with file to hide pass in the command history
    
```shell
kubectl create secret generic mysecret3 --from-file=db_server=server.txt --from-file=db_username=username.txt --from-file=db_password=password.txt
``` 

- Imperative way with json file to hide pass in the command history

```shell
kubectl create secret generic mysecret4 --from-file=config.json
``` 
    
**Goto the Scenario:** [LAB: K8s Secret (Declarative and Imperative Way)](https://github.com/omerbsezer/Fast-Kubernetes/blob/main/K8s-Secret.md)