fix ingress syntax. (#7867)
This commit is contained in:
parent
e34ca93ad6
commit
ed34f6c93d
21 changed files with 204 additions and 105 deletions
13
.github/ISSUE_TEMPLATE/bug_report.md
vendored
13
.github/ISSUE_TEMPLATE/bug_report.md
vendored
|
@ -100,7 +100,7 @@ kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main
|
|||
## Create an ingress (please add any additional annotation required)
|
||||
|
||||
echo "
|
||||
apiVersion: networking.k8s.io/v1beta1
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: foo-bar
|
||||
|
@ -109,10 +109,13 @@ echo "
|
|||
- host: foo.bar
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
serviceName: http-svc
|
||||
servicePort: 80
|
||||
path: /
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: http-svc
|
||||
port:
|
||||
number: 80
|
||||
" | kubectl apply -f -
|
||||
|
||||
## make a request
|
||||
|
|
|
@ -15,10 +15,13 @@ spec:
|
|||
- host: stickyingress-samesite-none.example.com
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
serviceName: http-svc
|
||||
servicePort: 80
|
||||
path: /
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: http-svc
|
||||
port:
|
||||
number: 80
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
|
@ -35,7 +38,10 @@ spec:
|
|||
- host: stickyingress-samesite-strict.example.com
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
serviceName: http-svc
|
||||
servicePort: 80
|
||||
path: /
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: http-svc
|
||||
port:
|
||||
number: 80
|
|
@ -13,7 +13,10 @@ spec:
|
|||
- host: stickyingress.example.com
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
serviceName: http-svc
|
||||
servicePort: 80
|
||||
path: /
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: http-svc
|
||||
port:
|
||||
number: 80
|
||||
|
|
|
@ -47,9 +47,12 @@ spec:
|
|||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
serviceName: http-svc
|
||||
servicePort: 80
|
||||
service:
|
||||
name: http-svc
|
||||
port:
|
||||
number: 80
|
||||
" | kubectl create -f -
|
||||
```
|
||||
|
||||
|
|
|
@ -19,10 +19,13 @@ spec:
|
|||
- host: mydomain.com
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
serviceName: http-svc
|
||||
servicePort: 80
|
||||
path: /
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: http-svc
|
||||
port:
|
||||
number: 80
|
||||
tls:
|
||||
- hosts:
|
||||
- mydomain.com
|
||||
|
|
|
@ -30,10 +30,13 @@ spec:
|
|||
- host: external-auth-01.sample.com
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
serviceName: http-svc
|
||||
servicePort: 80
|
||||
path: /
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: http-svc
|
||||
port:
|
||||
number: 80
|
||||
status:
|
||||
loadBalancer:
|
||||
ingress:
|
||||
|
|
|
@ -9,7 +9,10 @@ spec:
|
|||
- host: external-auth-01.sample.com
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
serviceName: http-svc
|
||||
servicePort: 80
|
||||
path: /
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: http-svc
|
||||
port:
|
||||
number: 80
|
|
@ -11,11 +11,13 @@ spec:
|
|||
- host: __INGRESS_HOST__
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
serviceName: kubernetes-dashboard
|
||||
servicePort: 80
|
||||
path: /
|
||||
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: kubernetes-dashboard
|
||||
port:
|
||||
number: 80
|
||||
---
|
||||
|
||||
apiVersion: networking.k8s.io/v1
|
||||
|
@ -28,10 +30,13 @@ spec:
|
|||
- host: __INGRESS_HOST__
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
serviceName: oauth2-proxy
|
||||
servicePort: 4180
|
||||
path: /oauth2
|
||||
- path: /oauth2
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: oauth2-proxy
|
||||
port:
|
||||
number: 4180
|
||||
tls:
|
||||
- hosts:
|
||||
- __INGRESS_HOST__
|
||||
|
|
|
@ -64,7 +64,15 @@ metadata:
|
|||
name: nginxhello-ingress
|
||||
namespace: default
|
||||
spec:
|
||||
rules:
|
||||
- host: foo.bar.com
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
serviceName: nginxhello
|
||||
servicePort: 80
|
||||
service:
|
||||
name: nginxhello
|
||||
port:
|
||||
number: 80
|
||||
|
||||
|
|
|
@ -10,7 +10,10 @@ spec:
|
|||
- host: custom.configuration.com
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
serviceName: http-svc
|
||||
servicePort: 80
|
||||
path: /
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: http-svc
|
||||
port:
|
||||
number: 80
|
||||
|
|
|
@ -56,10 +56,13 @@ spec:
|
|||
- host: public-demo-echo-service.kube.local
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
serviceName: demo-echo-service
|
||||
servicePort: 80
|
||||
path: /
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: demo-echo-service
|
||||
port:
|
||||
number: 80
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
|
@ -74,7 +77,10 @@ spec:
|
|||
- host: secure-demo-echo-service.kube.local
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
serviceName: demo-echo-service
|
||||
servicePort: 80
|
||||
path: /
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: demo-echo-service
|
||||
port:
|
||||
number: 80
|
||||
|
|
|
@ -17,7 +17,10 @@ spec:
|
|||
- host: registry.<your domain>
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
serviceName: docker-registry
|
||||
servicePort: 5000
|
||||
path: /
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: docker-registry
|
||||
port:
|
||||
number: 5000
|
|
@ -12,7 +12,10 @@ spec:
|
|||
- host: registry.<your domain>
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
serviceName: docker-registry
|
||||
servicePort: 5000
|
||||
path: /
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: docker-registry
|
||||
port:
|
||||
number: 5000
|
||||
|
|
|
@ -115,14 +115,20 @@ spec:
|
|||
- host: foo.bar.com
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
serviceName: http-svc
|
||||
servicePort: 80
|
||||
path: /
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: http-svc
|
||||
port:
|
||||
number: 80
|
||||
- host: bar.baz.com
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
serviceName: nginx
|
||||
servicePort: 80
|
||||
path: /
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service
|
||||
name: nginx
|
||||
port:
|
||||
number: 80
|
||||
|
|
|
@ -46,10 +46,13 @@ spec:
|
|||
- host: rewrite.bar.com
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
serviceName: http-svc
|
||||
servicePort: 80
|
||||
path: /something(/|$)(.*)
|
||||
- path: /something(/|$)(.*)
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: http-svc
|
||||
port:
|
||||
number: 80
|
||||
' | kubectl create -f -
|
||||
```
|
||||
|
||||
|
@ -78,10 +81,13 @@ spec:
|
|||
- host: approot.bar.com
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
serviceName: http-svc
|
||||
servicePort: 80
|
||||
path: /
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: http-svc
|
||||
port:
|
||||
number: 80
|
||||
" | kubectl create -f -
|
||||
```
|
||||
|
||||
|
|
|
@ -9,7 +9,11 @@ spec:
|
|||
rules:
|
||||
- http:
|
||||
paths:
|
||||
- backend:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
# This assumes http-svc exists and routes to healthy endpoints.
|
||||
serviceName: http-svc
|
||||
servicePort: 80
|
||||
service:
|
||||
name: http-svc
|
||||
port:
|
||||
number: 80
|
||||
|
|
|
@ -27,10 +27,13 @@ spec:
|
|||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
# This assumes http-svc exists and routes to healthy endpoints
|
||||
serviceName: http-svc
|
||||
servicePort: 80
|
||||
service:
|
||||
name: http-svc
|
||||
port:
|
||||
number: 80
|
||||
```
|
||||
|
||||
The following command instructs the controller to terminate traffic using the provided
|
||||
|
|
|
@ -14,7 +14,10 @@ spec:
|
|||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
# This assumes http-svc exists and routes to healthy endpoints
|
||||
serviceName: http-svc
|
||||
servicePort: 80
|
||||
service:
|
||||
name: http-svc
|
||||
port:
|
||||
number: 80
|
||||
|
|
|
@ -74,9 +74,13 @@ spec:
|
|||
- host: app.example.com
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
serviceName: example-service
|
||||
servicePort: fastcgi
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: example-service
|
||||
port:
|
||||
name: fastcgi
|
||||
```
|
||||
|
||||
## FastCGI Ingress Annotations
|
||||
|
|
|
@ -27,9 +27,12 @@ spec:
|
|||
http:
|
||||
paths:
|
||||
- path: /foo/.*
|
||||
pathType: Prefix
|
||||
backend:
|
||||
serviceName: test
|
||||
servicePort: 80
|
||||
service:
|
||||
name: test
|
||||
port:
|
||||
number: 80
|
||||
```
|
||||
|
||||
The preceding ingress definition would translate to the following location block within the NGINX configuration for the `test.com` server:
|
||||
|
@ -61,13 +64,19 @@ spec:
|
|||
http:
|
||||
paths:
|
||||
- path: /foo/bar
|
||||
pathType: Prefix
|
||||
backend:
|
||||
serviceName: service1
|
||||
servicePort: 80
|
||||
service:
|
||||
name: service1
|
||||
port:
|
||||
number: 80
|
||||
- path: /foo/bar/
|
||||
pathType: Prefix
|
||||
backend:
|
||||
serviceName: service2
|
||||
servicePort: 80
|
||||
service:
|
||||
name: service2
|
||||
port:
|
||||
number: 80
|
||||
```
|
||||
|
||||
```yaml
|
||||
|
@ -83,9 +92,12 @@ spec:
|
|||
http:
|
||||
paths:
|
||||
- path: /foo/bar/(.+)
|
||||
pathType: Prefix
|
||||
backend:
|
||||
serviceName: service3
|
||||
servicePort: 80
|
||||
service:
|
||||
name: service3
|
||||
port:
|
||||
number: 80
|
||||
```
|
||||
|
||||
The ingress controller would define the following location blocks, in order of descending length, within the NGINX template for the `test.com` server:
|
||||
|
@ -137,13 +149,19 @@ spec:
|
|||
http:
|
||||
paths:
|
||||
- path: /foo/bar/bar
|
||||
pathType: Prefix
|
||||
backend:
|
||||
serviceName: test
|
||||
servicePort: 80
|
||||
service:
|
||||
name: test
|
||||
port:
|
||||
number: 80
|
||||
- path: /foo/bar/[A-Z0-9]{3}
|
||||
pathType: Prefix
|
||||
backend:
|
||||
serviceName: test
|
||||
servicePort: 80
|
||||
service:
|
||||
name: test
|
||||
port:
|
||||
number: 80
|
||||
```
|
||||
|
||||
The ingress controller would define the following location blocks (in this order) within the NGINX template for the `test.com` server:
|
||||
|
|
|
@ -189,10 +189,13 @@ In the Zipkin interface we can see the details:
|
|||
- host: example.com
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
serviceName: echoheaders-x
|
||||
servicePort: 80
|
||||
path: /echo
|
||||
- path: /echo
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: echoheaders-x
|
||||
port:
|
||||
number: 80
|
||||
' | kubectl apply -f -
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in a new issue