创建部署问题时,请参考下面模板,你提供的信息越多,越容易及时获得解答。如果未按模板创建问题,管理员有权关闭问题。
确保帖子格式清晰易读,用 markdown code block 语法格式化代码块。
你只花一分钟创建的问题,不能指望别人花上半个小时给你解答。

操作系统信息
虚拟机,Anolis 8.8,16C/32G

Kubernetes版本信息
kubectl version 命令执行结果贴在下方

[root@silkdo-base-01 ~]# kubectl version
WARNING: This version information is deprecated and will be replaced with the output from kubectl version --short.  Use --output=yaml|json to get the full version.
Client Version: version.Info{Major:"1", Minor:"25", GitVersion:"v1.25.11", GitCommit:"8cfcba0b15c343a8dc48567a74c29ec4844e0b9e", GitTreeState:"clean", BuildDate:"2023-06-14T09:57:26Z", GoVersion:"go1.19.10", Compiler:"gc", Platform:"linux/amd64"}
Kustomize Version: v4.5.7
Server Version: version.Info{Major:"1", Minor:"25", GitVersion:"v1.25.11", GitCommit:"8cfcba0b15c343a8dc48567a74c29ec4844e0b9e", GitTreeState:"clean", BuildDate:"2023-06-14T09:49:38Z", GoVersion:"go1.19.10", Compiler:"gc", Platform:"linux/amd64"}

容器运行时
docker version / crictl version / nerdctl version 结果贴在下方

[root@silkdo-base-01 ~]# containerd --version
containerd github.com/containerd/containerd v1.6.19 1e1ea6e986c6c86565bc33d52e34b81b3e2bc71f
[root@silkdo-base-01 ~]# crictl version

Version:  0.1.0

RuntimeName:  containerd

RuntimeVersion:  v1.6.19

RuntimeApiVersion:  v1
[root@silkdo-base-01 ~]# nerdctl version
Client:
 Version:	v1.2.1
 OS/Arch:	linux/amd64
 Git commit:	a0bbfd75ba92bcb11ac6059bf4f6f4e50c6da0b8
 buildctl:
  Version:	v0.11.5
  GitCommit:	252ae63bcf2a9b62777add4838df5a257b86e991

Server:
 containerd:
  Version:	v1.6.19
  GitCommit:	1e1ea6e986c6c86565bc33d52e34b81b3e2bc71f
 runc:
  Version:	1.1.4
  GitCommit:	v1.1.4-0-g5fd4c4d1

KubeSphere版本信息

v3.4.1。在线安装。在已有 k8s 上使用 ks-install 安装。

问题是什么

[root@silkdo-base-01 ~]# kubectl -n kubesphere-monitoring-system -l app=notification-manager logs -f
level=error ts=2023-12-04T01:10:52.31340621Z caller=dingtalk.go:368 msg="DingTalkNotifier: split message error" error="template: :1:12: executing \"\" at <{{template \"nm.default.text\" .}}>: template \"nm.default.text\" not defined"
level=error ts=2023-12-04T01:10:52.313473644Z caller=dispatcher.go:128 msg="Dispatcher: process alerts failed" seq=34
level=error ts=2023-12-04T01:11:52.313906183Z caller=dingtalk.go:368 msg="DingTalkNotifier: split message error" error="template: :1:12: executing \"\" at <{{template \"nm.default.text\" .}}>: template \"nm.default.text\" not defined"
level=error ts=2023-12-04T01:11:52.313965Z caller=dispatcher.go:128 msg="Dispatcher: process alerts failed" seq=35
level=error ts=2023-12-04T01:21:52.321966574Z caller=dingtalk.go:368 msg="DingTalkNotifier: split message error" error="template: :1:12: executing \"\" at <{{template \"nm.default.text\" .}}>: template \"nm.default.text\" not defined"
level=error ts=2023-12-04T01:21:52.322035881Z caller=dispatcher.go:128 msg="Dispatcher: process alerts failed" seq=36
level=error ts=2023-12-04T01:22:52.322172552Z caller=dingtalk.go:368 msg="DingTalkNotifier: split message error" error="template: :1:12: executing \"\" at <{{template \"nm.default.text\" .}}>: template \"nm.default.text\" not defined"
level=error ts=2023-12-04T01:22:52.322264649Z caller=dispatcher.go:128 msg="Dispatcher: process alerts failed" seq=37
level=error ts=2023-12-04T01:23:52.322323929Z caller=dingtalk.go:368 msg="DingTalkNotifier: split message error" error="template: :1:12: executing \"\" at <{{template \"nm.default.text\" .}}>: template \"nm.default.text\" not defined"
level=error ts=2023-12-04T01:23:52.322424688Z caller=dispatcher.go:128 msg="Dispatcher: process alerts failed" seq=38
level=error ts=2023-12-03T19:12:51.958506672Z caller=dingtalk.go:368 msg="DingTalkNotifier: split message error" error="template: :1:12: executing \"\" at <{{template \"nm.default.text\" .}}>: template \"nm.default.text\" not defined"
level=error ts=2023-12-03T19:12:51.958587745Z caller=dispatcher.go:128 msg="Dispatcher: process alerts failed" seq=17
level=error ts=2023-12-03T19:16:51.960511055Z caller=dingtalk.go:368 msg="DingTalkNotifier: split message error" error="template: :1:12: executing \"\" at <{{template \"nm.default.text\" .}}>: template \"nm.default.text\" not defined"
level=error ts=2023-12-03T19:16:51.960579263Z caller=dispatcher.go:128 msg="Dispatcher: process alerts failed" seq=18
level=error ts=2023-12-03T19:17:51.961030015Z caller=dingtalk.go:368 msg="DingTalkNotifier: split message error" error="template: :1:12: executing \"\" at <{{template \"nm.default.text\" .}}>: template \"nm.default.text\" not defined"
level=error ts=2023-12-03T19:17:51.961089165Z caller=dispatcher.go:128 msg="Dispatcher: process alerts failed" seq=19
level=error ts=2023-12-03T19:18:51.962273466Z caller=dingtalk.go:368 msg="DingTalkNotifier: split message error" error="template: :1:12: executing \"\" at <{{template \"nm.default.text\" .}}>: template \"nm.default.text\" not defined"
level=error ts=2023-12-03T19:18:51.962377112Z caller=dispatcher.go:128 msg="Dispatcher: process alerts failed" seq=20
level=error ts=2023-12-03T19:19:51.962944455Z caller=dingtalk.go:368 msg="DingTalkNotifier: split message error" error="template: :1:12: executing \"\" at <{{template \"nm.default.text\" .}}>: template \"nm.default.text\" not defined"
level=error ts=2023-12-03T19:19:51.963098783Z caller=dispatcher.go:128 msg="Dispatcher: process alerts failed" seq=21
[root@silkdo-base-01 ~]# kubectl get nm notification-manager -o yaml
apiVersion: notification.kubesphere.io/v2beta2
kind: NotificationManager
metadata:
  annotations:
    meta.helm.sh/release-name: notification-manager
    meta.helm.sh/release-namespace: kubesphere-monitoring-system
  creationTimestamp: "2023-11-23T15:46:50Z"
  generation: 10
  labels:
    app: notification-manager
    app.kubernetes.io/managed-by: Helm
    kubefed.io/managed: "false"
  name: notification-manager
  resourceVersion: "216434516"
  uid: 29ea6a99-23f5-4d9d-aaa0-8e450ff4d887
spec:
  affinity: {}
  batchMaxSize: 100
  batchMaxWait: 1m
  defaultConfigSelector:
    matchLabels:
      type: default
  defaultSecretNamespace: kubesphere-monitoring-federated
  image: kubesphere/notification-manager:v2.4.0
  imagePullPolicy: IfNotPresent
  portName: webhook
  receivers:
    globalReceiverSelector:
      matchLabels:
        type: global
    options:
      dingtalk:
        notificationTimeout: 5
      email:
        deliveryType: bulk
        notificationTimeout: 5
      slack:
        notificationTimeout: 5
      webhook:
        notificationTimeout: 5
      wechat:
        notificationTimeout: 5
    tenantKey: user
    tenantReceiverSelector:
      matchLabels:
        type: tenant
  replicas: 2
  resources:
    limits:
      cpu: 500m
      memory: 500Mi
    requests:
      cpu: 5m
      memory: 20Mi
  routePolicy: All
  serviceAccountName: notification-manager-sa
[root@silkdo-base-01 ~]# kubectl get nr global-dingtalk-receiver -o yaml
apiVersion: notification.kubesphere.io/v2beta2
kind: Receiver
metadata:
  creationTimestamp: "2023-11-26T05:57:28Z"
  generation: 2
  labels:
    kubefed.io/managed: "false"
    type: global
  name: global-dingtalk-receiver
  resourceVersion: "216390554"
  uid: befa43fa-a427-49bd-bdc7-2455b24e0ea7
spec:
  dingtalk:
    alertSelector: {}
    chatbot:
      secret:
        valueFrom:
          secretKeyRef:
            key: chatbotsecret
            name: global-dingtalk-config-secret
      webhook:
        valueFrom:
          secretKeyRef:
            key: webhook
            name: global-dingtalk-config-secret
    dingtalkConfigSelector: {}
    enabled: true
status: {}
[root@silkdo-base-01 ~]# helm -n kubesphere-monitoring-system get values notification-manager
USER-SUPPLIED VALUES:
hook:
  postInstall:
    backoffLimit: 3
    image:
      pullPolicy: IfNotPresent
      repo: registry.cn-beijing.aliyuncs.com/kubesphereio/kubectl
      tag: v1.22.0
kubesphere: true
notificationmanager:
  affinity: {}
  defaultConfigSelector:
    matchLabels:
      type: default
  defaultSecretNamespace: kubesphere-monitoring-federated
  env:
  - name: TZ
    value: Asia/Shanghai
  groupLabels:
  - alertname
  - namespace
  image:
    pullPolicy: IfNotPresent
    repo: kubesphere/notification-manager
    tag: v2.4.0
  name: notification-manager
  nodeSelector: {}
  receivers:
    globalReceiverSelector:
      matchLabels:
        type: global
    options:
      dingtalk:
        notificationTimeout: 5
        template: nm.default.markdown
        tmplType: markdown
      email:
        deliveryType: bulk
        notificationTimeout: 5
      slack:
        notificationTimeout: 5
      webhook:
        notificationTimeout: 5
      wechat:
        notificationTimeout: 5
    tenantKey: user
    tenantReceiverSelector:
      matchLabels:
        type: tenant
  replicas: 2
  resources:
    limits:
      cpu: 500m
      memory: 500Mi
    requests:
      cpu: 5m
      memory: 20Mi
  sidecars:
    tenant:
      image:
        repo: registry.cn-beijing.aliyuncs.com/kubesphereio/notification-tenant-sidecar
        tag: v3.2.0
  template:
    language: zh-cn
    languagePack:
    - name: zh-cn
      namespace: kubesphere-monitoring-system
    text:
      name: notification-manager-template
      namespace: kubesphere-monitoring-system
  tolerations: []
  volumeMounts: []
  volumes: []
operator:
  affinity: {}
  containers:
    operator:
      image:
        pullPolicy: IfNotPresent
        repo: kubesphere/notification-manager-operator
        tag: v2.4.0
      resources:
        limits:
          cpu: 50m
          memory: 50Mi
        requests:
          cpu: 5m
          memory: 20Mi
    proxy:
      image:
        pullPolicy: IfNotPresent
        repo: registry.cn-beijing.aliyuncs.com/kubesphereio/kube-rbac-proxy
        tag: v0.11.0
      resources:
        limits:
          cpu: 50m
          memory: 50Mi
        requests:
          cpu: 5m
          memory: 10Mi
  nodeSelector: {}
  tolerations: []

你用 installer 部署的,为什么 notification manager 的版本是 2.4.0?默认应该是 2.3.0 的,

报错的原因是你没指定 template,你的 notification manager 是自己部署的吧,缺少了部分配置,把下面的配置加到 notification manager cr 里面

  template:
    language: English
    reloadCycle: 1m
    text:
      name: notification-manager-template

    wanjunlei 版本是在 2.3.0 基础上自己更新的,template 加不进去,加上就自动删了

    你确定下 crd 里面有没有这个字段,没有就更新下 crd

      wanjunlei

      kubectl apply -f https://ghps.cc/https://github.com/kubesphere/notification-manager/releases/download/v2.4.0/bundle.yaml
      
      kubectl apply -f https://ghps.cc/https://github.com/kubesphere/notification-manager/releases/download/v2.4.0/template.yaml
      
      kubectl apply -f https://ghps.cc/https://github.com/kubesphere/notification-manager/releases/download/v2.4.0/zh-cn.yaml

      更新了也没有用

      apiVersion: notification.kubesphere.io/v2beta2
      kind: NotificationManager
      metadata:
        name: notification-manager
      spec:
        template:
          language: English
          reloadCycle: 1m
          text:
            name: notification-manager-template
        5 个月 后

        我自动安装的no,也没有这个

        template:
        language: English
        reloadCycle: 1m
        text:
        name: notification-manager-template
        请问要怎么添加呀?我添加完又自动删除了

        4 个月 后

        try try……

        spec:
          receivers:
            options:
              global:
                templateFile:
                  - /etc/notification-manager/template
          volumeMounts:
            - mountPath: /etc/notification-manager/
              name: notification-manager-template
          volumes:
            - configMap:
                defaultMode: 420
                name: notification-manager-template
              name: notification-manager-template