Course contentsShow
← Cloud and Infrastructure
Lesson 1260 of 2,98925. Kubernetes Configuration and SecretsFree lesson

Kubernetes Secrets Overview

Understand what Secrets are, how they differ from ConfigMaps, and when to use them for sensitive data.

Kubernetes Secrets Overview

What you'll learn: You'll understand what Kubernetes Secrets are, how they differ from ConfigMaps, and when to use them for sensitive information.

What Are Secrets?

Secrets are Kubernetes objects designed specifically to hold sensitive data like passwords, API keys, tokens, SSH keys, and certificates. While ConfigMaps store general configuration data that's safe to see, Secrets handle information you want to keep confidential.

Think of ConfigMaps as sticky notes on your desk—anyone can read them. Secrets are like notes in a locked drawer—still accessible when needed, but with an extra layer of protection signaling "handle with care."

Secrets vs ConfigMaps

Both Secrets and ConfigMaps store key-value pairs and inject data into Pods, but they serve different purposes:

  • ConfigMaps: Application settings, feature flags, non-sensitive configuration files
  • Secrets: Passwords, OAuth tokens, TLS certificates, database credentials

Kubernetes treats Secrets differently: they're base64-encoded (not encrypted by default, but obfuscated), stored separately in etcd, and have specialized access controls to limit who can view them.

When to Use Secrets

Use Secrets whenever your application needs:

  • Database connection strings with passwords
  • API keys for third-party services
  • TLS certificates for HTTPS endpoints
  • SSH keys for git operations
  • Registry credentials for pulling private images

Just like you learned with ConfigMaps, you'll inject Secrets into Pods as environment variables or mounted volumes—but with the understanding that this data requires careful handling.

Key Takeaway: Secrets are Kubernetes' built-in way to manage sensitive data separately from ConfigMaps, providing a foundation for secure credential management in your cluster while using similar consumption patterns you already know.