Fixing Kubernetes error: unable to find api field in struct Container for the json field imagePullSecrets

October 15, 2023

Recently when deploying a new Kubernetes service I ran into this error...

 unable to find api field in struct Container for the json field "imagePullSecrets"

Nothing I could find online described what the issue was and it took a few days to realize the answer was simple.

I had put the imagePullSecrets inside the containers spec definition in the deployment. Instead it needs to be at the same level, directly inside the spec.

Once I moved the imagePullSecrets block up, everything started working again.

Monitor your DNS Zones with ZoneWatcher

Be alerted of DNS record changes moments after they happen, not from upset customers.

ZoneWatcher screenshot