Hi Guys, what are we suppose to do in below question for multi-container test. I . . .

Sandip Divekar:
Hi Guys, what are we suppose to do in below question for multi-container test. I am editing pod definition using command: kubectl edit pod app --namespace=elastic-stack. But getting below error,

pods "app" was not valid
* spec.containers: Forbidden: pod updates may not add or remove containers

New container definition:
  - image: kodekloud/filebeat-configured
    name: sidecar
    volumeMounts:
    - mountPath: /var/log/event-simulator/
      name: log-volume

Tej_Singh_Rana:
Hello, @Sandip Divekar
We cannot add new fields if the pod is in running phase.

Sandip Divekar:
@Tej_Singh_Rana Are we suppose to delete and create new pod with 2 containers here ?

Tej_Singh_Rana:
Yeah, extract into the new file.

$ kubectl get po pod-name -oyaml > pod.yaml

Add new container’s spec.
It will delete the pod without any confirmation.

$ kubectl delete po pod-name --force

or
In the kubectl replace command, it may take some time to delete the pod.

$ kubectl replace -f pod.yaml --force

Sandip Divekar:
Thanks @Tej_Singh_Rana. Yes performed the similar steps as you have mentioned and its working now.