0
0
Kubernetesdevops~10 mins

DaemonSets for per-node workloads in Kubernetes - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to specify the kind of Kubernetes object for a DaemonSet.

Kubernetes
apiVersion: apps/v1
kind: [1]
metadata:
  name: node-logger
spec:
  selector:
    matchLabels:
      name: node-logger
  template:
    metadata:
      labels:
        name: node-logger
    spec:
      containers:
      - name: logger
        image: busybox
        command: ['sh', '-c', 'echo Logging from node; sleep 3600']
Drag options to blanks, or click blank then click option'
ADaemonSet
BDeployment
CService
DPod
Attempts:
3 left
💡 Hint
Common Mistakes
Using Deployment instead of DaemonSet
Using Pod directly without a controller
2fill in blank
medium

Complete the code to select pods with the correct label for the DaemonSet.

Kubernetes
spec:
  selector:
    matchLabels:
      name: [1]
  template:
    metadata:
      labels:
        name: node-logger
Drag options to blanks, or click blank then click option'
Aweb-server
Bnode-logger
Cdatabase
Dcache
Attempts:
3 left
💡 Hint
Common Mistakes
Mismatch between selector and pod labels
Using unrelated labels
3fill in blank
hard

Fix the error in the container command to keep the pod running.

Kubernetes
containers:
- name: logger
  image: busybox
  command: ['sh', '-c', [1]]
Drag options to blanks, or click blank then click option'
A"echo Logging from node; sleep 3600"
B"echo Logging from node"
C"sleep 10"
D"exit 0"
Attempts:
3 left
💡 Hint
Common Mistakes
Using only echo causes the container to exit
Using too short sleep time
4fill in blank
hard

Fill both blanks to specify the container image and the restart policy for the DaemonSet pods.

Kubernetes
spec:
  template:
    spec:
      containers:
      - name: logger
        image: [1]
      restartPolicy: [2]
Drag options to blanks, or click blank then click option'
Abusybox
BAlways
CNever
Dnginx
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong image name
Using restartPolicy other than Always
5fill in blank
hard

Fill all three blanks to create a DaemonSet that runs a pod with label 'app: monitor', image 'alpine', and command to sleep indefinitely.

Kubernetes
apiVersion: apps/v1
kind: [1]
metadata:
  name: monitor
spec:
  selector:
    matchLabels:
      app: [2]
  template:
    metadata:
      labels:
        app: monitor
    spec:
      containers:
      - name: monitor
        image: [3]
        command: ['sh', '-c', 'sleep infinity']
Drag options to blanks, or click blank then click option'
ADaemonSet
Bmonitor
Calpine
DDeployment
Attempts:
3 left
💡 Hint
Common Mistakes
Using Deployment instead of DaemonSet
Mismatch between selector and pod labels
Wrong container image