Skip to content

Commit

Permalink
Merge pull request #360 from chentao1596/multi-deployment
Browse files Browse the repository at this point in the history
add example of 'run multiple nginx ingress controllers as a deployment'
  • Loading branch information
aledbf authored Mar 2, 2017
2 parents b1ba356 + c25b455 commit 2926560
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 0 deletions.
41 changes: 41 additions & 0 deletions examples/scaling-deployment/nginx/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Deploying multi Nginx Ingress Controllers

This example aims to demonstrate the Deployment of multi nginx ingress controllers.

## Default Backend

The default backend is a service of handling all url paths and hosts the nginx controller doesn't understand. Deploy the default-http-backend as follow:

```console
$ kubectl apply -f ../../deployment/nginx/default-backend.yaml
deployment "default-http-backend" configured
service "default-http-backend" configured

$ kubectl -n kube-system get svc
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
default-http-backend 192.168.3.52 <none> 80/TCP 6m

$ kubectl -n kube-system get po
NAME READY STATUS RESTARTS AGE
default-http-backend-2657704409-wz6o3 1/1 Running 0 6m
```

## Ingress Deployment

Deploy the Deployment of multi controllers as follows:

```console
$ kubectl apply -f nginx-ingress-deployment.yaml
deployment "nginx-ingress-controller" created

$ kubectl -n kube-system get deployment
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
default-http-backend 1 1 1 1 16m
nginx-ingress-controller 2 2 2 2 24s

$ kubectl -n kube-system get po
NAME READY STATUS RESTARTS AGE
default-http-backend-2657704409-wz6o3 1/1 Running 0 16m
nginx-ingress-controller-3752011415-0qbi6 1/1 Running 0 39s
nginx-ingress-controller-3752011415-vi8fq 1/1 Running 0 39s
```
47 changes: 47 additions & 0 deletions examples/scaling-deployment/nginx/nginx-ingress-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: nginx-ingress-controller
labels:
k8s-app: nginx-ingress-controller
namespace: kube-system
spec:
replicas: 2
template:
metadata:
labels:
k8s-app: nginx-ingress-controller
spec:
terminationGracePeriodSeconds: 60
containers:
- image: gcr.io/google_containers/nginx-ingress-controller:0.9.0-beta.2
name: nginx-ingress-controller
readinessProbe:
httpGet:
path: /healthz
port: 10254
scheme: HTTP
livenessProbe:
httpGet:
path: /healthz
port: 10254
scheme: HTTP
initialDelaySeconds: 10
timeoutSeconds: 1
ports:
- containerPort: 80
hostPort: 80
- containerPort: 443
hostPort: 443
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
args:
- /nginx-ingress-controller
- --default-backend-service=$(POD_NAMESPACE)/default-http-backend

0 comments on commit 2926560

Please sign in to comment.