k8s, Ingress, Minio, and a Static Site

一个人想着一个人 提交于 2020-01-06 08:43:34

问题


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.

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/*

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.

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???

Updates

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

Here is my new config:

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

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!?


回答1:


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!



来源:https://stackoverflow.com/questions/54557766/k8s-ingress-minio-and-a-static-site

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!