0
0
Kubernetesdevops~10 mins

Container logging architecture 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 logging driver for a Docker container.

Kubernetes
docker run --log-driver=[1] nginx
Drag options to blanks, or click blank then click option'
Ajson-file
Bsyslog
Cnone
Djournald
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a logging driver that disables logging like 'none'.
Using a system logging driver when the default is expected.
2fill in blank
medium

Complete the command to view logs of a Kubernetes pod named 'webapp'.

Kubernetes
kubectl logs [1]
Drag options to blanks, or click blank then click option'
Adeployment/webapp
Bpod/webapp
Cservice/webapp
Dnode/webapp
Attempts:
3 left
💡 Hint
Common Mistakes
Using deployment or service names instead of pod names.
Trying to get logs from nodes directly.
3fill in blank
hard

Fix the error in the Fluentd configuration snippet to collect container logs from the correct path.

Kubernetes
<source>
  @type tail
  path [1]
  pos_file /var/log/fluentd-containers.log.pos
  tag kubernetes.*
  format json
</source>
Drag options to blanks, or click blank then click option'
A/var/log/syslog
B/var/log/pods/*.log
C/var/log/docker/*.log
D/var/log/containers/*.log
Attempts:
3 left
💡 Hint
Common Mistakes
Using pod log paths instead of container log paths.
Using system log paths like syslog.
4fill in blank
hard

Fill both blanks to create a Kubernetes DaemonSet manifest snippet that deploys a logging agent on all nodes.

Kubernetes
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: fluentd
spec:
  selector:
    matchLabels:
      name: fluentd
  template:
    metadata:
      labels:
        name: fluentd
    spec:
      containers:
      - name: fluentd
        image: fluentd:latest
        volumeMounts:
        - name: varlog
          mountPath: [1]
      volumes:
      - name: varlog
        hostPath:
          path: [2]
Drag options to blanks, or click blank then click option'
A/var/log/containers
B/var/log/pods
C/var/log
D/var/lib/docker/containers
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up container mount path and host path.
Using pod log paths instead of container log paths.
5fill in blank
hard

Fill all three blanks to define a Kubernetes ConfigMap for Fluentd with a filter to add Kubernetes metadata.

Kubernetes
apiVersion: v1
kind: ConfigMap
metadata:
  name: fluentd-config
data:
  fluent.conf: |
    <filter kubernetes.**>
      @type [1]
      kubernetes_url [2]
      cache_size [3]
    </filter>
Drag options to blanks, or click blank then click option'
Akubernetes_metadata
Bhttps://kubernetes.default.svc
C1000
Drecord_transformer
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong filter types like record_transformer.
Incorrect Kubernetes API URL.
Setting cache_size to a non-numeric value.