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
- mountPath: /var/log/event-simulator/
Hello, @Sandip Divekar
We cannot add new fields if the pod is in running phase.
@Tej_Singh_Rana Are we suppose to delete and create new pod with 2 containers here ?
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
kubectl replace command, it may take some time to delete the pod.
$ kubectl replace -f pod.yaml --force
Thanks @Tej_Singh_Rana. Yes performed the similar steps as you have mentioned and its working now.