Skip to content

Instantly share code, notes, and snippets.

@gitschaub
Last active March 24, 2016 20:18
Show Gist options
  • Save gitschaub/6ade0ab56c1a146dde38 to your computer and use it in GitHub Desktop.
Save gitschaub/6ade0ab56c1a146dde38 to your computer and use it in GitHub Desktop.
Possible issue with partial route matches. Setting an ingress rule for /status will proxy all routes matching /status* to the associated endpoint. This may cause unexpected behavior as shown below.
$ kubectl describe svc nginx-plus-service
Name: nginx-plus-service
Namespace: default
Labels: <none>
Selector: app=nginx-plus-ingress
Type: ClusterIP
IP: None
Port: <unnamed> 8080/TCP
Endpoints: 172.16.81.36:8080
Session Affinity: None
No events.
$ kubectl get ing
NAME RULE BACKEND ADDRESS
nginx-ingress -
foo.bar.com
/status nginx-plus-service:8080
$ curl <ingress-host-ip>/status
--> If you read through this, you see 4xx return codes for this service is 0
... "default-nginx-ingress-foo.bar.com-nginx-plus-service" --> "responses":{"1xx":0,"2xx":1,"3xx":0,"4xx":0,"5xx":0,"total":1} ...
$ curl <ingress-host-ip>/status.html
<returns nginx-plus dashboard html, although we may have been looking retrieve a static file for ingress rule / >
$ curl <ingress-host-ip>/status-I-made-this-up
<returns 404 not found **from the service endpoint**, not the default-http-backend being used to serve 404 responses for missed rule matches>
$ curl <ingress-host-ip>/status
--> 4xx return codes reflected on service endpoint.
... "default-nginx-ingress-foo.bar.com-nginx-plus-service" --> "responses":{"1xx":0,"2xx":2,"3xx":0,"4xx":1,"5xx":0,"total":3} ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment