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