Skip to content

Instantly share code, notes, and snippets.

@adrukh
Created August 2, 2017 08:00
Show Gist options
  • Save adrukh/de185260921593a87bab781b30961b36 to your computer and use it in GitHub Desktop.
Save adrukh/de185260921593a87bab781b30961b36 to your computer and use it in GitHub Desktop.
events {
worker_connections 1024; ## Default: 1024
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log off;
error_log /dev/stdout;
resolver kube-dns.kube-system.svc.cluster.local valid=5s;
charset utf-8;
keepalive_timeout 65;
server_tokens off;
sendfile on;
tcp_nopush on;
tcp_nodelay off;
server {
listen 80;
proxy_read_timeout 10s;
location = /healthcheck {
return 200 '{"ok": true, "nginx": true}';
add_header Content-Type application/json;
}
# Internal services with non-default ports (NodePorts, for example) are proxied by /:name/:port
location ~ /([a-zA-Z0-9_-]+)/(\d+) {
proxy_pass http://$1.default.svc.cluster.local:$2/healthcheck;
}
# Internal services with default HTTP port are proxied by /:name
location ~ /([a-zA-Z0-9_-]+) {
proxy_pass http://$1.default.svc.cluster.local/healthcheck;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment