2017-01-05 07:40:40 +00:00
|
|
|
# Deploying the Nginx Ingress controller
|
2016-12-11 17:14:53 +00:00
|
|
|
|
|
|
|
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:
|
|
|
|
|
2017-01-05 07:40:40 +00:00
|
|
|
```console
|
|
|
|
$ kubectl apply -f default-backend.yaml
|
|
|
|
deployment "default-http-backend" created
|
|
|
|
service "default-http-backend" created
|
2016-12-11 17:14:53 +00:00
|
|
|
|
2017-08-03 04:02:02 +00:00
|
|
|
$ kubectl -n kube-system get pods
|
2017-01-05 07:40:40 +00:00
|
|
|
NAME READY STATUS RESTARTS AGE
|
|
|
|
default-http-backend-2657704409-qgwdd 1/1 Running 0 28s
|
2016-12-11 17:14:53 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Controller
|
|
|
|
|
|
|
|
You can deploy the controller as follows:
|
|
|
|
|
2017-08-03 04:02:02 +00:00
|
|
|
1. Disable the ingress addon:
|
|
|
|
```console
|
|
|
|
$ minikube addons disable ingress
|
|
|
|
```
|
|
|
|
2. Use the [docker daemon](https://github.com/kubernetes/minikube/blob/master/docs/reusing_the_docker_daemon.md)
|
2017-08-03 16:29:02 +00:00
|
|
|
3. [Build the image](../../../docs/dev/getting-started.md)
|
|
|
|
4. Change [nginx-ingress-controller.yaml](nginx-ingress-controller.yaml) to use the appropriate image. Local images can be
|
2017-08-03 04:02:02 +00:00
|
|
|
seen by performing `docker images`.
|
|
|
|
```yaml
|
|
|
|
image: <IMAGE-NAME>:<TAG>
|
|
|
|
```
|
2017-08-03 16:29:02 +00:00
|
|
|
5. Create the nginx-ingress-controller deployment:
|
2016-12-11 17:14:53 +00:00
|
|
|
```console
|
2017-01-05 07:40:40 +00:00
|
|
|
$ kubectl apply -f nginx-ingress-controller.yaml
|
|
|
|
deployment "nginx-ingress-controller" created
|
2016-12-11 17:14:53 +00:00
|
|
|
|
2017-08-03 04:02:02 +00:00
|
|
|
$ kubectl -n kube-system get pods
|
2017-01-05 07:40:40 +00:00
|
|
|
NAME READY STATUS RESTARTS AGE
|
|
|
|
default-http-backend-2657704409-qgwdd 1/1 Running 0 2m
|
|
|
|
nginx-ingress-controller-873061567-4n3k2 1/1 Running 0 42s
|
2016-12-11 17:14:53 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
Note the default settings of this controller:
|
2017-08-03 04:02:02 +00:00
|
|
|
* serves a `/healthz` url on port 10254, as a status probe
|
2017-01-05 07:40:40 +00:00
|
|
|
* takes a `--default-backend-service` argument pointing to the Service created above
|
2016-12-11 17:14:53 +00:00
|
|
|
|
|
|
|
## Running on a cloud provider
|
|
|
|
|
2017-08-03 04:02:02 +00:00
|
|
|
If you're running this ingress controller on a cloud-provider, you should assume
|
2016-12-11 17:14:53 +00:00
|
|
|
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.
|