# Configuration, Secrets, Storage and RBAC

> Inject configuration and secrets into pods, attach persistent storage, and control who can do what in the cluster. Free notes, key concepts, resources and a...

Canonical: https://www.internhack.in/roadmaps/tracks/devops/k8s-config-storage
Last updated: 2026-11-28

Inject configuration and secrets into pods, attach persistent storage, and control who can do what in the cluster.

Intermediate · about 8 hours · difficulty 3/5

Learn first: [Workloads, Probes and Autoscaling](https://www.internhack.in/roadmaps/tracks/devops/k8s-workloads)

Twelve-factor apps read config from the environment, and Kubernetes gives you native objects for that, plus storage and access control.

### Config and secrets

- **ConfigMaps** hold non-sensitive config, mounted as files or env vars.
- **Secrets** hold sensitive values but are only **base64-encoded**, not encrypted, by default. Enable encryption at rest for etcd, restrict access with RBAC, and consider External Secrets Operator or a CSI driver to sync from Vault or a cloud secret manager.
- Changing a ConfigMap does not restart pods using env vars; use a checksum annotation or a reloader.

### Storage

- **PersistentVolumeClaims** request storage; **StorageClasses** provision it dynamically (EBS, Persistent Disk, Azure Disk) via **CSI drivers**.
- Access modes (ReadWriteOnce vs ReadWriteMany) and reclaim policies (Delete vs Retain).
- Running databases in Kubernetes is possible with operators, but managed databases are often simpler.

### Access control

- **RBAC**: Roles/ClusterRoles define verbs on resources; RoleBindings grant them to users, groups or **ServiceAccounts**.
- Give each workload its own ServiceAccount, and map it to cloud IAM (IRSA / EKS Pod Identity, GKE Workload Identity) instead of static keys.
- **Pod Security Standards** (restricted, baseline) and admission policies (Kyverno, Gatekeeper) enforce safe defaults.

**Good enough to move on:** you can run an app with config, a secret from an external store, a persistent volume, and a least-privilege ServiceAccount.

## Key concepts

- **ConfigMaps**
- **Secrets and their limits**
- **External Secrets Operator**
- **PV, PVC and StorageClasses**
- **CSI drivers**
- **RBAC and ServiceAccounts**
- **Workload identity to cloud IAM**
- **Pod Security Standards**
- **Kyverno / Gatekeeper policies**

## Mini project

Deploy an app that reads a ConfigMap and a Secret, stores uploads on a PVC, and runs with a ServiceAccount that can only read its own ConfigMap; prove with kubectl auth can-i that it cannot list secrets.

## Check yourself

If Kubernetes Secrets are only base64-encoded, what actually protects them, and what would you add?

## Free resources

- [Kubernetes configuration](https://kubernetes.io/docs/concepts/configuration/) (kubernetes.io)
- [Kubernetes storage](https://kubernetes.io/docs/concepts/storage/) (kubernetes.io)
- [Using RBAC authorization](https://kubernetes.io/docs/reference/access-authn-authz/rbac/) (kubernetes.io)

Previous: [Services, Ingress and Network Policy](https://www.internhack.in/roadmaps/tracks/devops/k8s-networking) · Next: [Packaging with Helm and Kustomize](https://www.internhack.in/roadmaps/tracks/devops/helm)

## More in Orchestrating Containers with Kubernetes

- [Kubernetes Architecture and kubectl](https://www.internhack.in/roadmaps/tracks/devops/kubernetes-architecture)
- [Workloads, Probes and Autoscaling](https://www.internhack.in/roadmaps/tracks/devops/k8s-workloads)
- [Services, Ingress and Network Policy](https://www.internhack.in/roadmaps/tracks/devops/k8s-networking)
- [Configuration, Secrets, Storage and RBAC](https://www.internhack.in/roadmaps/tracks/devops/k8s-config-storage)
- [Packaging with Helm and Kustomize](https://www.internhack.in/roadmaps/tracks/devops/helm)
- [Operators and Custom Resources](https://www.internhack.in/roadmaps/tracks/devops/k8s-operators)
- [Service Mesh](https://www.internhack.in/roadmaps/tracks/devops/service-mesh)
- [Beyond Kubernetes: Nomad and ECS](https://www.internhack.in/roadmaps/tracks/devops/nomad-ecs)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [DevOps Engineer Roadmap](https://www.internhack.in/roadmaps/tracks/devops)
