Expand developer docs

This commit is contained in:
bprashanth 2016-12-11 09:14:53 -08:00
parent cd07b0b06d
commit 939cb9c122
10 changed files with 362 additions and 5 deletions

70
examples/README.md Normal file
View file

@ -0,0 +1,70 @@
# Ingress examples
A catalog of examples on how to run, configure and scale Ingress.
## Basic cross platform
Name | Description | Platform | Complexity Level
-----| ----------- | ---------- | ----------------
Deployment | basic deployment of controllers | * | Beginner
TLS termination | terminate TLS at the ingress controller | * | Beginner
Name based virtual hosting | `Host` header routing | * | Beginner
Path routing | URL regex routing | * | Beginner
Health checking | configure/optimize health checks | * | Intermediate
Pipeline | pipeline cloud and nginx | * | Advanced
## TLS
Name | Description | Platform | Complexity Level
-----| ----------- | ---------- | ----------------
LetsEncrypt | acquire certs via ACME protocol | * | Intermediate
Intermediate certs | terminate TLS with intermediate certs | * | Advanced
Client certs | client cert authentication | nginx | Advanced
Re-encrypty | terminate, apply routing rules, re-encrypt | nginx | Advanced
## Scaling
Name | Description | Platform | Complexity Level
-----| ----------- | ---------- | ----------------
Daemonset | run multiple controllers in a daemonset | nginx | Intermediate
Deployment | run multiple controllers as a deployment | nginx | Intermediate
Multi-zone | bridge different zones in a single cluster | gce | Intermediate
Static-ip | a single ingress gets a single static ip | * | Intermediate
Geo-routing | route to geographically closest endpoint | nginx | Advanced
Multi-cluster | bridge Kubernetes clusters with Ingress | gce | Advanced
## Algorithms
Name | Description | Platform | Complexity Level
-----| ----------- | ---------- | ----------------
Session stickyness | route requests consistently to the same endpoint | nginx | Advanced
Least connections | route requests based on least connections | on-perm | Advanced
Weights | route requrests to backends based on weights | nginx | Advanced
## Routing
Name | Description | Platform | Complexity Level
-----| ----------- | ---------- | ----------------
Redirects | send a 301 re-direct | nginx | Intermediate
URL-rewriting | re-write path | nginx | Intermediate
SNI + HTTP | HTTP routing based on SNI hostname | nginx | Advanced
SNI + TCP | TLS routing based on SNI hostname | nginx | Advanced
## Auth
Name | Description | Platform | Complexity Level
-----| ----------- | ---------- | ----------------
Basic auth | password protect your website | nginx | Intermediate
External auth plugin | defer to an external auth service | nginx | Intermediate
## Protocols
Name | Description | Platform | Complexity Level
-----| ----------- | ---------- | ----------------
TCP | TCP loadbalancing | nginx | Intermediate
UDP | UDP loadbalancing | nginx | Intermediate
Websockets | websockets loadbalancing | nginx | Intermediate
HTTP/2 | HTTP/2 loadbalancing | * | Intermediate
Proxy protocol | leverage the proxy protocol for source IP | nginx | Advanced

View file

@ -0,0 +1,49 @@
# Deploying an Nginx Ingress controller
This example aims to demonstrate the deployment of an nginx ingress controller.
## Default Backend
The default backend is a Service capable of handling all url paths and hosts the
nginx controller doesn't understand. This most basic implementation just returns
a 404 page:
```console
$ kubectl create -f default-backend.yaml
replicationcontroller "default-http-backend" created
$ kubectl expose rc default-http-backend --port=80 --target-port=8080 --name=default-http-backend
service "default-http-backend" exposed
$ kubectl get po
NAME READY STATUS RESTARTS AGE
default-http-backend-ppqdj 1/1 Running 0 1m
```
## Controller
You can deploy the controller as follows:
```console
$ kubectl create -f rc.yaml
replicationcontroller "nginx-ingress-controller" created
$ kubectl get po
NAME READY STATUS RESTARTS AGE
default-http-backend-ppqdj 1/1 Running 0 1m
nginx-ingress-controller-vbgf9 0/1 ContainerCreating 0 2s
```
Note the default settings of this controller:
* serves a `/healthz` url on port 10254, as both a liveness and readiness probe
* takes a `--default-backend-service` arg pointing to a Service, created above
## Running on a cloud provider
If you're running this ingress controller on a cloudprovider, you should assume
the provider also has a native Ingress controller and set the annotation
`kubernetes.io/ingress.class: nginx` in all Ingresses meant for this controller.
You might also need to open a firewall-rule for ports 80/443 of the nodes the
controller is running on.

View file

@ -0,0 +1,36 @@
apiVersion: v1
kind: ReplicationController
metadata:
name: default-http-backend
spec:
replicas: 1
selector:
app: default-http-backend
template:
metadata:
labels:
app: default-http-backend
spec:
terminationGracePeriodSeconds: 60
containers:
- name: default-http-backend
# Any image is permissable as long as:
# 1. It serves a 404 page at /
# 2. It serves 200 on a /healthz endpoint
image: gcr.io/google_containers/defaultbackend:1.0
livenessProbe:
httpGet:
path: /healthz
port: 8080
scheme: HTTP
initialDelaySeconds: 30
timeoutSeconds: 5
ports:
- containerPort: 8080
resources:
limits:
cpu: 10m
memory: 20Mi
requests:
cpu: 10m
memory: 20Mi

View file

@ -0,0 +1,51 @@
apiVersion: v1
kind: ReplicationController
metadata:
name: nginx-ingress-controller
labels:
k8s-app: nginx-ingress-lb
spec:
replicas: 1
selector:
k8s-app: nginx-ingress-lb
template:
metadata:
labels:
k8s-app: nginx-ingress-lb
name: nginx-ingress-lb
spec:
terminationGracePeriodSeconds: 60
containers:
- image: gcr.io/google_containers/nginx-ingress-controller:0.8.3
name: nginx-ingress-lb
imagePullPolicy: Always
readinessProbe:
httpGet:
path: /healthz
port: 10254
scheme: HTTP
livenessProbe:
httpGet:
path: /healthz
port: 10254
scheme: HTTP
initialDelaySeconds: 10
timeoutSeconds: 1
# use downward API
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
ports:
- containerPort: 80
hostPort: 80
- containerPort: 443
hostPort: 443
args:
- /nginx-ingress-controller
- --default-backend-service=$(POD_NAMESPACE)/default-http-backend