forked from kubernetes/test-infra
-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathnginx.yaml
109 lines (103 loc) · 2.5 KB
/
nginx.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: nginx-${PROJECT}
labels:
app: nginx
project: ${PROJECT}
spec:
replicas: 1
template:
metadata:
labels:
app: nginx
project: ${PROJECT}
spec:
containers:
- image: nginx:1.10.1
name: nginx
command: ['nginx', '-g', 'daemon off;']
resources:
requests:
cpu: 0m
ports:
- name: nginx-port
containerPort: 8080
- name: influxdb-port
containerPort: 8181
volumeMounts:
- mountPath: /etc/nginx
name: nginx-config
volumes:
- name: nginx-config
configMap:
name: nginx-${PROJECT}
items:
- key: nginx.conf
path: nginx.conf
---
apiVersion: v1
kind: Service
metadata:
labels:
app: nginx
project: ${PROJECT}
name: nginx-${PROJECT}
spec:
ports:
- name: nginx
port: 80
targetPort: nginx-port
- name: influxdb
port: 8181
targetPort: influxdb-port
selector:
app: nginx
project: ${PROJECT}
loadBalancerIP: ${NGINX_PUBLIC_IP}
type: LoadBalancer
---
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-${PROJECT}
labels:
app: nginx
project: ${PROJECT}
data:
nginx.conf: |
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
server {
listen 8080;
location / {
proxy_pass http://grafana-${PROJECT}:3000/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
location /influxdb/ {
proxy_pass http://influxdb-${PROJECT}:8086/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
server {
listen 8181;
location / {
proxy_pass http://influxdb-${PROJECT}:8086/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
}