首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >只显示在路径'/‘的Kubernetes qBitTorrentWebUI

只显示在路径'/‘的Kubernetes qBitTorrentWebUI
EN

Stack Overflow用户
提问于 2021-10-05 09:17:09
回答 1查看 257关注 0票数 0

我正在尝试使用Kubernetes托管一个qBitTorrent服务器。我已经为https://hub.docker.com/r/linuxserver/qbittorrent码头容器编写了一个YAML。

问题是它只能从path /访问。一旦我把它移到/torrent,它就找不到了: 404没有找到。

复制步骤:

yamls

  • helm install nginx ingress-nginx/ingress-nginx

  • go

  • 应用于service_ip:8080,设置,WebUI,取消选中“启用主机标题validation"

  • go to localhost:nginx_port/torrent

结果:

  • 页面未加载

预期结果:

  • qBitTorrent WebUi出现并工作

我试过的是:

  • nginx.ingress.kubernetes.io/rewrite-target: /添加到注释

server.yaml:

代码语言:javascript
复制
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

ingress.yaml:

代码语言:javascript
复制
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
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-10-08 08:17:27

多亏了@matt_j,我找到了一个解决办法。我自己为nginx写了和YAML,并从matt ( https://github.com/qbittorrent/qBittorrent/wiki/NGINX-Reverse-Proxy-for-Web-UI )提到的帖子中添加了配置,它起了作用。

这些都是我想出的YAML:

server.yaml:

代码语言:javascript
复制
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

config.yaml:

代码语言:javascript
复制
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      /                       "/; Secure";
                            }
            }
    }

    events {
        worker_connections  1024;
    }
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69447844

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档