I have this manifest
apiVersion: apps/v1
kind: Deployment
metadata:
name: cert-manager
namespace: "cert-manager"
spec:
template:
spec:
containers:
nodeSelector:
app.myapp.com/environment: system
When I try to apply with kubectl
I get this error:
error: wrong Node Kind for expected: SequenceNode was MappingNode: value: {nodeSelector: app.myapp.com/environment: system}
What can be?
CodePudding user response:
As mentioned by @mdaniel, a container is an array, you have to mention the field name preceding with “-” inside a container. Here in your use case, removing the leading ”-” from nodeSelector: has turned the container from an array member into a dict. So, you will need to mention “-” to the nodeSelector field.
Refer to the Deployments for more information on how to define containers.