美文网首页
关于"Deployment" in version "exten

关于"Deployment" in version "exten

作者: 无处安放的躁动 | 来源:发表于2019-10-30 16:05 被阅读0次

    前言

    最近由于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:
    ... ...
    

    根据报错修改

    • 圈出来的字眼


      看图说话
    • 修改为上面圈出来的字眼


      看图说话

    关于api

    api文章

    相关文章

      网友评论

          本文标题:关于"Deployment" in version "exten

          本文链接:https://www.haomeiwen.com/subject/kioovctx.html