Workloads: Deployment, StatefulSet, and DaemonSet
Configure Deployment, StatefulSet, and DaemonSet in ohMyHelm Chart mode, including flag logic, update strategies, volumes, and headless services.
Workloads: Deployment, StatefulSet, and DaemonSet
In Chart mode (chart.enabled: true), ohMyHelm creates either a Deployment, a StatefulSet, or a DaemonSet. Each workload type has its own volume block and matching rollout options.
Exact Flag Logic in the Chart
The three boolean switches chart.deployment (default: true), chart.statefulset (default: false), and chart.daemonset (default: false) determine which template is rendered:
deployment |
statefulset |
daemonset |
Generated Workload |
|---|---|---|---|
true (default) |
false |
false |
Deployment |
false (or true) |
true |
false |
StatefulSet |
false (or true) |
false |
true |
DaemonSet |
| any | true |
true |
No workload (0 resources!) |
false |
false |
false |
No workload (0 resources!) |
1. Deployment (Default)
Use Deployment for stateless applications such as web servers, APIs, or queue workers. Volumes are configured under chart.deploymentVolume, and the rollout strategy under chart.strategy.
chart:
enabled: true
deployment: true
statefulset: false
daemonset: false
fullnameOverride: "acme-api"
replicaCount: 3
minReadySeconds: 10
revisionHistoryLimit: 5
progressDeadlineSeconds: 300
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
container:
image: registry.acme.corp/api:1.3.0
ports:
- name: http
containerPort: 8080
protocol: TCP
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi
deploymentVolume:
volumeMounts:
- name: config
mountPath: /etc/acme/config.yaml
subPath: config.yaml
readOnly: true
- name: tmp
mountPath: /tmp
volumes:
- name: config
configMap:
name: acme-api-config
- name: tmp
emptyDir: {}
2. StatefulSet
Use StatefulSet for stateful services (databases, brokers, persistent caches) that require stable Pod names and dedicated Persistent Volume Claims (PVCs) per Pod.
- The template automatically sets
spec.serviceName: <ohmyhelm.fullname>— matching theServicegenerated by ohMyHelm. - For per-Pod DNS (
<pod-0>.<service>.<ns>.svc.cluster.local), setchart.service.clusterIP: "None"(headless service). - Volumes, mounts, and
volumeClaimTemplatesbelong underchart.statefulsetVolume. - Configure the update strategy under
chart.updateStrategy(notchart.strategy).
chart:
enabled: true
deployment: false
statefulset: true
daemonset: false
fullnameOverride: "acme-db"
replicaCount: 1
minReadySeconds: 10
revisionHistoryLimit: 5
updateStrategy:
type: RollingUpdate
rollingUpdate:
partition: 0
container:
image: postgres:16-alpine
ports:
- name: postgres
containerPort: 5432
protocol: TCP
resources:
requests:
cpu: 250m
memory: 512Mi
limits:
cpu: 1000m
memory: 1Gi
service:
type: ClusterIP
clusterIP: None
ports:
- name: postgres
port: 5432
targetPort: postgres
protocol: TCP
statefulsetVolume:
volumeMounts:
- name: data
mountPath: /var/lib/postgresql/data
- name: init-config
mountPath: /etc/postgresql/conf.d
readOnly: true
volumes:
- name: init-config
configMap:
name: acme-db-config
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
3. DaemonSet
Use DaemonSet when exactly one Pod instance should run on every (or every matching) Kubernetes node — for example, for node monitoring, log collection, or network agents.
chart.replicaCountis ignored for aDaemonSet.- Optionally enable
chart.hostNetwork: true(applies to all three workload types). - Configure volumes and mounts under
chart.daemonsetVolume. - Set the update strategy under
chart.updateStrategy.
chart:
enabled: true
deployment: false
statefulset: false
daemonset: true
hostNetwork: false
fullnameOverride: "acme-node-agent"
minReadySeconds: 5
revisionHistoryLimit: 5
updateStrategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 1
tolerations:
- operator: Exists
container:
image: registry.acme.corp/node-agent:1.0.0
ports:
- name: metrics
containerPort: 9100
protocol: TCP
resources:
requests:
cpu: 50m
memory: 64Mi
limits:
cpu: 200m
memory: 256Mi
daemonsetVolume:
volumeMounts:
- name: varlog
mountPath: /var/log
readOnly: true
volumes:
- name: varlog
hostPath:
path: /var/log
type: Directory
service:
type: ClusterIP
ports:
- name: metrics
port: 9100
targetPort: metrics
protocol: TCP
Comparison of Volume and Strategy Keys
| Option | Deployment | StatefulSet | DaemonSet |
|---|---|---|---|
| Volume block | chart.deploymentVolume |
chart.statefulsetVolume |
chart.daemonsetVolume |
volumeClaimTemplates |
No | Yes | No |
| Rollout strategy | chart.strategy |
chart.updateStrategy |
chart.updateStrategy |
replicaCount |
Yes | Yes | No |
progressDeadlineSeconds |
Yes | No | No |
minReadySeconds / revisionHistoryLimit |
Yes | Yes | Yes |
Scheduling Options for All Workloads
All three workload types also support chart.nodeSelector, chart.tolerations, and chart.affinity using the standard Kubernetes specification:
chart:
enabled: true
nodeSelector:
workload: general
tolerations:
- key: "dedicated"
operator: "Equal"
value: "apps"
effect: "NoSchedule"
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- acme-api
topologyKey: kubernetes.io/hostname
Related Pages
- Chart Mode Overview
- Sidecar Container — Shared volumes via
useContainerVolume - Labels and Naming