I am struggling with Multi-Container PODs in the Labs - the check says: ``` ok . . .

Lemig:
I am struggling with Multi-Container PODs in the Labs - the check says:

 ok    Name: app
 bad   Container Name: sidecar
 bad   Container Image: kodekloud/filebeat-configured
 bad   Volume Mount: log-volume
 bad   Mount Path: /var/log/event-simulator/
 ok    Existing Container Name: app
 ok    Existing Container Image: kodekloud/event-simulator 

The manifest:

apiVersion: v1
kind: Pod
metadata:
  creationTimestamp: "2021-08-14T04:50:26Z"
  labels:
    name: app
  name: app
  namespace: default
  resourceVersion: "1104"
  uid: b89b8e84-e5b7-4360-a112-abe6f7c2040a
spec:
  containers:
  - image: kodekloud/filebeat-configured
    imagePullPolicy: Always
    name: sidecar
    volumeMounts:
    - mountPath: /var/log/event-simulator
      name: log-volume
  - 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: default-token-k7j58
      readOnly: true
  dnsPolicy: ClusterFirst

I am not sure what is wrong with it :thinking_face:

1 Like

Augusto:
Where is log-volume declared?

Augusto:
I mean, this part:

volumes:

Augusto:

volumes:
- name: log-volume
  emptyDir: {}

Kennedy Sanchez:
Look that Name: log-volume space at the left. That line was added and broke the yaml format.

I am using the following yaml but still not able to fix this:

apiVersion: v1
kind: Pod
metadata:
name: app
namespace: elastic-stack
labels:
name: app
spec:
containers:

  • name: app
    image: kodekloud/event-simulator
    volumeMounts:
    • mountPath: /log
      name: log-volume
  • name: sidecar
    image: kodekloud/filebeat-configured
    volumeMounts:
    • mountPath: /var/log/event-simulator/
      name: log-volume
      volumes:
  • name: log-volume
    hostPath:

    directory location on host

    path: /var/log/webapp

    this field is optional

    type: DirectoryOrCreate

Ok i figured out - I was not looking at right namespace (Resolved)
kubectl get pod -n elastic-stack