<p>I am trying to host a qBitTorrent server with Kubernetes. I have composed a YAML for the <code>https://hub.docker.com/r/linuxserver/qbittorrent</code> docker container.</p>
<p>The problem is that it is accessible only from path /. As soon as I move it to /torrent it does not find it anymore: 404 Not Found.</p>
<h2>Steps to replicate:</h2>
<ul>
<li>apply following yamls</li>
<li><code>helm install nginx ingress-nginx/ingress-nginx</code></li>
<li>go to <code>service_ip:8080</code>, settings, WebUI, uncheck &quot;Enable Host header validation&quot;</li>
<li>go to <code>localhost:nginx_port/torrent</code></li>
</ul>
<h2>Result:</h2>
<ul>
<li>page not loading</li>
</ul>
<h2>Expected Result:</h2>
<ul>
<li>qBitTorrent WebUi appears and works</li>
</ul>
<h2>What I tried:</h2>
<ul>
<li>adding <code>nginx.ingress.kubernetes.io/rewrite-target: /</code> to annotations</li>
</ul>
<p>server.yaml:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: torrent-deployment
  labels:
    app: torrent
spec:
  replicas: 1
  selector:
    matchLabels:
      pod-label: torrent-pod
  template:
    metadata:
      labels:
        pod-label: torrent-pod
    spec:
      containers:
      - name: linuxserver
        image: linuxserver/qbittorrent:amd64-latest
---
apiVersion: v1
kind: Service
metadata:
  name: torrent-service
  labels:
    app: torrent
spec:
  selector:
    pod-label: torrent-pod
  ports:
  - port: 8080
    name: torrent-deployment
</code></pre>
<p>ingress.yaml:</p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: torrent-ingress
  annotations:
    kubernetes.io/ingress.class: nginx
  labels:
    app: torrent
spec:
  rules:
  - http:
      paths:
      - path: /torrent
        pathType: Prefix
        backend:
          service:
            name: torrent-service
            port:
              number: 8080
</code></pre>

Paul Schuldesz
<p>Thanks to @matt_j I have found a workaround. I wrote and YAML for nginx myself and added the configurations from the post mentioned by matt ( <a href="https://github.com/qbittorrent/qBittorrent/wiki/NGINX-Reverse-Proxy-for-Web-UI" rel="nofollow noreferrer">https://github.com/qbittorrent/qBittorrent/wiki/NGINX-Reverse-Proxy-for-Web-UI</a> ) and it worked.</p>
<p>These are the YAMLs I came up with:</p>
<p>server.yaml:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx
  labels:
    app: nginx
  namespace: nginx
spec:
  selector:
    matchLabels:
      pod-label: nginx
  template:
    metadata:
      labels:
        pod-label: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:latest
        volumeMounts:
          - name: nginx-conf
            mountPath: /etc/nginx/
      volumes:
        - name: nginx-conf
          configMap:
            name: nginx-conf
            items:
            - key: nginx.conf
              path: nginx.conf
  replicas: 1
# status:
---
apiVersion: v1
kind: Service
metadata:
  namespace: nginx
  name: nginx
  labels:
    app: nginx
spec:
  selector:
    pod-label: nginx
  ports:
  - port: 80
    name: nginx
</code></pre>
<p>config.yaml:</p>
<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
  name: nginx-conf
  namespace: nginx
data:
  nginx.conf: |
    user  nginx;
    worker_processes  auto;

    error_log  /var/log/nginx/error.log notice;
    pid        /var/run/nginx.pid;

    http {
            server {
                    server_name 10.152.183.95;
                    listen 80;
                    location /torrent/ {
                            proxy_pass              http://torrent-service.qbittorrent:8080/;
                            #proxy_http_version      1.1;
                            proxy_set_header        X-Forwarded-Host        $http_host;
                            proxy_set_header        X-Forwarded-For         $remote_addr;
                            #proxy_cookie_path      /                       &quot;/; Secure&quot;;
                            }
            }
    }

    events {
        worker_connections  1024;
    }
</code></pre>
