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

Detailed NGINX-Ingress-Controller status page config #84

Closed
wants to merge 1 commit into from
Closed
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
Add detailed example for NGINX-Ingress-Controller status page configu…
…ration
  • Loading branch information
ysolt committed Dec 22, 2016
commit c14b4f8a57060eab6d37e72305eb4afc0446be45
103 changes: 103 additions & 0 deletions examples/status-page/nginx/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
Example configuration for configuring enabling Status Page on the NGINX Ingress Controller
=========

# Create replica set and service definition for the default http backend
```
kubectl create -f default-backend-rc.yaml -f default-backend-svc.yaml
```

# Create NGINX Ingress controller with the desired vts status page enabled option
```
kubectl create -f status-page-configmap.yaml -f status-page-rc.yaml
```

# Expose ports externally
The following example service configuration can be used to make services addressable outside of the Kubernetes cluster

* http endpoint: http://${NODE_IP}:32080
* https endpoint: https://${NODE_IP}:32443
* status endpoint: http://${NODE_IP}:32081

```
kubectl create -f status-page-svc.yaml
```

# Testing

IP 172.17.4.99 used here as an example

## Default endpoint
### Browser

* http://172.17.4.99:32080/ will give 404 with "default backend - 404" content
* http:///172.17.4.99:32080/healthz will give 200 with "ok" content

### CLI

```
curl -v http://172.17.4.99:32080
* Rebuilt URL to: http://172.17.4.99:32080/
* Trying 172.17.4.99...
* Connected to 172.17.4.99 (172.17.4.99) port 32080 (#0)
> GET / HTTP/1.1
> Host: 172.17.4.99:32080
> User-Agent: curl/7.43.0
> Accept: */*
>
< HTTP/1.1 404 Not Found
< Server: nginx/1.11.3
< Date: Thu, 22 Dec 2016 10:32:23 GMT
< Content-Type: text/plain; charset=utf-8
< Content-Length: 21
< Connection: keep-alive
< Strict-Transport-Security: max-age=15724800; includeSubDomains; preload
<
* Connection #0 to host 172.17.4.99 left intact

curl -v http://172.17.4.99:32080/healthz
* Trying 172.17.4.99...
* Connected to 172.17.4.99 (172.17.4.99) port 32080 (#0)
> GET /healthz HTTP/1.1
> Host: 172.17.4.99:32080
> User-Agent: curl/7.43.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: nginx/1.11.3
< Date: Thu, 22 Dec 2016 10:31:36 GMT
< Content-Type: text/plain; charset=utf-8
< Content-Length: 2
< Connection: keep-alive
< Strict-Transport-Security: max-age=15724800; includeSubDomains; preload
<
* Connection #0 to host 172.17.4.99 left intact
```

## Status page
### Browser

http://172.17.4.99:32081/nginx_status/

### CLI

```
curl -v http://172.17.4.99:32081/nginx_status/format/json
* Trying 172.17.4.99...
* Connected to 172.17.4.99 (172.17.4.99) port 32081 (#0)
> GET /nginx_status/format/json HTTP/1.1
> Host: 172.17.4.99:32081
> User-Agent: curl/7.43.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: nginx/1.11.3
< Date: Thu, 22 Dec 2016 10:32:57 GMT
< Content-Type: application/json
< Content-Length: 2303
< Connection: keep-alive
<
* Connection #0 to host 172.17.4.99 left intact
{"nginxVersion":"1.11.3","loadMsec":1482401683372,"nowMsec":1482402243310,"connections":{"active":4,"reading":0,"writing":1,"waiting":3,"accepted":19,"handled":19,"requests":629},"serverZones":{"_":{"requestCounter":621,"inBytes":486167,"outBytes":597318,"responses":{"1xx":0,"2xx":620,"3xx":0,"4xx":1,"5xx":0,"miss":0,"bypass":0,"expired":0,"stale":0,"updating":0,"revalidated":0,"hit":0,"scarce":0},"overCounts":{"maxIntegerSize":18446744073709551615,"requestCounter":0,"inBytes":0,"outBytes":0,"1xx":0,"2xx":0,"3xx":0,"4xx":0,"5xx":0,"miss":0,"bypass":0,"expired":0,"stale":0,"updating":0,"revalidated":0,"hit":0,"scarce":0}},"testurl":{"requestCounter":7,"inBytes":3558,"outBytes":426201,"responses":{"1xx":0,"2xx":7,"3xx":0,"4xx":0,"5xx":0,"miss":0,"bypass":0,"expired":0,"stale":0,"updating":0,"revalidated":0,"hit":0,"scarce":0},"overCounts":{"maxIntegerSize":18446744073709551615,"requestCounter":0,"inBytes":0,"outBytes":0,"1xx":0,"2xx":0,"3xx":0,"4xx":0,"5xx":0,"miss":0,"bypass":0,"expired":0,"stale":0,"updating":0,"revalidated":0,"hit":0,"scarce":0}},"*":{"requestCounter":628,"inBytes":489725,"outBytes":1023519,"responses":{"1xx":0,"2xx":627,"3xx":0,"4xx":1,"5xx":0,"miss":0,"bypass":0,"expired":0,"stale":0,"updating":0,"revalidated":0,"hit":0,"scarce":0},"overCounts":{"maxIntegerSize":18446744073709551615,"requestCounter":0,"inBytes":0,"outBytes":0,"1xx":0,"2xx":0,"3xx":0,"4xx":0,"5xx":0,"miss":0,"bypass":0,"expired":0,"stale":0,"updating":0,"revalidated":0,"hit":0,"scarce":0}}},"upstreamZones":{"default-test-ui-8443":[{"server":"10.2.97.6:8443","requestCounter":7,"inBytes":3558,"outBytes":426201,"responses":{"1xx":0,"2xx":7,"3xx":0,"4xx":0,"5xx":0},"responseMsec":297,"weight":1,"maxFails":0,"failTimeout":0,"backup":false,"down":false,"overCounts":{"maxIntegerSize":18446744073709551615,"requestCounter":0,"inBytes":0,"outBytes":0,"1xx":0,"2xx":0,"3xx":0,"4xx":0,"5xx":0}}],"upstream-default-backend":[{"server":"10.2.90.238:8080","requestCounter":0,"inBytes":0,"outBytes":0,"responses":{"1xx":0,"2xx":0,"3xx":0,"4xx":0,"5xx":0},"responseMsec":0,"weight":1,"maxFails":0,"failTimeout":0,"backup":false,"down":false,"overCounts":{"maxIntegerSize":18446744073709551615,"requestCounter":0,"inBytes":0,"outBytes":0,"1xx":0,"2xx":0,"3xx":0,"4xx":0,"5xx":0}}]}}

```

36 changes: 36 additions & 0 deletions examples/status-page/nginx/default-backend-rc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
apiVersion: v1
kind: ReplicationController
metadata:
name: default-http-backend
spec:
replicas: 1
selector:
k8s-app: default-http-backend
template:
metadata:
labels:
k8s-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
14 changes: 14 additions & 0 deletions examples/status-page/nginx/default-backend-svc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: default-http-backend
labels:
k8s-app: default-http-backend
spec:
ports:
- port: 80
targetPort: 8080
protocol: TCP
name: http
selector:
k8s-app: default-http-backend
6 changes: 6 additions & 0 deletions examples/status-page/nginx/status-page-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v1
data:
enable-vts-status: "true"
kind: ConfigMap
metadata:
name: nginx-conf-vts-enable
57 changes: 57 additions & 0 deletions examples/status-page/nginx/status-page-rc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
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:
- name: http-traffic
containerPort: 80
hostPort: 80
- name: https-traffic
containerPort: 443
hostPort: 443
- name: status-port
containerPort: 18080
hostPort: 18080
args:
- /nginx-ingress-controller
- --default-backend-service=$(POD_NAMESPACE)/default-http-backend
- --nginx-configmap=$(POD_NAMESPACE)/nginx-conf-vts-enable
24 changes: 24 additions & 0 deletions examples/status-page/nginx/status-page-svc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v1
kind: Service
metadata:
name: nginx-ingress-controller
spec:
type: NodePort
ports:
- port: 80
targetPort: http-traffic
nodePort: 32080
protocol: TCP
name: http
- port: 443
targetPort: https-traffic
nodePort: 32443
protocol: TCP
name: https
- port: 18080
targetPort: status-port
nodePort: 32081
protocol: TCP
name: status
selector:
k8s-app: nginx-ingress-lb