web service different path
Hi, I've defined an ingress for the web service. I'm using nginx as the ingress controller.
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: arango-ingress
namespace: default
annotations:
nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
spec:
rules:
- http:
paths:
- path: /arango
backend:
serviceName: example-simple-single-int
servicePort: 8529
---
I'd like to define a different path (I have multiple paths exposed on the ingress to different backing services).
Is there a base url variable or env variable in the operator I can set to instruct the web service to serve content from /arango rather than / ?
Facing similar issue, I want it to preserve the /arango route when it redirects
Start here: https://github.com/arangodb/arangodb/issues/8176
Looks like there is not much can be done from the arangodb side. Next steps helped me out on the version 3.6.4 and simple nginx reverse proxy (I am sure nginx ingress will do the same)
- Add to the ArangoDB config file:
[frontend]
proxy-request-check = false
It is more secure to add proxy-request-check = true and trusted-proxy =
But i have got the error about wrong netmask with the host IP or network IP/mask for the trusted-proxy.
- Add several rules to the nginx location
location /arango/ {
proxy_pass http://arangodb/;
proxy_redirect ~^/(.*) http://$http_host/arango/$1;
proxy_set_header X-Script-Name /arango;
}
- location - is your path
- proxy_pass points to your service
- proxy_set_header is necessary according to the arangodb manual
- proxy_redirect will help to change standard
301 /_db/_system/_admin/aardvarkto the301 /arango/_db/_system/_admin/aardvark
I just setup a Nginx reverse-proxy based on the example from ASLanin, as a sidecar to ArangoDB, and I think that is actually the way to solve these kinds of problems.
This is the deployment:
---
apiVersion: v1
kind: ConfigMap
metadata:
name: arangodb-nginx-conf
data:
nginx.conf: |
user nginx;
worker_processes 2;
events {
worker_connections 10240;
}
http {
server {
listen 80;
location /arango/ {
proxy_pass http://localhost:8529/;
proxy_redirect ~^/(.*) http://$http_host/arango/$1;
proxy_set_header X-Script-Name /arango;
}
}
}
---
apiVersion: v1
kind: Service
metadata:
name: arangodb
spec:
type: LoadBalancer
selector:
app: arangodb
ports:
- name: arangodb
port: 80
targetPort: 80
protocol: TCP
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: arangodb
name: arangodb
spec:
replicas: 1
selector:
matchLabels:
app: arangodb
template:
metadata:
labels:
app: arangodb
spec:
containers:
- name: arangodb
image: arangodb
args: [ "--frontend.proxy-request-check=false", "--http.trusted-origin=all" ]
env:
- name: ARANGO_NO_AUTH
value: "1"
ports:
- name: arangodb
containerPort: 8529
protocol: TCP
- name: nginx
image: nginx
ports:
- name: nginx
containerPort: 80
protocol: TCP
volumeMounts:
- name: nginx-conf
mountPath: /etc/nginx
readOnly: true
volumes:
- name: nginx-conf
configMap:
name: arangodb-nginx-conf
items:
- key: nginx.conf
path: nginx.conf