In some cases you’ll have internal systems with custom useragents.
You can write your own rules and include them in the deployment.
First define your rules and store them as a configmap in k8s.
You can do this by putting the config files in a folder ‘foo’ and doing something like: kubectl create -n yauaa configmap niels-yauaa-rules --from-file=foo
Or you can include them directly in the kubectl config file like this:
Then the deployment must turn this config map into a volume and mount it in the pods.
Note that the folder under which it is mounted must be at the root level and the name must start with “UserAgent”.
So the deployment becomes something like this
apiVersion: apps/v1kind: Deploymentmetadata:
name: yauaanamespace: yauaaspec:
selector:
matchLabels:
app: yauaareplicas: 3template:
metadata:
labels:
app: yauaaspec:
volumes:
- name: niels-yauaa-rules-volumeconfigMap:
name: niels-yauaa-rulescontainers:
- name: yauaaimage: nielsbasjes/yauaa:8.3.0volumeMounts:
- name: niels-yauaa-rules-volume# NOTE 1: The directory name MUST start with "/UserAgents" !!# NOTE 2: It MUST be exactly 1 subdirectory deep (i.e. no multi level deep)# NOTE 3: You can have multiple as long as the mountPaths are all different.mountPath: /UserAgents-Nielsports:
- containerPort: 8080name: yauaaprotocol: TCPlivenessProbe:
httpGet:
path: /livenessport: yauaainitialDelaySeconds: 2periodSeconds: 3readinessProbe:
httpGet:
path: /readinessport: yauaainitialDelaySeconds: 10periodSeconds: 10
Available outside the cluster (HTTP)
Depending on your Kubernetes cluster you may have the option to change
the .spec.type of the above Service to LoadBalancer
or you may choose to expose it via an Ingress.
I have been able to get it working with the helm chart for stable/nginx-ingress where I have enabled SSL.
Simply putting up an Ingress works something like this