洞察抓住fintech行业机遇,如何利用flutter框架开发安全合规的跨平台app
577
2022-11-27
【K8S运维知识汇总】第7天3:安装部署prometheus-server
文章目录
准备prometheus镜像准备资源配置清单准备Prometheus相关配置DNS解析应用资源配置清单浏览器访问验证
准备prometheus镜像
/opt/src]# docker image tag 7317640d555e harbor.od.com/infra/prometheus:v2.14.0[root@k8s7-200.host.com /opt/src]# docker push harbor.od.com/infra/prometheus:v2.14.0
准备资源配置清单
[root@k8s7-200.host.com ~]# mkdir /data/k8s-yaml/prometheus[root@k8s7-200.host.com ~]# mkdir -p /data/nfs-volume/prometheus/etc
准备Prometheus相关配置
1.拷贝证书[root@hdss7-200 ~]# mkdir -p /data/nfs-volume/prometheus/{etc,prom-db}[root@hdss7-200 ~]# cp /opt/certs/{ca.pem,client.pem,client-key.pem} /data/nfs-volume/prometheus/etc/2.准备yaml[root@k8s7-200.host.com /data/k8s-yaml/prometheus]# cat rbac.yaml apiVersion: v1kind: ServiceAccountmetadata: labels: addonmanager.kubernetes.io/mode: Reconcile kubernetes.io/cluster-service: "true" name: prometheus namespace: kube-system---apiVersion: rbac.authorization.k8s.io/v1kind: ClusterRolemetadata: labels: addonmanager.kubernetes.io/mode: Reconcile kubernetes.io/cluster-service: "true" name: prometheusrules:- apiGroups: - "" resources: - nodes - nodes/metrics - services - endpoints - pods verbs: - get - list - watch- apiGroups: - "" resources: - configmaps verbs: - get- nonResourceURLs: - /metrics verbs: - get---apiVersion: rbac.authorization.k8s.io/v1kind: ClusterRoleBindingmetadata: labels: addonmanager.kubernetes.io/mode: Reconcile kubernetes.io/cluster-service: "true" name: prometheusroleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: prometheussubjects:- kind: ServiceAccount name: prometheus namespace: kube-system[root@k8s7-200.host.com /data/k8s-yaml/prometheus]# cat deployment.yaml apiVersion: apps/v1kind: Deploymentmetadata: annotations: deployment.kubernetes.io/revision: "5" labels: name: prometheus name: prometheus namespace: kube-systemspec: replicas: 1 selector: matchLabels: app: prometheus template: metadata: labels: app: prometheus spec: nodeName: k8s7-22.host.com securityContext: runAsUser: 0 containers: - name: prometheus image: harbor.od.com/public/prometheus:v2.14.0 command: - /bin/prometheus args: - --config.file=/data/etc/prometheus.yml - --storage.tsdb.path=/data/prom-db - --storage.tsdb.min-block-duration=10m - --storage.tsdb.retention=72h ports: - containerPort: 9090 protocol: TCP volumeMounts: - mountPath: /data name: data resources: requests: cpu: "1000m" memory: "1.5Gi" limits: cpu: "2000m" memory: "3Gi" serviceAccountName: prometheus volumes: - name: data nfs: server: k8s7-200 path: /data/nfs-volume/prometheus[root@k8s7-200.host.com /data/k8s-yaml/prometheus]# cat service.yaml apiVersion: v1kind: Servicemetadata: name: prometheus namespace: kube-systemspec: ports: - port: 9090 protocol: TCP targetPort: 9090 selector: app: prometheus[root@k8s7-200.host.com /data/k8s-yaml/prometheus]# cat ingress.yaml
DNS解析
prometheus A 10.4.7.10
应用资源配置清单
[root@k8s7-22.host.com ~]# kubectl apply -f createdclusterrole.rbac.authorization.k8s.io/prometheus createdclusterrolebinding.rbac.authorization.k8s.io/prometheus created[root@k8s7-22.host.com ~]# kubectl apply -f created[root@k8s7-22.host.com ~]# kubectl apply -f created[root@k8s7-22.host.com ~]# kubectl apply -f http://k8s-yaml.od.com/prometheus/ingress.yaml
浏览器访问验证
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~