← Back to list

spec vs data vs binaryData

FieldUsed ForExamplespecDescribes the desired state/behavior of a Kubernetes resourcePod containers, Deployment replicasdataStores text…

yuresh Gurung · 2026-06-16 12:03 · 0 claps · 0.5 min read
#k8s #kubernetes-configmap #data #env
Open on Medium ↗
Wiki topics: TLS · Design Tools & Workflow ☁️ · DevOps & Cloud

spec vs data vs binaryData

FieldUsed ForExamplespecDescribes the desired state/behavior of a Kubernetes resourcePod containers, Deployment replicasdataStores text configuration valuesDB_HOST, APP_MODEbinaryDataStores binary content (Base64 encoded)Certificates, images, binary files

spec Example (Deployment)

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nginx

Here, spec tells Kubernetes how the Deployment should run.

data Example (ConfigMap)

apiVersion: v1
kind: ConfigMap
metadata:
  name: app-config
data:
  DB_HOST: mysql-service
  APP_MODE: production

Here, data stores configuration values.

binaryData Example (ConfigMap)

apiVersion: v1
kind: ConfigMap
metadata:
  name: cert-config
binaryData:
  cert.p12: MIIK...

Here, binaryData stores Base64-encoded binary content.

One-Line Difference

spec       = What Kubernetes should do/run
data       = Text configuration
binaryData = Binary configuration (Base64 encoded)

CKAD Memory Trick

Deployment/Pod/Service
        ↓
       spec
 (desired state)
ConfigMap
        ↓
 data / binaryData
 (configuration values)

ConfigMaps do not have a spec section; they use data and optionally binaryData instead.


메타데이터
post_id
fa92a3b76b4b
slug
spec-vs-data-vs-binarydata-fa92a3b76b4b
url
https://medium.com/@ygce108/spec-vs-data-vs-binarydata-fa92a3b76b4b
canonical_url
https://medium.com/@ygce108/spec-vs-data-vs-binarydata-fa92a3b76b4b
author_url
https://medium.com/@ygce108
status
ok
fetched_at
2026-06-21 07:44:09