Any idea of the error reason - Just using config map root@controlplane:~# k appl . . .

Rahul:
Any idea of the error reason - Just using config map
root@controlplane:~# k apply -f po.yaml
The Pod “nginx” is invalid: spec.initContainers: Forbidden: pod updates may not add or remove containers

apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
run: nginx
name: nginx
spec:
containers:

  • image: nginx
    name: nginx
    env:
    • name: option
      valueFrom:
      configMapKeyRef:
      name: options
      key: var5
      resources: {}
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      status: {}

Dusty:
Does the pod already exist? If so I think you will need to delete and then re-create it to add a configmap to the pod.

Rahul:
No , pod does not exist : |