add example of 'run multiple nginx ingress controllers as a deployment'
This commit is contained in:
parent
fb8e2d7373
commit
c25b455e9d
2 changed files with 88 additions and 0 deletions
41
examples/scaling-deployment/nginx/README.md
Normal file
41
examples/scaling-deployment/nginx/README.md
Normal file
|
@ -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
|
||||
```
|
|
@ -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
|
Loading…
Reference in a new issue