Requirement: Want to deploy Minio and another backend service using an ingress with HTTPS (Not for production purposes)
I have been trying to create an ingress to access two services externally from the Kubernetes cluster in GKE. These are the attempts I tried.
Attempt One
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: lightning-ingress
namespace: default
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/ssl-redirect: "false"
spec:
rules:
- http:
paths:
- path: /storage
backend:
serviceName: minio
servicePort: 9000
- path: /portal
backend:
serviceName: oscar
servicePort: 8080
Attempt Two
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: oscar
annotations:
# nginx.ingress.kubernetes.io/rewrite-target: /
kubernetes.io/ingress.class: nginx
spec:
rules:
- http:
paths:
- backend:
serviceName: oscar
servicePort: 8080
- host: storage.lightningfaas.tech
http:
paths:
- backend:
serviceName: minio
servicePort: 9000
Attempt Three
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: lightning-ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /$2
kubernetes.io/ingress.class: "nginx"
spec:
rules:
- http:
paths:
- backend:
serviceName: minio
servicePort: 9000
path: /minio(/|$)(.*)
- backend:
serviceName: oscar
servicePort: 8080
path: /portal(/|$)(.*)
Attempt Four
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: minio-ingress
annotations:
kubernetes.io/ingress.class: "nginx"
spec:
rules:
- host: minio.lightningfaas.tech
http:
paths:
- backend:
serviceName: minio
servicePort: 9000
- host: portal.lightningfaas.tech
http:
paths:
- backend:
serviceName: oscar
servicePort: 8080
However, none of the above attempts suites for my requirement. Either it gives a 404 0r a 503. But I can confirm that creating an individual ingress for each service works fine as below.
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: oscar
annotations:
kubernetes.io/ingress.class: nginx
spec:
rules:
- http:
paths:
- backend:
serviceName: oscar
servicePort: 8080
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: minio-ingress
annotations:
kubernetes.io/ingress.class: nginx
spec:
rules:
- http:
paths:
- backend:
serviceName: minio
servicePort: 9000
Changing domain servers takes a huge time to test as well, therefore creating hosts are very annoying since I have to wait a massive time to test my code. Is there anything more that I can try?
Something like below would be ideal:
https://34.452.234.45:9000 > will access minio
https://34.452.234.45:8080 > will access oscar
Your suggestions and opinions will be really helpful for me.
Minio helm chart: https://github.com/minio/charts
Minio deployment
helm install --namespace oscar minio minio/minio --set accessKey=minio --set secretKey=password --set persistence.existingClaim=lightnig --set resources.requests.memory=256Mi
Oscar helm chart: https://github.com/grycap/helm-charts/tree/master/oscar
Oscar deployment
helm install --namespace=oscar oscar oscar --set authPass=password --set service.type=ClusterIP --set createIngress=false --set volume.storageClassName=nfs --set minIO.endpoint=http://104.197.173.174 --set minIO.TLSVerify=false --set minIO.accessKey=minio --set minIO.secretKey=password --set serverlessBackend=openfaas
According to kubernetes doc, simple fan-out example should solve your problem. A simple fan-out example is given below where same host has two different paths for two different services.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: simple-fanout-example
spec:
rules:
- host: foo.bar.com
http:
paths:
- path: /foo
pathType: Prefix
backend:
service:
name: service1
port:
number: 4200
- path: /bar
pathType: Prefix
backend:
service:
name: service2
port:
number: 8080
So your manifest file might look like this:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: lightning-ingress
namespace: default
spec:
rules:
- host: [your host name here]
http:
paths:
- path: /storage
pathType: Prefix
backend:
service:
name: minio
port:
number: 9000
- path: /portal
pathType: Prefix
backend:
service:
name: oscar
port:
number: 8080
Ref: Kubernetes doc