前言
最近由于k8s 摒弃了apiVersion:extensions/v1beta1
导致现在很多以前可以成功的操作而现在无法成功
解决办法
- 修改apiVersion
apiVerion: apps/v1
- 修改完成后出现报错
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:
... ...
根据报错修改
-
圈出来的字眼
-
修改为上面圈出来的字眼