Added geoip to logs

Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
This commit is contained in:
Marcus Noble 2021-11-28 12:39:58 +00:00
parent 53f5a5c062
commit b9ed0a571e
Signed by: AverageMarcus
GPG Key ID: B8F2DB8A7AEBAF78

View File

@ -1,3 +1,15 @@
apiVersion: v1
kind: Secret
metadata:
name: maxmind-license-key
namespace: kube-system
annotations:
kube-1password: lijyujx6ixvpkzxjx4f6xuwkue
kube-1password/vault: Kubernetes
type: Opaque
---
kind: Service kind: Service
apiVersion: v1 apiVersion: v1
metadata: metadata:
@ -33,10 +45,13 @@ metadata:
name: ingress-nginx-configuration name: ingress-nginx-configuration
namespace: kube-system namespace: kube-system
data: data:
log-format-upstream: '{"time": "$time_iso8601", "remote_addr": "$proxy_protocol_addr", "x_forward_for": "$proxy_add_x_forwarded_for", "request_id": "$req_id", "remote_user": "$remote_user", "bytes_sent": $bytes_sent, "request_time": $request_time, "status": $status, "host": "$host", "request_proto": "$server_protocol", "path": "$uri", "request_query": "$args", "request_length": $request_length, "duration": $request_time,"method": "$request_method", "http_referrer": "$http_referer", "http_user_agent": "$http_user_agent", "redirect_location": "$redirect_location" }' log-format-upstream: '{"time": "$time_iso8601", "request_id": "$req_id", "remote_user": "$remote_user", "bytes_sent": $bytes_sent, "request_time": $request_time, "status": $status, "host": "$host", "request_proto": "$server_protocol", "path": "$uri", "request_query": "$args", "request_length": $request_length, "duration": $request_time,"method": "$request_method", "http_referrer": "$http_referer", "http_user_agent": "$http_user_agent", "redirect_location": "$redirect_location", "country_code": "$geoip2_city_country_code", "country_name": "$geoip2_city_country_name" }'
use-geoip2: "true"
plugins: "redirect_location" plugins: "redirect_location"
location-snippet: | location-snippet: |
set $redirect_location ''; set $redirect_location '';
enable-real-ip: "true"
use-forwarded-headers: "true"
--- ---
apiVersion: v1 apiVersion: v1
@ -70,6 +85,7 @@ metadata:
annotations: annotations:
meta.helm.sh/release-name: kapsule-ingress meta.helm.sh/release-name: kapsule-ingress
meta.helm.sh/release-namespace: kube-system meta.helm.sh/release-namespace: kube-system
configmap.reloader.stakater.com/reload: "ingress-nginx-configuration"
labels: labels:
app.kubernetes.io/managed-by: Helm app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: ingress-nginx app.kubernetes.io/name: ingress-nginx
@ -104,6 +120,7 @@ spec:
- --annotations-prefix=nginx.ingress.kubernetes.io - --annotations-prefix=nginx.ingress.kubernetes.io
- --watch-ingress-without-class - --watch-ingress-without-class
- --enable-metrics - --enable-metrics
- --maxmind-license-key=$(MAXMIND_KEY)
env: env:
- name: POD_NAME - name: POD_NAME
valueFrom: valueFrom:
@ -115,6 +132,11 @@ spec:
fieldRef: fieldRef:
apiVersion: v1 apiVersion: v1
fieldPath: metadata.namespace fieldPath: metadata.namespace
- name: MAXMIND_KEY
valueFrom:
secretKeyRef:
name: maxmind-license-key
key: password
image: k8s.gcr.io/ingress-nginx/controller:v1.0.0-beta.1 image: k8s.gcr.io/ingress-nginx/controller:v1.0.0-beta.1
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
name: nginx-ingress-controller name: nginx-ingress-controller