小编Сер*_*лов的帖子

如何正确配置入口缓存以使其正常工作?

我正在尝试为特定主机配置缓存,但收到 404。另外,我的配置似乎未包含在最终的 nginx.conf 中。该文件不包含它

我的 ingress.yaml:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: images-ingress
  labels:
    last_updated: "14940999355"
  annotations:
    kubernetes.io/ingress.class: "nginx"
    cert-manager.io/cluster-issuer: "letsencrypt-prod"
    nginx.ingress.kubernetes.io/rewrite-target: /
    nginx.ingress.kubernetes.io/proxy-body-size: 8m
    nginx.ingress.kubernetes.io/proxy-buffering: "on"
    nginx.ingress.kubernetes.io/server-snippet: |
      proxy_cache static-cache;
      proxy_cache_valid 404 10m;
      proxy_cache_use_stale error timeout updating http_404 http_500 http_502 http_503 http_504;
      proxy_cache_bypass $http_x_purge;
      add_header X-Cache-Status $upstream_cache_status;
spec:
  tls:
  - hosts:
    - static.qwstrs.com
    secretName: letsencrypt-prod
  rules:
  - host: static.qwstrs.com
    http:
      paths:
      - path: /
        backend:
          serviceName: imaginary
          servicePort: 9000
Run Code Online (Sandbox Code Playgroud)

如果我删除这个样本

  nginx.ingress.kubernetes.io/server-snippet: |
      proxy_cache static-cache;
      proxy_cache_valid 404 10m;
      proxy_cache_use_stale error …
Run Code Online (Sandbox Code Playgroud)

kubernetes nginx-ingress microk8s

9
推荐指数
1
解决办法
1万
查看次数

标签 统计

kubernetes ×1

microk8s ×1

nginx-ingress ×1