前言
最近由于k8s 摒棄了apiVersion:extensions/v1beta1
導(dǎo)致現(xiàn)在很多以前可以成功的操作而現(xiàn)在無法成功
解決辦法
- 修改apiVersion
apiVerion: apps/v1
- 修改完成后出現(xiàn)報錯
Error: release gitlab-runner failed: Deployment.apps "gitlab-runner-ack-gitlab-runner" is invalid: spec.template.metadata.labels: Invalid value: map[string]string{"app":"gitlab-runner-ack-gitlab-runner"}: `selector` does not match template `labels`
- 添加selector
selector:
matchLabels:
app: gitlab-runner-ack-gitlab-runner # 匹配上報錯的名字
縱覽
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "gitlab-runner.fullname" . }}
labels:
app: {{ template "gitlab-runner.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
spec:
replicas: 1
selector:
matchLabels:
app: gitlab-runner-ack-gitlab-runner
template:
metadata:
... ...
根據(jù)報錯修改
-
圈出來的字眼
-
修改為上面圈出來的字眼