https://ithelp.ithome.com.tw/articles/10244493
https://www.metricfire.com/blog/what-is-prometheus/
环境:
Ubuntu 20.04
Kubernetes v1.15.6
https://ithelp.ithome.com.tw/articles/10248278
kubectl create ns kube-ops
prometheus-cm.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: prometheus-config
namespace: kube-ops
data:
prometheus.yml: |
global:
scrape_interval: 15s
scrape_timeout: 15s
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
prometheus-deploy.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: prometheus
name: prometheus
namespace: kube-ops
spec:
replicas: 1
selector:
matchLabels:
app: prometheus
template:
metadata:
labels:
app: prometheus
spec:
serviceAccountName: prometheus
containers:
- image: prom/prometheus:v2.21.0
name: prometheus
command:
- "/bin/prometheus"
args:
- "--config.file=/etc/prometheus/prometheus.yml"
- "--storage.tsdb.path=/prometheus"
- "--storage.tsdb.retention=24h"
- "--web.enable-lifecycle"
ports:
- containerPort: 9090
protocol: TCP
name: http
volumeMounts:
- mountPath: "/prometheus"
subPath: prometheus
name: data
- mountPath: "/etc/prometheus"
name: config-volume
resources:
requests:
cpu: 100m
memory: 512Mi
limits:
cpu: 100m
memory: 512Mi
securityContext:
runAsUser: 0
volumes:
- name: data
emptyDir: {}
- configMap:
name: prometheus-config
name: config-volume
prometheus-rbac.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: prometheus
namespace: kube-ops
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: prometheus
rules:
- apiGroups:
- ""
resources:
- nodes
- services
- endpoints
- pods
- nodes/proxy
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
- configmaps
- nodes/metrics
verbs:
- get
- nonResourceURLs:
- /metrics
verbs:
- get
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: prometheus
subjects:
- kind: ServiceAccount
name: prometheus
namespace: kube-ops
roleRef:
kind: ClusterRole
name: prometheus
apiGroup: rbac.authorization.k8s.io
prometheus-svc.yaml
apiVersion: v1
kind: Service
metadata:
name: prometheus
namespace: kube-ops
labels:
app: prometheus
spec:
selector:
app: prometheus
type: NodePort
ports:
- name: web
port: 9090
targetPort: 9090
nodePort: 31111
kubectl apply -f .
root@MGCHUNG-2:/home/ubuntu# kubectl get svc -n kube-ops
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
prometheus NodePort 10.101.214.225 <none> 9090:31111/TCP 9m4s
<<: Day 18 - 网页元素DOM-取得文字,数值和其他输入 - input,colorpicker,sliderbar
之前已经可以用後端的套件去实作推播的服务器,但那个套件实际上做了哪些事情? 金钥对 Applicat...
在今年的 Google I/O 大会中,Google 介绍了一个名为 INP(Interaction...
选择研究/探讨AR相关技术是因为希望未来可以做出一些很酷的东西,像Pokemon GO或是游戏王卡的...
Pooling Layer 影像的spatial information不会因scale而消失,所以...
接下来要在页面上按下按钮跳页 以及按了左边 header icon 回上一页 正所谓有去有回才不会...