diff --git a/2023.md b/2023.md index 1ce6ed3..da88268 100644 --- a/2023.md +++ b/2023.md @@ -90,7 +90,7 @@ Or contact us via Twitter, my handle is [@MichaelCade1](https://twitter.com/Mich - [✔️] 🕵 36 > [Securing Secrets with HashiCorp Vault](2023/day36.md) - [✔️] 🕵 37 > [Working with HashiCorp Vault's Secrets Engines](2023/day37.md) - [✔️] 🕵 38 > [Increase the Security Posture of Your Organization with Dynamic Credentials](2023/day38.md) -- [] 🕵 39 > [](2023/day39.md) +- [✔️] 🕵 39 > [Getting Hands-On with HashiCorp Vault](2023/day39.md) - [] 🕵 40 > [](2023/day40.md) - [] 🕵 41 > [](2023/day41.md) diff --git a/2023/day39.md b/2023/day39.md index b71098c..204e032 100644 --- a/2023/day39.md +++ b/2023/day39.md @@ -136,17 +136,35 @@ We must now exec into our vault-0 pod to enable the secret engine. `vault secrets enable -path=secret kv-v2` +## Creating a new secret for our app -`vault kv put secret/devwebapp/config username='giraffe' password='salsa'` +As a simple test we want to create an application in its own namespace within our Kubernetes cluster to then communicate with vault in its own namespace. + +This is one thing that is not defined in the tutorial linked, and I wanted to provide a bit more real life use case because yes the default namespace can be used but that doesn't mean it should be. + +`vault kv put secret/devwebapp/config username='90DaysOfDevOps' password='90DaysOfDevOps'` + +We can confirm what we have just created with the following command: `vault kv get secret/devwebapp/config` +You can see the above commands ran in my terminal below. + +![](images/day39-8.png) + +Next we need to enable the Kubernetes authentication method. + `vault auth enable kubernetes` +Configure the Kubernetes authentication method to use the location of the Kubernetes API. + ``` vault write auth/kubernetes/config \ kubernetes_host="https://$KUBERNETES_PORT_443_TCP_ADDR:443" ``` + +We can now create our policy named devwebapp that enables the read capability for secrets at path secret/data/devwebapp/config + ``` vault policy write devwebapp - < devwebapp.yaml <