How to use NodePort in MinIO Service - cniackz/public GitHub Wiki
Inspired from:
Other relevant links:
- https://kind.sigs.k8s.io/docs/user/configuration/#api-server
- https://github.com/kubernetes-sigs/kind/issues/1875
- https://stackoverflow.com/questions/63850398/exposing-a-kubernetes-pod-via-service-in-kind-kubernetes-cluster
- https://porter.sh/best-practices/kind/#:~:text=By%20default%2C%20KinD%20sets%20up,0.1%20).
- https://medium.com/google-cloud/kubernetes-nodeport-vs-loadbalancer-vs-ingress-when-should-i-use-what-922f010849e0
Steps:
- Delete any previous cluster if any
kind delete cluster
- Create the configuration file for
kind
:
-
File name:
kind-config-node-port.yaml
-
Content:
# I got this config from:
# https://github.com/kubernetes-sigs/kind/issues/1875
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
networking:
apiServerAddress: "127.0.0.1"
apiServerPort: 6443
nodes:
- role: control-plane
extraPortMappings:
- containerPort: 30080
hostPort: 30080
listenAddress: "127.0.0.1"
protocol: TCP
- containerPort: 30081
hostPort: 30081
listenAddress: "127.0.0.1"
protocol: TCP
$ kind create cluster --config=kind-config-node-port.yaml
Creating cluster "kind" ...
â Ensuring node image (kindest/node:v1.24.0) đŧ
â Preparing nodes đĻ
â Writing configuration đ
â Starting control-plane đšī¸
â Installing CNI đ
â Installing StorageClass đž
Set kubectl context to "kind-kind"
You can now use your cluster with:
kubectl cluster-info --context kind-kind
Thanks for using kind! đ
- Install the operator:
kubectl apply -k github.com/minio/operator/
- Install the tenant:
kubectl apply -k ~/operator/examples/kustomization/tenant-lite
- Since we have one node only, remove one replica from operator so we have only one:
- Wait for Tenant to be ready:
- Then, change the service to become
NodePort
:
- Match the port of the service with the port available in your host:
- Then you can access the UI via
https://localhost:30080/login
: