Kubernetes CKA sample exam question 59 with answer

Question
Use namespace project-tiger for the following.
Create a DaemonSet named ds-important with image httpd:2.4-alpine and labels id=ds-important and uuid=465c63a2-7e3f-4bbf-91c1-e1c63acecc7f.
The pod it creates should request 10 milicore CPU and 10 mebibyte memory. The pod of that DaemonSet should run on all nodes, master and workers.

Answer
Go to Kubernetes documentation and grab manifest for DaemonSet. Adjust it as follows:

apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: ds-important
  namespace: project-tiger
  labels:
    id: ds-important
    uuid: 465c63a2-7e3f-4bbf-91c1-e1c63acecc7f
spec:
  selector:
    matchLabels:
      name: ds-important
  template:
    metadata:
      labels:
        name: ds-important
    spec:
      tolerations:
      # these tolerations are to have the daemonset runnable on control plane nodes
      # remove them if your control plane nodes should not run pods
      - key: node-role.kubernetes.io/control-plane
        operator: Exists
        effect: NoSchedule
      - key: node-role.kubernetes.io/master
        operator: Exists
        effect: NoSchedule
      containers:
      - name: ds-important
        image: httpd:2.4-alpine
        resources:
          requests:
            cpu: 10m
	    memory: 10Mi
Apply and verify:
kubectl get nodes
kubectl -n project-tiger get ds