<p>I am wondering if it is possible to store a key-value pair in Secret.yml. 
I want to be able to store an encryption key as a value and an id as its key which I can use to retrieve the encryption key stored in Secret.yml. </p>

<p>Is such functionality available with Kubernetes?</p>

<p><strong>EDIT</strong>
I should have said in my original message, I want to be able to store multiple pairs and add pairs during the lifespan of my application and use different encryption key on the fly without/minimal update to my application.</p>

<p>Yes, <a href="https://kubernetes.io/docs/concepts/configuration/secret/" rel="nofollow noreferrer">secrets</a> are key value pairs. You can create them using kubectl:</p>

<pre><code>kubectl create secret the-secret-name --from-literal=KEY=VALUE
</code></pre>

<p>Then, you can look at / edit the yaml specification via</p>

<pre><code>#get
kubectl get secret the-secret-name -o yaml
#edit
kubectl edit secret the-secret-name
</code></pre>

<p>A secret looks like this:</p>

<pre><code>apiVersion: v1
kind: Secret
metadata:
  name: the-secret-name
type: Opaque
data:
   # the value is base64 encoded
   KEY: VkFMVUUK
</code></pre>

<p>Most of the time, it's better to use two key value pairs in your situation though. The reason for this is that it's more complicated/expensive to look for a key with an unknown name than to lookup a value under a key.</p>
