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)
|
## Create an ingress (please add any additional annotation required)
|
||||||
|
|
||||||
echo "
|
echo "
|
||||||
apiVersion: networking.k8s.io/v1beta1
|
apiVersion: networking.k8s.io/v1
|
||||||
kind: Ingress
|
kind: Ingress
|
||||||
metadata:
|
metadata:
|
||||||
name: foo-bar
|
name: foo-bar
|
||||||
|
@ -109,10 +109,13 @@ echo "
|
||||||
- host: foo.bar
|
- host: foo.bar
|
||||||
http:
|
http:
|
||||||
paths:
|
paths:
|
||||||
- backend:
|
- path: /
|
||||||
serviceName: http-svc
|
pathType: Prefix
|
||||||
servicePort: 80
|
backend:
|
||||||
path: /
|
service:
|
||||||
|
name: http-svc
|
||||||
|
port:
|
||||||
|
number: 80
|
||||||
" | kubectl apply -f -
|
" | kubectl apply -f -
|
||||||
|
|
||||||
## make a request
|
## make a request
|
||||||
|
|
|
@ -15,10 +15,13 @@ spec:
|
||||||
- host: stickyingress-samesite-none.example.com
|
- host: stickyingress-samesite-none.example.com
|
||||||
http:
|
http:
|
||||||
paths:
|
paths:
|
||||||
- backend:
|
- path: /
|
||||||
serviceName: http-svc
|
pathType: Prefix
|
||||||
servicePort: 80
|
backend:
|
||||||
path: /
|
service:
|
||||||
|
name: http-svc
|
||||||
|
port:
|
||||||
|
number: 80
|
||||||
---
|
---
|
||||||
apiVersion: networking.k8s.io/v1
|
apiVersion: networking.k8s.io/v1
|
||||||
kind: Ingress
|
kind: Ingress
|
||||||
|
@ -35,7 +38,10 @@ spec:
|
||||||
- host: stickyingress-samesite-strict.example.com
|
- host: stickyingress-samesite-strict.example.com
|
||||||
http:
|
http:
|
||||||
paths:
|
paths:
|
||||||
- backend:
|
- path: /
|
||||||
serviceName: http-svc
|
pathType: Prefix
|
||||||
servicePort: 80
|
backend:
|
||||||
path: /
|
service:
|
||||||
|
name: http-svc
|
||||||
|
port:
|
||||||
|
number: 80
|
|
@ -13,7 +13,10 @@ spec:
|
||||||
- host: stickyingress.example.com
|
- host: stickyingress.example.com
|
||||||
http:
|
http:
|
||||||
paths:
|
paths:
|
||||||
- backend:
|
- path: /
|
||||||
serviceName: http-svc
|
pathType: Prefix
|
||||||
servicePort: 80
|
backend:
|
||||||
path: /
|
service:
|
||||||
|
name: http-svc
|
||||||
|
port:
|
||||||
|
number: 80
|
||||||
|
|
|
@ -47,9 +47,12 @@ spec:
|
||||||
http:
|
http:
|
||||||
paths:
|
paths:
|
||||||
- path: /
|
- path: /
|
||||||
|
pathType: Prefix
|
||||||
backend:
|
backend:
|
||||||
serviceName: http-svc
|
service:
|
||||||
servicePort: 80
|
name: http-svc
|
||||||
|
port:
|
||||||
|
number: 80
|
||||||
" | kubectl create -f -
|
" | kubectl create -f -
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -19,10 +19,13 @@ spec:
|
||||||
- host: mydomain.com
|
- host: mydomain.com
|
||||||
http:
|
http:
|
||||||
paths:
|
paths:
|
||||||
- backend:
|
- path: /
|
||||||
serviceName: http-svc
|
pathType: Prefix
|
||||||
servicePort: 80
|
backend:
|
||||||
path: /
|
service:
|
||||||
|
name: http-svc
|
||||||
|
port:
|
||||||
|
number: 80
|
||||||
tls:
|
tls:
|
||||||
- hosts:
|
- hosts:
|
||||||
- mydomain.com
|
- mydomain.com
|
||||||
|
|
|
@ -30,10 +30,13 @@ spec:
|
||||||
- host: external-auth-01.sample.com
|
- host: external-auth-01.sample.com
|
||||||
http:
|
http:
|
||||||
paths:
|
paths:
|
||||||
- backend:
|
- path: /
|
||||||
serviceName: http-svc
|
pathType: Prefix
|
||||||
servicePort: 80
|
backend:
|
||||||
path: /
|
service:
|
||||||
|
name: http-svc
|
||||||
|
port:
|
||||||
|
number: 80
|
||||||
status:
|
status:
|
||||||
loadBalancer:
|
loadBalancer:
|
||||||
ingress:
|
ingress:
|
||||||
|
|
|
@ -9,7 +9,10 @@ spec:
|
||||||
- host: external-auth-01.sample.com
|
- host: external-auth-01.sample.com
|
||||||
http:
|
http:
|
||||||
paths:
|
paths:
|
||||||
- backend:
|
- path: /
|
||||||
serviceName: http-svc
|
pathType: Prefix
|
||||||
servicePort: 80
|
backend:
|
||||||
path: /
|
service:
|
||||||
|
name: http-svc
|
||||||
|
port:
|
||||||
|
number: 80
|
|
@ -11,11 +11,13 @@ spec:
|
||||||
- host: __INGRESS_HOST__
|
- host: __INGRESS_HOST__
|
||||||
http:
|
http:
|
||||||
paths:
|
paths:
|
||||||
- backend:
|
- path: /
|
||||||
serviceName: kubernetes-dashboard
|
pathType: Prefix
|
||||||
servicePort: 80
|
backend:
|
||||||
path: /
|
service:
|
||||||
|
name: kubernetes-dashboard
|
||||||
|
port:
|
||||||
|
number: 80
|
||||||
---
|
---
|
||||||
|
|
||||||
apiVersion: networking.k8s.io/v1
|
apiVersion: networking.k8s.io/v1
|
||||||
|
@ -28,10 +30,13 @@ spec:
|
||||||
- host: __INGRESS_HOST__
|
- host: __INGRESS_HOST__
|
||||||
http:
|
http:
|
||||||
paths:
|
paths:
|
||||||
- backend:
|
- path: /oauth2
|
||||||
serviceName: oauth2-proxy
|
pathType: Prefix
|
||||||
servicePort: 4180
|
backend:
|
||||||
path: /oauth2
|
service:
|
||||||
|
name: oauth2-proxy
|
||||||
|
port:
|
||||||
|
number: 4180
|
||||||
tls:
|
tls:
|
||||||
- hosts:
|
- hosts:
|
||||||
- __INGRESS_HOST__
|
- __INGRESS_HOST__
|
||||||
|
|
|
@ -64,7 +64,15 @@ metadata:
|
||||||
name: nginxhello-ingress
|
name: nginxhello-ingress
|
||||||
namespace: default
|
namespace: default
|
||||||
spec:
|
spec:
|
||||||
backend:
|
rules:
|
||||||
serviceName: nginxhello
|
- host: foo.bar.com
|
||||||
servicePort: 80
|
http:
|
||||||
|
paths:
|
||||||
|
- path: /
|
||||||
|
pathType: Prefix
|
||||||
|
backend:
|
||||||
|
service:
|
||||||
|
name: nginxhello
|
||||||
|
port:
|
||||||
|
number: 80
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,10 @@ spec:
|
||||||
- host: custom.configuration.com
|
- host: custom.configuration.com
|
||||||
http:
|
http:
|
||||||
paths:
|
paths:
|
||||||
- backend:
|
- path: /
|
||||||
serviceName: http-svc
|
pathType: Prefix
|
||||||
servicePort: 80
|
backend:
|
||||||
path: /
|
service:
|
||||||
|
name: http-svc
|
||||||
|
port:
|
||||||
|
number: 80
|
||||||
|
|
|
@ -56,10 +56,13 @@ spec:
|
||||||
- host: public-demo-echo-service.kube.local
|
- host: public-demo-echo-service.kube.local
|
||||||
http:
|
http:
|
||||||
paths:
|
paths:
|
||||||
- backend:
|
- path: /
|
||||||
serviceName: demo-echo-service
|
pathType: Prefix
|
||||||
servicePort: 80
|
backend:
|
||||||
path: /
|
service:
|
||||||
|
name: demo-echo-service
|
||||||
|
port:
|
||||||
|
number: 80
|
||||||
---
|
---
|
||||||
apiVersion: networking.k8s.io/v1
|
apiVersion: networking.k8s.io/v1
|
||||||
kind: Ingress
|
kind: Ingress
|
||||||
|
@ -74,7 +77,10 @@ spec:
|
||||||
- host: secure-demo-echo-service.kube.local
|
- host: secure-demo-echo-service.kube.local
|
||||||
http:
|
http:
|
||||||
paths:
|
paths:
|
||||||
- backend:
|
- path: /
|
||||||
serviceName: demo-echo-service
|
pathType: Prefix
|
||||||
servicePort: 80
|
backend:
|
||||||
path: /
|
service:
|
||||||
|
name: demo-echo-service
|
||||||
|
port:
|
||||||
|
number: 80
|
||||||
|
|
|
@ -17,7 +17,10 @@ spec:
|
||||||
- host: registry.<your domain>
|
- host: registry.<your domain>
|
||||||
http:
|
http:
|
||||||
paths:
|
paths:
|
||||||
- backend:
|
- path: /
|
||||||
serviceName: docker-registry
|
pathType: Prefix
|
||||||
servicePort: 5000
|
backend:
|
||||||
path: /
|
service:
|
||||||
|
name: docker-registry
|
||||||
|
port:
|
||||||
|
number: 5000
|
|
@ -12,7 +12,10 @@ spec:
|
||||||
- host: registry.<your domain>
|
- host: registry.<your domain>
|
||||||
http:
|
http:
|
||||||
paths:
|
paths:
|
||||||
- backend:
|
- path: /
|
||||||
serviceName: docker-registry
|
pathType: Prefix
|
||||||
servicePort: 5000
|
backend:
|
||||||
path: /
|
service:
|
||||||
|
name: docker-registry
|
||||||
|
port:
|
||||||
|
number: 5000
|
||||||
|
|
|
@ -115,14 +115,20 @@ spec:
|
||||||
- host: foo.bar.com
|
- host: foo.bar.com
|
||||||
http:
|
http:
|
||||||
paths:
|
paths:
|
||||||
- backend:
|
- path: /
|
||||||
serviceName: http-svc
|
pathType: Prefix
|
||||||
servicePort: 80
|
backend:
|
||||||
path: /
|
service:
|
||||||
|
name: http-svc
|
||||||
|
port:
|
||||||
|
number: 80
|
||||||
- host: bar.baz.com
|
- host: bar.baz.com
|
||||||
http:
|
http:
|
||||||
paths:
|
paths:
|
||||||
- backend:
|
- path: /
|
||||||
serviceName: nginx
|
pathType: Prefix
|
||||||
servicePort: 80
|
backend:
|
||||||
path: /
|
service
|
||||||
|
name: nginx
|
||||||
|
port:
|
||||||
|
number: 80
|
||||||
|
|
|
@ -46,10 +46,13 @@ spec:
|
||||||
- host: rewrite.bar.com
|
- host: rewrite.bar.com
|
||||||
http:
|
http:
|
||||||
paths:
|
paths:
|
||||||
- backend:
|
- path: /something(/|$)(.*)
|
||||||
serviceName: http-svc
|
pathType: Prefix
|
||||||
servicePort: 80
|
backend:
|
||||||
path: /something(/|$)(.*)
|
service:
|
||||||
|
name: http-svc
|
||||||
|
port:
|
||||||
|
number: 80
|
||||||
' | kubectl create -f -
|
' | kubectl create -f -
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -78,10 +81,13 @@ spec:
|
||||||
- host: approot.bar.com
|
- host: approot.bar.com
|
||||||
http:
|
http:
|
||||||
paths:
|
paths:
|
||||||
- backend:
|
- path: /
|
||||||
serviceName: http-svc
|
pathType: Prefix
|
||||||
servicePort: 80
|
backend:
|
||||||
path: /
|
service:
|
||||||
|
name: http-svc
|
||||||
|
port:
|
||||||
|
number: 80
|
||||||
" | kubectl create -f -
|
" | kubectl create -f -
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,11 @@ spec:
|
||||||
rules:
|
rules:
|
||||||
- http:
|
- http:
|
||||||
paths:
|
paths:
|
||||||
- backend:
|
- path: /
|
||||||
|
pathType: Prefix
|
||||||
|
backend:
|
||||||
# This assumes http-svc exists and routes to healthy endpoints.
|
# This assumes http-svc exists and routes to healthy endpoints.
|
||||||
serviceName: http-svc
|
service:
|
||||||
servicePort: 80
|
name: http-svc
|
||||||
|
port:
|
||||||
|
number: 80
|
||||||
|
|
|
@ -27,10 +27,13 @@ spec:
|
||||||
http:
|
http:
|
||||||
paths:
|
paths:
|
||||||
- path: /
|
- path: /
|
||||||
|
pathType: Prefix
|
||||||
backend:
|
backend:
|
||||||
# This assumes http-svc exists and routes to healthy endpoints
|
# This assumes http-svc exists and routes to healthy endpoints
|
||||||
serviceName: http-svc
|
service:
|
||||||
servicePort: 80
|
name: http-svc
|
||||||
|
port:
|
||||||
|
number: 80
|
||||||
```
|
```
|
||||||
|
|
||||||
The following command instructs the controller to terminate traffic using the provided
|
The following command instructs the controller to terminate traffic using the provided
|
||||||
|
|
|
@ -14,7 +14,10 @@ spec:
|
||||||
http:
|
http:
|
||||||
paths:
|
paths:
|
||||||
- path: /
|
- path: /
|
||||||
|
pathType: Prefix
|
||||||
backend:
|
backend:
|
||||||
# This assumes http-svc exists and routes to healthy endpoints
|
# This assumes http-svc exists and routes to healthy endpoints
|
||||||
serviceName: http-svc
|
service:
|
||||||
servicePort: 80
|
name: http-svc
|
||||||
|
port:
|
||||||
|
number: 80
|
||||||
|
|
|
@ -74,9 +74,13 @@ spec:
|
||||||
- host: app.example.com
|
- host: app.example.com
|
||||||
http:
|
http:
|
||||||
paths:
|
paths:
|
||||||
- backend:
|
- path: /
|
||||||
serviceName: example-service
|
pathType: Prefix
|
||||||
servicePort: fastcgi
|
backend:
|
||||||
|
service:
|
||||||
|
name: example-service
|
||||||
|
port:
|
||||||
|
name: fastcgi
|
||||||
```
|
```
|
||||||
|
|
||||||
## FastCGI Ingress Annotations
|
## FastCGI Ingress Annotations
|
||||||
|
|
|
@ -27,9 +27,12 @@ spec:
|
||||||
http:
|
http:
|
||||||
paths:
|
paths:
|
||||||
- path: /foo/.*
|
- path: /foo/.*
|
||||||
|
pathType: Prefix
|
||||||
backend:
|
backend:
|
||||||
serviceName: test
|
service:
|
||||||
servicePort: 80
|
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:
|
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:
|
http:
|
||||||
paths:
|
paths:
|
||||||
- path: /foo/bar
|
- path: /foo/bar
|
||||||
|
pathType: Prefix
|
||||||
backend:
|
backend:
|
||||||
serviceName: service1
|
service:
|
||||||
servicePort: 80
|
name: service1
|
||||||
|
port:
|
||||||
|
number: 80
|
||||||
- path: /foo/bar/
|
- path: /foo/bar/
|
||||||
|
pathType: Prefix
|
||||||
backend:
|
backend:
|
||||||
serviceName: service2
|
service:
|
||||||
servicePort: 80
|
name: service2
|
||||||
|
port:
|
||||||
|
number: 80
|
||||||
```
|
```
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
@ -83,9 +92,12 @@ spec:
|
||||||
http:
|
http:
|
||||||
paths:
|
paths:
|
||||||
- path: /foo/bar/(.+)
|
- path: /foo/bar/(.+)
|
||||||
|
pathType: Prefix
|
||||||
backend:
|
backend:
|
||||||
serviceName: service3
|
service:
|
||||||
servicePort: 80
|
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:
|
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:
|
http:
|
||||||
paths:
|
paths:
|
||||||
- path: /foo/bar/bar
|
- path: /foo/bar/bar
|
||||||
|
pathType: Prefix
|
||||||
backend:
|
backend:
|
||||||
serviceName: test
|
service:
|
||||||
servicePort: 80
|
name: test
|
||||||
|
port:
|
||||||
|
number: 80
|
||||||
- path: /foo/bar/[A-Z0-9]{3}
|
- path: /foo/bar/[A-Z0-9]{3}
|
||||||
|
pathType: Prefix
|
||||||
backend:
|
backend:
|
||||||
serviceName: test
|
service:
|
||||||
servicePort: 80
|
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:
|
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
|
- host: example.com
|
||||||
http:
|
http:
|
||||||
paths:
|
paths:
|
||||||
- backend:
|
- path: /echo
|
||||||
serviceName: echoheaders-x
|
pathType: Prefix
|
||||||
servicePort: 80
|
backend:
|
||||||
path: /echo
|
service:
|
||||||
|
name: echoheaders-x
|
||||||
|
port:
|
||||||
|
number: 80
|
||||||
' | kubectl apply -f -
|
' | kubectl apply -f -
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue