Reputation: 1
Error from server (BadRequest): error when creating "replicaset.yml": ReplicaSet in version "v1" cannot be handled as a ReplicaSet: strict decoding error: unknown field "spec.template.metadata:"
Here is the my yaml file.
apiVersion: apps/v1
kind: ReplicaSet
metadata:
name: myapp-replicaset
labels:
app: myapp
spec:
selector:
matchLabels:
app: myapp
replicas: 3
template:
metadata::
name:: nginx-2
labels:
app: myapp
spec:
containers:
- name: nginx
image: nginx
I was expecting to create three pods by running the command below:
kubectl create -f replicatset.yaml
Upvotes: 0
Views: 647
Reputation: 11832
metadata::
and name:: nginx-2
It should be have only one :
metadata:
Upvotes: 0