我正在尝试在新的新k8s集群中使用运算符创建普罗米修斯
我使用以下文件,

  • 第一步,我创建一个监视
  • 的 namespace
  • 应用此文件,可以正常工作
  • 
    apiVersion: apps/v1beta2
    kind: Deployment
    metadata:
      labels:
        k8s-app: prometheus-operator
      name: prometheus-operator
      namespace: monitoring
    spec:
      replicas: 2
      selector:
        matchLabels:
          k8s-app: prometheus-operator
      template:
        metadata:
          labels:
            k8s-app: prometheus-operator
        spec:
          priorityClassName: "operator-critical"
          tolerations:
          - key: "WorkGroup"
            operator: "Equal"
            value: "operator"
            effect: "NoSchedule"
          - key: "WorkGroup"
            operator: "Equal"
            value: "operator"
            effect: "NoExecute"
          containers:
          - args:
            - --kubelet-service=kube-system/kubelet
            - --logtostderr=true
            - --config-reloader-image=quay.io/coreos/configmap-reload:v0.0.1
            - --prometheus-config-reloader=quay.io/coreos/prometheus-config-reloader:v0.29.0
            image: quay.io/coreos/prometheus-operator:v0.29.0
            name: prometheus-operator
            ports:
            - containerPort: 8080
              name: http
            securityContext:
              allowPrivilegeEscalation: false
              readOnlyRootFilesystem: true
          nodeSelector:
          serviceAccountName: prometheus-operator
    

    现在我要应用此文件(CRD)
    apiVersion: monitoring.coreos.com/v1
    kind: Prometheus
    metadata:
      name: prometheus
      namespace: monitoring
      labels:
        prometheus: prometheus
    spec:
      replica: 1
      priorityClassName: "operator-critical"
      serviceAccountName: prometheus
      nodeSelector:
            worker.garden.sapcloud.io/group: operator
      serviceMonitorNamespaceSelector: {}
      serviceMonitorSelector:
        matchLabels:
          role: observeable
      tolerations:
      - key: "WorkGroup"
        operator: "Equal"
        value: "operator"
        effect: "NoSchedule"
      - key: "WorkGroup"
        operator: "Equal"
        value: "operator"
        effect: "NoExecute"
    

    我得到错误:
    error: unable to recognize "1500-prometheus-crd.yaml": no matches for kind "Prometheus" in version "monitoring.coreos.com/v1"
    我找到了这个https://github.com/coreos/prometheus-operator/issues/1866,但是我尝试按照提到的方式进行操作,即
    请稍等片刻,然后再次部署,但无济于事。任何的想法 ?

    还尝试删除ns并使用配置再次创建它,但我遇到了同样的问题。请指教

    最佳答案

    您需要先将custom resources安装为Kubernetes中的可用对象,然后才能创建它们的实例。

    关于amazon-web-services - 在新的集群crd问题中部署方法,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/55141931/

    10-16 06:33