Course contentsShow
← Cloud and Infrastructure
Lesson 2272 of 2,98948. Secrets ManagementFree lesson

Kubernetes Secrets Overview

Understand Kubernetes native Secrets resource, how they're stored, and basic usage patterns for pods.

Kubernetes Secrets Overview

What you'll learn: How Kubernetes natively stores and delivers sensitive data to pods using the built-in Secrets resource.

What Are Kubernetes Secrets?

Kubernetes Secrets are a built-in resource type designed to hold sensitive information like passwords, tokens, or keys. Unlike ConfigMaps (which handle general configuration), Secrets are intended specifically for confidential data. Think of them as secure envelopes that Kubernetes distributes to your pods—only the containers that need access can open them.

How Secrets Are Stored

By default, Secrets are stored in etcd (Kubernetes' backing database) base64-encoded, not encrypted. This means they're obfuscated but not truly secure at rest unless you enable encryption-at-rest in your cluster configuration. It's like storing a document in a locked filing cabinet versus a safe—basic protection, but not Fort Knox.

Secrets are namespaced, meaning they only exist within a specific namespace and can't be accessed across boundaries without explicit setup.

Basic Usage Patterns for Pods

Pods consume Secrets in two primary ways:

  1. Environment variables: The Secret's key-value pairs become environment variables in your container—similar to what you learned in "Environment Variables for Secrets," but now Kubernetes manages the injection.

  2. Volume mounts: Secrets can be mounted as files in a volume path—just like "Volume-Mounted Secrets," where each key becomes a file and its value becomes the file content.

You reference Secrets in your pod specification, and Kubernetes handles fetching and injecting them at runtime. Pods automatically receive updates when Secrets change (for volume mounts), but environment variables remain static.

Key Takeaway:
Kubernetes Secrets provide a native way to store and deliver sensitive data to pods via environment variables or mounted volumes, but they're only base64-encoded in etcd by default—not encrypted—requiring additional cluster configuration for true security at rest.