Testing Access to MinIO from Kubernetes

Recently I decided to migrate my GitLab instance off a RHEL VM and across to Kubernetes. Partly to reduce the number of virtual machines running in my environment, but more so because Kubernetes is now my platform of choice for my infrastructure applications.

However, post-upgrade I had issues storing files, and had a sneaking suspicion it was due to MinIO. As Minio was not externally accessible to the cluster, I needed a way to test access from internal.

Enter Alpine

Two features every Kubernetes administrator needs is Busybox and Alpine. These give you the ability to exec into a shell and run whatever low-level networking tools you need to help you get to the root of the problem.

Define the following Alpine container and then apply it:


apiVersion: v1
kind: Namespace
metadata:
name: alpine
labels:
pod-security.kubernetes.io/enforce: privileged
apiVersion: v1
kind: Pod
metadata:
name: alpine
namespace: alpine
spec:
containers:
– name: alpine-container
image: alpine
command: ["sh", "-c", "sleep 3600"]

view raw

alpine.yaml

hosted with ❤ by GitHub

As we’re testing access to Minio, let’s update the container with the MinIO client:

kubectl exec -it alpine -n alpine -- apk --update add minio-client

Lastly, let’s exec into the container to get the ball rolling:

kubectl exec -it alpine -n alpine -- sh

MinIO Client

Unfortunately, due to a (what I’m guessing is a) conflict with Midnight Commander, the command for the Minio Client on Alpine is not “mc” but rather “mcli”.

Once you have the service address for your MinIO installation and your access key and secret key, define an alias for your connection using:

mcli alias set myminio https://<insert tenant name here>.<insert server name here>.svc.cluster.local:9000 <accessKey> <secretKey>

Now we have an alias defined, see what buckets are available:

mcli ls myminio

To see what’s currently inside a bucket, just append the bucket name after the alias:

mcli ls myminio/gitlab-artifacts

Lastly, if you need to see the admin stats for your MinIO tenant and have the correct permissions, use:

mcli admin info myminio

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.