Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ДЗ#8 #8

Merged
merged 1 commit into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions kubernetes-monitoring/ServiceMonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: nginx-prometheus-exporter
labels:
release: prometheus
spec:
selector:
matchLabels:
app: nginx
endpoints:
- port: metrics
scheme: http
path: /metrics
interval: 15s
65 changes: 65 additions & 0 deletions kubernetes-monitoring/nginx.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
labels:
app: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:stable
ports:
- name: http
containerPort: 8000
volumeMounts:
- mountPath: /etc/nginx/conf.d/
name: nginx-conf
- name: nginx-prometheus-exporter
image: nginx/nginx-prometheus-exporter:1.3.0
args: ["-nginx.scrape-uri=http://nginx:8000/status"]
ports:
- name: metrics
containerPort: 9113
volumes:
- name: nginx-conf
configMap:
name: nginx-conf
---
apiVersion: v1
kind: Service
metadata:
name: nginx
labels:
app: nginx
spec:
ports:
- name: http
port: 8000
targetPort: http
- name: metrics
port: 9113
targetPort: metrics
selector:
app: nginx
---
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-conf
data:
nginx.conf: |
server {
listen 8000;
location /status {
stub_status;
}
}
Loading