Hello, Everytime I create multi container pod, I get below error. Can someone pl . . .

snehal Naphad:
Hello, Everytime I create multi container pod, I get below error. Can someone please help. I used --dry-run=client -o yaml to generate yaml for pod for single container , then edited for adding 2nd image.
controlplane $ cat multi.yaml
apiVersion: v1
kind: Pod
metadata:
name: multia
spec:
containers:

  • name: nginx
    image: nginx
  • name: redis
    image: redis
    controlplane kubectl create -f multi.yaml pod/multia created controlplane kubectl logs multia -f
    error: a container name must be specified for pod multia, choose one of: [nginx redis]
    controlplane $

Samuel Begin:
your pod has 2 containers. you must tell kubectl which container you want to see the logs of.

Samuel Begin:
when your pod has a single container, it only has one to choose from, so it dosent ask you

Samuel Begin:
kubectl logs multia -c nginx -f
or
kubectl logs multia -c redis -f
will yield what you want

snehal Naphad:
Main issue I am getting is, pod doesnt get created successfully.

Samuel Begin:
then your question is unclear, or more info is required to understand your context

snehal Naphad:
unfortunately I lost environment on which i was trying… will update again if I face issue.

snehal Naphad:
thanks, issue was with busybox container…tried redis image which worked.