我已经手动升级了头盔模板
上一个depoloyment.yaml
的片段:
apiVersion: apps/v1beta2 kind: Deployment metadata: name: {{ template "measurement-collector.fullname" . }} labels:
app: {{ template "measurement-collector.name" . }}
chart: {{ template "measurement-collector.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }} spec: replicas: {{ .Values.replicaCount }} selector:
matchLabels:
app: {{ template "measurement-collector.name" . }}
release: {{ .Release.Name }}
新的:
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: {{ include "measurement-collector.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "measurement-collector.name" . }}
helm.sh/chart: {{ include "measurement-collector.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "measurement-collector.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
新service.yaml
:
name: {{ include "measurement-collector.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "measurement-collector.name" . }}
helm.sh/chart: {{ include "measurement-collector.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
type: {{ .Values.service.type }}
ports:
protocol: TCP
name: http
selector:
app.kubernetes.io/name: {{ include "measurement-collector.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
然后运行:helm upgrade -i measurement-collector chart/measurement-collector --namespace prod --wait
我得到:
Error: UPGRADE FAILED: Deployment.apps "measurement-collector" is invalid: spec.selector: Invalid value:
v1.LabelSelector{MatchLabels:map[string]string{"app.kubernetes.io/name":"measurement-collector", "app.kubernetes.io/instance":"measurement-collector"},
MatchExpressions:[]v1.LabelSelectorRequirement(nil)}: field is immutable
答案 0 :(得分:3)
如果更改选择器标签,则需要在部署之前先清除发行版。