在创建ReplicaSet
时,出现以下错误:
ReplicaSet“ julrs”无效:spec.template.metadata.labels: 无效的值:map [string] string {“ type”:“ july-26”}:
不匹配selector
确实 与模板labels
下面是我的yaml文件copysetset.yml文件
apiVersion: apps/v1
kind: ReplicaSet
metadata:
name: julrs
labels:
type: jul-26
spec:
template:
metadata:
labels:
type: july-26
spec:
containers:
- name: jul-c1
image: nginx
replicas: 2
selector:
matchLabels:
type: jul-26
我想念什么?我曾尝试使用相同的Yaml(没有选择器并使用v1版本)来ReplicationController
,但工作正常。
答案 0 :(得分:1)
嗯,yaml文件应该是这样的
apiVersion: apps/v1
kind: ReplicaSet
metadata:
name: julrs
labels:
type: july-26
spec:
replicas: 2
selector:
matchLabels:
type: july-26 <-----This
template:
metadata:
labels:
type: july-26 <-------this should be same as above
spec:
containers:
- name: jul-c1
image: nginx