Kubernetes 复制集抛出错误“;选择器与模板标签不匹配";
创建复制集时,我遇到以下错误: 复制集“julls”无效:spec.template.metadata.labels: 无效值:映射[string]字符串{“type”:“july-26”}:Kubernetes 复制集抛出错误“;选择器与模板标签不匹配";,kubernetes,Kubernetes,创建复制集时,我遇到以下错误: 复制集“julls”无效:spec.template.metadata.labels: 无效值:映射[string]字符串{“type”:“july-26”}:选择器 与模板标签不匹配 下面是我的yaml文件replicaset.yml文件 apiVersion: apps/v1 kind: ReplicaSet metadata: name: julrs labels: type: jul-26 spec: templat
选择器
与模板标签不匹配
下面是我的yaml文件replicaset.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
,效果很好。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
apiVersion:apps/v1
种类:复制集
元数据:
姓名:朱尔斯
标签:
类型:7月26日
规格:
副本:2份
选择器:
火柴标签:
类型:july-26那么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
apiVersion:apps/v1
种类:复制集
元数据:
姓名:朱尔斯
标签:
类型:7月26日
规格:
副本:2份
选择器:
火柴标签:
类型:7月26日