这个系列的东东满多的。要另开系列说明。
这里为了内容连续完成,先贴一个吧,其它configmap,exporter就不展示。
为了保持统一,将prometheus也放到二级目录了。
- '--web.external-url=/prometheus'
apiVersion: rbac.authorization.k8s.io/v1beta1 kind: ClusterRole metadata: name: prometheus rules: - apiGroups: [""] # "" indicates the core API group resources: - nodes - nodes/proxy - services - endpoints - pods verbs: - get - watch - list - apiGroups: - extensions resources: - ingresses verbs: - get - watch - list - nonResourceURLs: ["/metrics"] verbs: - get --- apiVersion: v1 kind: ServiceAccount metadata: name: prometheus namespace: kube-system labels: app: prometheus --- apiVersion: rbac.authorization.k8s.io/v1beta1 kind: ClusterRoleBinding metadata: name: prometheus subjects: - kind: ServiceAccount name: prometheus namespace: kube-system roleRef: kind: ClusterRole name: prometheus apiGroup: rbac.authorization.k8s.io --- apiVersion: extensions/v1beta1 kind: Deployment metadata: name: prometheus namespace: kube-system labels: app: prometheus spec: replicas: 1 template: metadata: name: prometheus labels: app: prometheus spec: # hostNetwork: true serviceAccountName: prometheus containers: - name: prometheus image: harbor.xxx.cn/3rd_part/prom/prometheus:v2.9.2 imagePullPolicy: IfNotPresent args: - '--storage.tsdb.path=/prometheus/data/' - '--storage.tsdb.retention=1d' - '--config.file=/etc/prometheus/prometheus.yaml' - '--web.enable-lifecycle' - '--web.external-url=/prometheus' ports: - name: webui containerPort: 9090 resources: requests: cpu: 401m memory: 500M # limits: # cpu: 500m # memory: 500M volumeMounts: - name: config-volume mountPath: /etc/prometheus - name: rules-volume mountPath: /etc/prometheus-rules volumes: - name: config-volume configMap: name: prometheus - name: rules-volume configMap: name: prometheus-rules nodeSelector: node-role.kubernetes.io/master: "" tolerations: - key: "node-role.kubernetes.io/master" effect: "NoSchedule" --- apiVersion: v1 kind: Service metadata: name: prometheus namespace: kube-system labels: app: prometheus annotations: prometheus.io/scrape: 'true' spec: ports: - name: webui port: 9090 protocol: TCP selector: app: prometheus