Kubernetes - MinIO Failed to connect to console using browser

7/16/2021

According to the official MinIO Guide (https://docs.min.io/docs/minio-quickstart-guide.html):

For example, consider a MinIO deployment behind a proxy https://minio.example.net, https://console.minio.example.net with rules for forwarding traffic on port :9000 and :9001 to MinIO and the MinIO Console respectively on the internal network. Set MINIO_BROWSER_REDIRECT_URL to https://console.minio.example.net to ensure the browser receives a valid reachable URL.

I have already setup a distributed minio using k3s and a Load Balancer service.

$ kubectl describe services minio-service -n minio

Name:                     minio-service
Namespace:                minio
Labels:                   app=minio
Annotations:              <none>
Selector:                 app=minio
Type:                     LoadBalancer
IP Family Policy:         SingleStack
IP Families:              IPv4
IP:                       10.43.168.142
IPs:                      10.43.168.142
LoadBalancer Ingress:     192.168.10.119, 192.168.10.120, 192.168.10.70
Port:                     <unset>  9012/TCP
TargetPort:               9011/TCP
NodePort:                 <unset>  31423/TCP
Endpoints:                10.42.1.13:9011,10.42.2.12:9011
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   <none>

If I try curl -vf http://192.168.10.70:9012 I get

curl: (7) Failed to connect to 192.168.1.70 port 9012: Connection timed out

Thus, I used export MINIO_BROWSER_REDIRECT_URL=http://192.168.10.70:9012 but it doesn't work. Am I doing something wrong with redirection? Does anyone know how to fix this?

-- e7lT2P
k3s
kubernetes
kubernetes-ingress
minio

1 Answer

7/20/2021

I managed to make it work using port-forward.

Options:

kubectl port-forward minio-0 9000 -n minio

Forwarding from 127.0.0.1:9000 -> 9000

kubectl port-forward --address 192.168.10.70 pod/minio-0 9000 -n minio

Forwarding from 192.168.10.70:9000 -> 9000

kubectl port-forward --address 192.168.10.70 svc/minio-service 9012 -n minio

Forwarding from 192.168.10.70:9012 -> 9011

Note that in the third option, minio-service is a Load Balancer Service

apiVersion: v1
kind: Service
metadata:
  name: minio-service
  namespace: minio
  labels:
    app: minio
spec:
  type: LoadBalancer
  selector:
    app: minio
  ports:
  - port: 9012
    targetPort: 9011
    protocol: TCP

In statefulSet:

containers:
  ports:
  - containerPort: 9000
    hostPort: 9011
-- e7lT2P
Source: StackOverflow