Hi team!
I’m evaluating high‑availability/failover strategies in Kong and would like advice on configuring a primary + backup target within a single upstream. In plain Nginx you can write:
upstream service-a-upstream {
server service-a.namespace.svc.cluster.local:80;
server service-a-backup.namespace.svc.cluster.local:80 backup;
}
server {
location / {
proxy_pass http://service-a-upstream;
}
}
which gives automatic failover + auto‑recovery purely in Nginx.
In Kong, I see a few alternatives:
- Weighted targets + active healthchecks
Set weight 65535 for primary and 1 for backup, and enable healthchecks (backup still gets a small slice). - Some custom plugin?
Maybe one already exists that understands “priority” or “fallback” semantics. - KONG_NGINX_HTTP_INCLUDE trick with a custom server config?
# ConfigMap: servers.conf (loaded via KONG_NGINX_HTTP_INCLUDE)
#
# ───────── upstream groups ─────────
upstream service-a-upstream {
server service-a.namespace.svc.cluster.local:80;
server service-a-backup.namespace.svc.cluster.local:80 backup;
}
upstream service-b-upstream {
server service-b.namespace.svc.cluster.local:80;
server service-b-backup.namespace.svc.cluster.local:80 backup;
}
upstream service-c-upstream {
server service-c.namespace.svc.cluster.local:80;
server service-c-backup.namespace.svc.cluster.local:80 backup;
}
# ───────── unified fallback vhost ─────────
server {
listen 8888;
server_name kong-fallback;
# --- Service A ---
location /service-a {
proxy_next_upstream error timeout invalid_header http_502 http_504;
proxy_next_upstream_tries 2;
proxy_pass http://service-a-upstream;
}
# --- Service B ---
location /service-b {
proxy_next_upstream error timeout invalid_header http_502 http_504;
proxy_next_upstream_tries 2;
proxy_pass http://service-b-upstream;
}
# --- Service C ---
location /service-c {
proxy_next_upstream error timeout invalid_header http_502 http_504;
proxy_next_upstream_tries 2;
proxy_pass http://service-c-upstream;
}
}
Will this even work?
I might be thinking about this all wrong—any advice or suggestions are welcome!