Daemonsets

- Refer Here
- Daemonset ensure a pod is schedule on every node (on subset of nodes)
- Daemonsets support rollingupdates
- Lets run a daemonset with alpine pod with sleep 1d
- Daemonset generally run agent kind of applications (log agent, sync agents)
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: example-1
spec:
minReadySeconds: 2
selector:
matchLabels:
app: logagent
template:
metadata:
labels:
app: logagent
spec:
containers:
- name: logagent
image: alpine:latest
command:
- sleep
- "3600s"
Jobs and Cron Jobs
Example
- Lets write a cron job which runs container for 20 seconds and should be repeated every minute
---
apiVersion: batch/v1
kind: CronJob
metadata:
name: example-1
spec:
schedule: '* * * * *'
jobTemplate:
spec:
template:
spec:
containers:
- name: hello
image: alpine:latest
args:
- sleep
- "10s"
restartPolicy: OnFailure
Namespace
- Namespaces act as virtual clusters
- names of resources have to be unique within namespaces
- in k8s we have resources which have two scpes
- cluster scope
- namespace scope
- The default namespace is
default
- We can use namespaces for environments or applications or any logical organization
Like this:
Like Loading...