k8s,Ingress,Minio和静态站点 [英] k8s, Ingress, Minio, and a Static Site

查看:938
本文介绍了k8s,Ingress,Minio和静态站点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个安装了nginx Ingress和Minio的k8s集群.在Minio中,我有一个名为tester的存储桶,其中有一个hello world index.html文件.我使用Minio MC客户端将tester存储桶设置为public.现在,当我访问(更改的)迷你URL时,可以看到hello world文件,如下所示:https://minio.example.com/tester/index.html.

We have a k8s cluster with an nginx Ingress and Minio installed. In Minio I have a bucket called tester with a hello world index.html file. I used the Minio MC client to set the tester bucket to public. Now I am able to see the hello world file when I visit my (altered) minio url like so: https://minio.example.com/tester/index.html.

我的目标是建立一个Ingress资源来访问公共存储桶.这是我尝试执行的清单,但是我只收到404错误. . .

My goal is to set up an Ingress resource to access the public bucket. Here is my manifest to try and do so, however I only ever get a 404 error . . .

ingress.yaml

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: frontend-site
  namespace: "default"
  labels:
    type: "frontend"
    awesomeness: "super-mega"
  annotations:
    kubernetes.io/ingress.class: "nginx"
spec:
  rules:
    - host: app.example.com
      http:
        paths:
          - path: /tester/
            backend:
              serviceName: minio-svc
              servicePort: 9000
          - path: /tester/*
            backend:
              serviceName: minio-svc
              servicePort: 9000
  tls:
    - hosts:
      - app.example.com
      secretName: ssl-certs

我也尝试过设置索引文件的路径,就像这样无济于事:

I have also tried to set the paths with the index fileto no avail like so:

path: /tester/index.html
path: /tester/index.html/*

我确实有另一个Ingress,它通常指向Minio,它在minio.example.com之类的URL上运行完美.微型计算机在端口9000上有一个名为minio-svc的服务.

I do have another Ingress which points to Minio in general and it works perfect at the url like minio.example.com. The minio has a service called minio-svc on port 9000.

不幸的是,到目前为止,我只从Ingress收到404.还有其他人将带有Ingress的静态站点部署到公共Minio存储桶中吗?我在做什么错了??

Unfortunately I have only ever received a 404 from my Ingress thus far. Anyone else deploying static sites with Ingress to public Minio bucket? What am I doing wrong???

更新

所以我有点地方.我添加了注释,并将路径设置为简单的//*.

So I kind of got somewhere. I added an annotation and set the paths to simply / and /*.

这是我的新配置:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: frontend-site
  namespace: "default"
  labels:
    type: "frontend"
    awesomeness: "super-mega"
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /tester/index.html
spec:
  rules:
    - host: app.example.com
      http:
        paths:
          - path: /
            backend:
              serviceName: minio-svc
              servicePort: 9000
          - path: /*
            backend:
              serviceName: minio-svc
              servicePort: 9000
  tls:
    - hosts:
      - app.example.com
      secretName: ssl-certs

现在,即使存储桶是公共的,我仍然可以从Minio拒绝访问,我仍然可以从https://minio.example.com/tester/index.html!?

Now I just get access denied from Minio even though the bucket is public and I can still access from https://minio.example.com/tester/index.html!?

推荐答案

发现您无法轻松完成我要问的事情.通过将目录直接从存储桶直接安装到Nginx,我可以解决所有问题.瞧!

Found out you can't do what I'm asking very easily. I got around it all by simply mounting the directory from the bucket directly to Nginx. Voila!

这篇关于k8s,Ingress,Minio和静态站点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆