Unable to verify the configuration in practice test at MULTI-CONTAINER PODS > PRACTICE TESTS – KUBERNETES CKAD – MULTI CONTAINER PODS

this is the question

Edit the pod to add a sidecar container to send logs to Elastic Search. Mount the log volume to the sidecar container.


Only add a new container. Do not modify anything else. Use the spec provided below.




Note: State persistence concepts are discussed in detail later in this course. For now please make use of the below documentation link for updating the concerning pod.



https://kubernetes.io/docs/tasks/access-application-cluster/communicate-containers-same-pod-shared-volume/
and I have this pod configuration 
apiVersion: v1
kind: Pod
metadata:
  annotations:
  labels:
    name: app
  name: app
  namespace: default
  resourceVersion: "2449"
  uid: 9fec909d-a53c-4c75-b4ea-b560462139b7
spec:
  containers:
  - image: kodekloud/filebeat-configured
    imagePullPolicy: Always
    name: sidecar
    resources: {}
    terminationMessagePath: /dev/termination-log
    terminationMessagePolicy: File
    volumeMounts:
    - mountPath: /var/log/event-simulator/
      name: log-volume
    - mountPath: /var/run/secrets/kubernetes.io/serviceaccount
      name: kube-api-access-prwh5
      readOnly: true
  - image: kodekloud/event-simulator
    imagePullPolicy: Always
    name: app
    resources: {}
    terminationMessagePath: /dev/termination-log
    terminationMessagePolicy: File
    volumeMounts:
    - mountPath: /log
      name: log-volume
    - mountPath: /var/run/secrets/kubernetes.io/serviceaccount
      name: kube-api-access-prwh5
      readOnly: true
  dnsPolicy: ClusterFirst
  enableServiceLinks: true
  nodeName: controlplane
  preemptionPolicy: PreemptLowerPriority
  priority: 0
  restartPolicy: Always
  schedulerName: default-scheduler
  securityContext: {}
  serviceAccount: default
  serviceAccountName: default
  terminationGracePeriodSeconds: 30
  tolerations:
  - effect: NoExecute
    key: node.kubernetes.io/not-ready
    operator: Exists
    tolerationSeconds: 300
  - effect: NoExecute
    key: node.kubernetes.io/unreachable
    operator: Exists
    tolerationSeconds: 300
  volumes:
  - hostPath:
      path: /var/log/webapp
      type: DirectoryOrCreate
    name: log-volume
  - name: kube-api-access-prwh5
    projected:
      defaultMode: 420
      sources:
      - serviceAccountToken:
          expirationSeconds: 3607
          path: token
      - configMap:
          items:
          - key: ca.crt
            path: ca.crt
          name: kube-root-ca.crt
      - downwardAPI:
          items:
          - fieldRef:
              apiVersion: v1
              fieldPath: metadata.namespace
            path: namespace

it says failed for sidecar but when I do describe I can see this config

It turns out that there are two pods called app in the cluster; you can see this if you do

k get pod -A | grep app

The example you’re working on is in namespace elastic-search, and not the pod in namespace default. This is why the grader is dinging you :slight_smile:

I’ve reported the duplicate pod issue before; hopefully we’ll make the lab a bit more clear so people don’t fall into this particular problem.