{"id":1975,"date":"2025-03-13T16:51:59","date_gmt":"2025-03-13T08:51:59","guid":{"rendered":"https:\/\/www.fanyamin.com\/wordpress\/?p=1975"},"modified":"2025-03-13T16:51:59","modified_gmt":"2025-03-13T08:51:59","slug":"kubernetes-secret","status":"publish","type":"post","link":"https:\/\/www.fanyamin.com\/wordpress\/?p=1975","title":{"rendered":"Kubernetes Secret"},"content":{"rendered":"<p>A Kubernetes Secret is an API object used to store sensitive information (like passwords, tokens, keys, or certificates) separately from application code. This helps keep such data secure and manageable. Yes, you can mount a Secret as a volume in a pod. When mounted as a volume, each key in the Secret becomes a file in the specified directory, with its contents being the decoded (plain text) secret data.<\/p>\n<p>For example, if you have a Secret named \u201cmy-secret\u201d with a key called \u201cpassword,\u201d you can mount it in a pod like this:<\/p>\n<pre><code class=\"language-yaml\">apiVersion: v1\nkind: Pod\nmetadata:\n  name: secret-volume-pod\nspec:\n  containers:\n  - name: my-container\n    image: busybox\n    command: [&quot;cat&quot;, &quot;\/etc\/secret\/password&quot;]\n    volumeMounts:\n    - name: secret-volume\n      mountPath: \/etc\/secret\n      readOnly: true\n  volumes:\n  - name: secret-volume\n    secret:\n      secretName: my-secret<\/code><\/pre>\n<p>In this setup, the file <code>\/etc\/secret\/password<\/code> will contain the secret\u2019s decoded data. This approach lets you securely provide secrets to your applications without embedding them in images or pod specs directly.<\/p>\n<hr \/>\n<p>By default, Kubernetes stores Secrets unencrypted in etcd (they\u2019re only base64\u2010encoded, which isn\u2019t real encryption). However, you can configure the API server to encrypt Secrets at rest for added security. In addition, Kubernetes uses RBAC and namespace isolation to control access, so only authorized users and pods can read or modify a Secret. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>A Kubernetes Secret is an API object used to store sensitive information (like passwords, tokens, keys, or certificates) separately from application code. This helps keep such data secure and manageable. Yes, you can mount a Secret as a volume in a pod. When mounted as a volume, each key in the Secret becomes a file [&hellip;] <a class=\"read-more\" href=\"https:\/\/www.fanyamin.com\/wordpress\/?p=1975\" title=\"Permanent Link to: Kubernetes Secret\">&rarr;Read&nbsp;more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-1975","post","type-post","status-publish","format-standard","hentry","category-5"],"_links":{"self":[{"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1975"}],"collection":[{"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1975"}],"version-history":[{"count":1,"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1975\/revisions"}],"predecessor-version":[{"id":1976,"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1975\/revisions\/1976"}],"wp:attachment":[{"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1975"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1975"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1975"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}