Fix https port

This commit is contained in:
Manuel de Brito Fontes 2016-04-13 14:37:08 -03:00
parent 87297ade32
commit f05eec6781
10 changed files with 52 additions and 53 deletions

View file

@ -241,3 +241,5 @@ The previous behavior can be restored using `retry-non-idempotent=true` in the c
## Limitations ## Limitations
- Ingress rules for TLS require the definition of the field `host` - Ingress rules for TLS require the definition of the field `host`
- The IP address in the status of loadBalancer could contain old values

View file

@ -0,0 +1,8 @@
All the examples references the services `echoheaders-x` and `echoheaders-y`
```
kubectl run echoheaders --image=gcr.io/google_containers/echoserver:1.3 --replicas=1 --port=8080
kubectl expose deployment echoheaders --port=80 --target-port=8080 --name=echoheaders-x
kubectl expose deployment echoheaders --port=80 --target-port=8080 --name=echoheaders-x
```

View file

@ -40,7 +40,7 @@ spec:
- containerPort: 80 - containerPort: 80
hostPort: 80 hostPort: 80
- containerPort: 443 - containerPort: 443
hostPort: 4444 hostPort: 443
args: args:
- /nginx-ingress-controller - /nginx-ingress-controller
- --default-backend-service=default/default-http-backend - --default-backend-service=default/default-http-backend

View file

@ -34,7 +34,7 @@ spec:
- containerPort: 80 - containerPort: 80
hostPort: 80 hostPort: 80
- containerPort: 443 - containerPort: 443
hostPort: 4444 hostPort: 443
args: args:
- /nginx-ingress-controller - /nginx-ingress-controller
- --default-backend-service=default/default-http-backend - --default-backend-service=default/default-http-backend

View file

@ -40,7 +40,7 @@ spec:
- containerPort: 80 - containerPort: 80
hostPort: 80 hostPort: 80
- containerPort: 443 - containerPort: 443
hostPort: 4444 hostPort: 443
args: args:
- /nginx-ingress-controller - /nginx-ingress-controller
- --default-backend-service=default/default-http-backend - --default-backend-service=default/default-http-backend

View file

@ -45,7 +45,7 @@ spec:
- containerPort: 80 - containerPort: 80
hostPort: 80 hostPort: 80
- containerPort: 443 - containerPort: 443
hostPort: 4444 hostPort: 443
- containerPort: 8080 - containerPort: 8080
hostPort: 9000 hostPort: 9000
volumeMounts: volumeMounts:

View file

@ -40,7 +40,7 @@ spec:
- containerPort: 80 - containerPort: 80
hostPort: 80 hostPort: 80
- containerPort: 443 - containerPort: 443
hostPort: 4444 hostPort: 443
# we expose 8080 to access nginx stats in url /nginx-status # we expose 8080 to access nginx stats in url /nginx-status
# this is optional # this is optional
- containerPort: 8080 - containerPort: 8080

View file

@ -1,11 +1,12 @@
This is an example to use a TLS Ingress rule to use SSL in NGINX This is an example to use a TLS Ingress rule to use SSL in NGINX
*First expose the `echoheaders` service:* # TLS certificate termination
``` This examples uses 2 different certificates to terminate SSL for 2 hostnames.
kubectl run echoheaders --image=gcr.io/google_containers/echoserver:1.3 --replicas=1 --port=8080
kubectl expose deployment echoheaders --port=80 --target-port=8080 --name=echoheaders-x 1. Deploy the controller by creating the rc in the parent dir
``` 2. Create tls secret for foo.bar.com
3. Create rc-ssl.yaml
*Next create a SSL certificate for `foo.bar.com` host:* *Next create a SSL certificate for `foo.bar.com` host:*
@ -30,6 +31,7 @@ data:
*Finally create a tls Ingress rule:* *Finally create a tls Ingress rule:*
``` ```
echo "
apiVersion: extensions/v1beta1 apiVersion: extensions/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:
@ -51,51 +53,38 @@ spec:
" | kubectl create -f - " | kubectl create -f -
``` ```
You should be able to reach your nginx service or echoheaders service using a hostname:
``` ```
TODO: $ kubectl get ing
- show logs NAME RULE BACKEND ADDRESS
- curl foo - 10.4.0.3
foo.bar.com
/ echoheaders-x:80
``` ```
##### Another example:
This shows a more complex example that creates the servers `foo.bar.com` and `bar.baz.com` where only `foo.bar.com` uses SSL
```
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: complex-foo
namespace: default
spec:
tls:
- hosts:
- foo.bar.com
secretName: foo-tls
- hosts:
- bar.baz.com
secretName: foo-tls
rules:
- host: foo.bar.com
http:
paths:
- backend:
serviceName: echoheaders-x
servicePort: 80
path: /
- host: bar.baz.com
http:
paths:
- backend:
serviceName: echoheaders-y
servicePort: 80
path: /
``` ```
$ curl https://10.4.0.3 -H 'Host:foo.bar.com' -k
old-mbp:contrib aledbf$ curl https://10.4.0.3 -H 'Host:foo.bar.com' -k
CLIENT VALUES:
client_address=10.2.48.4
command=GET
real path=/
query=nil
request_version=1.1
request_uri=http://foo.bar.com:8080/
SERVER VALUES:
server_version=nginx: 1.9.7 - lua: 9019
``` HEADERS RECEIVED:
TODO: accept=*/*
- show logs connection=close
- curl host=foo.bar.com
user-agent=curl/7.43.0
x-forwarded-for=10.2.48.1
x-forwarded-host=foo.bar.com
x-forwarded-proto=https
x-real-ip=10.2.48.1
BODY:
-no body in request-
``` ```

View file

@ -40,7 +40,7 @@ spec:
- containerPort: 80 - containerPort: 80
hostPort: 80 hostPort: 80
- containerPort: 443 - containerPort: 443
hostPort: 4444 hostPort: 443
- containerPort: 8080 - containerPort: 8080
hostPort: 9000 hostPort: 9000
args: args:

View file

@ -40,7 +40,7 @@ spec:
- containerPort: 80 - containerPort: 80
hostPort: 80 hostPort: 80
- containerPort: 443 - containerPort: 443
hostPort: 4444 hostPort: 443
# we expose 8080 to access nginx stats in url /nginx-status # we expose 8080 to access nginx stats in url /nginx-status
# this is optional # this is optional
- containerPort: 8080 - containerPort: 8080