Debug School

Nagendra
Nagendra

Posted on

Deamon Sets, Jobs , Cron Jobs

DeamonSets :
This deamon sets creates only one POD in all the nodes not more than that Which was managed by the deamon controller (Here controller make sure all the nodes contains one pod of it)

We can create deaomnsets using the yaml file like below (kind: DaemonSet)

apiVersion: apps/v1
kind: DaemonSet
metadata:
name: logging
spec:
selector:
matchLabels:
app: httpd-logging
template:
metadata:
labels:
app: httpd-logging
spec:
containers:
- name: webserver
image: httpd
ports:
- containerPort: 80
In the same we can descibes , edit , delete the deamset resources
LIke we can list

kubectl get ds (ds is a shortname of deamon sets)

JOBS/ CronJobs :
JObs is a resources which used only to run do the task and done with that POD

CronJobs : This one scheduling that POD every 1 hour u execute the container like that.

kubectl get jobs
2030 kubectl get pods
2031 kubectl apply -f job.yaml
2032 kubectl get pods
2033 clear
2034 kubectl describe job pi
2035 clear
2036 vi cron.yaml
2037 kubectl apply -f cron.yaml
2038 kubectl get cronjobs
2039 kubectl get pods
2040 clear
2041 kubectl get cronjobs
2042 kubectl get pods
2043 kubectl get cronjobs
2044 kubectl describe cronjob hello

Config Map:

This config map which stores in the k8s cluster whcih is in the format of key-value pair (Which can be accessible by all in the cluster)

If we want this in pod please attach to the POD and mount to the container then we can use that key-value inside the container

Commands : ls
2055 vi reverseproxy.conf
2056 kubectl create configmap my-config --from-file=reverseproxy.conf
2057 kubectl get cm
2058 kubectl describe cm my-config
2059 clear
2060 ls
2061 vi cm.yaml
2062 kubectl apply -f cm.yaml
2063 kubectl get pods
2064 history
2065 kubectl exec helloworld-nginx ls /etc/nginx/conf.d
2066 kubectl exec helloworld-nginx more /etc/nginx/conf.d/myconfo.conf
2067 history

Top comments (0)