build prometheus for monitor
This commit is contained in:
parent
05ef2c1e3c
commit
ddfce77eaf
26
app03/app-deploy.yaml
Normal file
26
app03/app-deploy.yaml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: miles01
|
||||||
|
namespace: app02
|
||||||
|
labels:
|
||||||
|
app: fastapi
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: fastapi
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: fastapi
|
||||||
|
name: fastapi
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: fastapi
|
||||||
|
image: ub20:v1
|
||||||
|
imagePullPolicy: Never
|
||||||
|
ports:
|
||||||
|
- containerPort: 8000
|
||||||
|
# command:
|
||||||
|
# - ["/usr/bin/python3", "/app/app.py"]
|
13
app03/app-service.yaml
Normal file
13
app03/app-service.yaml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
kind: Service
|
||||||
|
apiVersion: v1
|
||||||
|
metadata:
|
||||||
|
name: miles01
|
||||||
|
namespace: app02
|
||||||
|
spec:
|
||||||
|
type: NodePort
|
||||||
|
ports:
|
||||||
|
- port: 8000
|
||||||
|
nodePort: 30000
|
||||||
|
selector:
|
||||||
|
name: miles01
|
||||||
|
# curl http://127.0.0.1:30000/docs
|
8
prometheus/monitor-namespace.yaml
Normal file
8
prometheus/monitor-namespace.yaml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Namespace
|
||||||
|
metadata:
|
||||||
|
name: monitor
|
||||||
|
labels:
|
||||||
|
name: monitor
|
||||||
|
type: namespace
|
14
prometheus/prometheus-config.yaml
Normal file
14
prometheus/prometheus-config.yaml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: prometheus-config
|
||||||
|
namespace: monitor
|
||||||
|
data:
|
||||||
|
prometheus.yml: |
|
||||||
|
global:
|
||||||
|
scrape_interval: 15s
|
||||||
|
evaluation_interval: 15s
|
||||||
|
scrape_configs:
|
||||||
|
- job_name: 'prometheus'
|
||||||
|
static_configs:
|
||||||
|
- targets: ['localhost:9090']
|
51
prometheus/prometheus-deploy.yaml
Normal file
51
prometheus/prometheus-deploy.yaml
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: "Service"
|
||||||
|
metadata:
|
||||||
|
name: prometheus
|
||||||
|
namespace: monitor
|
||||||
|
labels:
|
||||||
|
name: prometheus
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- name: prometheus
|
||||||
|
protocol: TCP
|
||||||
|
port: 9090
|
||||||
|
targetPort: 9090
|
||||||
|
selector:
|
||||||
|
name: prometheus
|
||||||
|
type: NodePort
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
name: prometheus
|
||||||
|
name: prometheus
|
||||||
|
namespace: monitor
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
name: prometheus
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
name: prometheus
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: prometheus
|
||||||
|
image: prom/prometheus:v2.2.1
|
||||||
|
command:
|
||||||
|
- "/bin/prometheus"
|
||||||
|
args:
|
||||||
|
- "--config.file=/etc/prometheus/prometheus.yml"
|
||||||
|
ports:
|
||||||
|
- containerPort: 9090
|
||||||
|
protocol: TCP
|
||||||
|
volumeMounts:
|
||||||
|
- mountPath: "/etc/prometheus"
|
||||||
|
name: prometheus-config
|
||||||
|
volumes:
|
||||||
|
- name: prometheus-config
|
||||||
|
configMap:
|
||||||
|
name: prometheus-config
|
@ -44,4 +44,8 @@ kubectl run busybox --image=busybox --command -- ping baidu.com
|
|||||||
kubectl exec -it busybox -- /bin/bash
|
kubectl exec -it busybox -- /bin/bash
|
||||||
k describe replicaset.apps/app01-redis-64847ffc48
|
k describe replicaset.apps/app01-redis-64847ffc48
|
||||||
k get all -ALL
|
k get all -ALL
|
||||||
k describe pods
|
k describe pods
|
||||||
|
|
||||||
|
# minikube 使用本地image 方法
|
||||||
|
eval $(minikube -p minikube docker-env)
|
||||||
|
docker build -t .
|
||||||
|
2
start_mini.sh
Normal file
2
start_mini.sh
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
#minikube config set driver hyperkit
|
||||||
|
minikube start --driver=hyperkit
|
Loading…
x
Reference in New Issue
Block a user