Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable internal-default-backend by default #335

Merged
merged 1 commit into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 7 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,17 @@ Hub](https://hub.docker.com/r/zlabjp/nghttpx-ingress-controller/).

## Requirements

If `--internal-default-backend` flag is given to false, the default
backend service is necessary:

- default backend [404-server](examples/default-backend.yaml)

Actually, any backend web server will suffice as long as it returns
some kind of error code for any requests.

If `--internal-default-backend` flag is given, the default backend
service is not necessary. The controller configures nghttpx to act as
a default backend.

## Deploy the Ingress controller

Before the deploy of the Ingress controller we need a default backend:

```
$ kubectl create -f examples/default-backend.yaml
$ kubectl expose deployment default-http-backend --port=80 --target-port=8080 --name=default-http-backend
```

Load balancers are created via a Deployment or DaemonSet:

```
Expand Down Expand Up @@ -304,14 +297,14 @@ kubctl apply -f examples/proxyproto/
The default backend is used when the request does not match any given
rules. The default backend must be set in command-line flag of
nghttpx Ingress controller unless `--internal-default-backend` flag is
given, see below. It can be overridden by specifying
given to false, see below. It can be overridden by specifying
Ingress.Spec.Backend. If multiple Ingress resources have
.Spec.Backend, one of them is used, but it is undefined which one is
used. The default backend always does not require TLS.

If `--internal-default-backend` is used, the controller configures
nghttpx to act as a default backend. In this case, the default
backend service is not necessary.
If `--internal-default-backend` is given to true, which is the
default, the controller configures nghttpx to act as a default
backend. In this case, the default backend service is not necessary.

## Services without selectors

Expand Down
2 changes: 1 addition & 1 deletion cmd/nghttpx-ingress-controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ var (
noDefaultBackendOverride = false
deferredShutdownPeriod time.Duration
configOverrides clientcmd.ConfigOverrides
internalDefaultBackend = false
internalDefaultBackend = true
http3 = false
nghttpxSecret = "nghttpx-km"
shareTLSTicketKey = false
Expand Down
1 change: 0 additions & 1 deletion examples/custom-configuration/rc-custom-configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,5 @@ spec:
hostPort: 443
args:
- /nghttpx-ingress-controller
- --default-backend-service=$(POD_NAMESPACE)/default-http-backend
- --nghttpx-configmap=default/nghttpx-ingress-lb
- --healthz-port=11249
1 change: 0 additions & 1 deletion examples/daemonset/as-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,4 @@ spec:
hostPort: 443
args:
- /nghttpx-ingress-controller
- --default-backend-service=$(POD_NAMESPACE)/default-http-backend
- --healthz-port=11249
1 change: 0 additions & 1 deletion examples/default/rc-default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,4 @@ spec:
hostPort: 443
args:
- /nghttpx-ingress-controller
- --default-backend-service=$(POD_NAMESPACE)/default-http-backend
- --healthz-port=11249
53 changes: 0 additions & 53 deletions examples/proxyproto/01-default-backend.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ spec:
hostPort: 443
args:
- /nghttpx-ingress-controller
- --default-backend-service=$(POD_NAMESPACE)/default-http-backend
- --nghttpx-configmap=$(POD_NAMESPACE)/nghttpx-ingress-lb-config
- --healthz-port=11249
- --proxy-proto=true
57 changes: 0 additions & 57 deletions rc.yaml
Original file line number Diff line number Diff line change
@@ -1,60 +1,4 @@
apiVersion: v1
kind: Service
metadata:
name: default-http-backend
namespace: kube-system
labels:
k8s-app: default-http-backend
spec:
ports:
- port: 80
targetPort: 8080
protocol: TCP
name: http
selector:
k8s-app: default-http-backend
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: default-http-backend
namespace: kube-system
labels:
k8s-app: default-http-backend
spec:
selector:
matchLabels:
k8s-app: default-http-backend
template:
metadata:
labels:
k8s-app: default-http-backend
spec:
terminationGracePeriodSeconds: 60
containers:
- name: default-http-backend
# Any image is permissible as long as:
# 1. It serves a 404 page at /
# 2. It serves 200 on a /healthz endpoint
image: registry.k8s.io/defaultbackend-amd64:1.5
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
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: ingress
Expand Down Expand Up @@ -168,7 +112,6 @@ spec:
hostPort: 443
args:
- /nghttpx-ingress-controller
- --default-backend-service=default/default-http-backend
- --healthz-port=11249
securityContext:
# These capabilities are required to load eBPF program which is used by HTTP/3.
Expand Down