Skip to content

build minio on custom console for operator usage

Allan Roger Reid edited this page Dec 6, 2023 · 1 revision

See operator 3141 for context loginctl enable-linger ubuntu

Install k3s. Print versions.

sudo touch /dev/kmsg
curl -sfL https://get.k3s.io | K3S_KUBECONFIG_MODE="644" sh -s - --snapshotter=fuse-overlayfs
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
k3s --version

Output

k3s version v1.27.7+k3s2 (575bce76)
go version go1.20.10

sudo systemctl status k3s.service

● k3s.service - Lightweight Kubernetes
     Loaded: loaded (/etc/systemd/system/k3s.service; enabled; preset: enabled)
     Active: active (running) since Thu 2023-10-12 19:00:40 UTC; 26min ago

Install kubectl minio plugin

(
  set -x; cd "$(mktemp -d)" &&
  OS="$(uname | tr '[:upper:]' '[:lower:]')" &&
  ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$/arm64/')" &&
  KREW="krew-${OS}_${ARCH}" &&
  curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/${KREW}.tar.gz" &&
  tar zxvf "${KREW}.tar.gz" &&
  ./"${KREW}" install krew
)
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"

kubectl krew update
kubectl krew install minio
kubectl minio version

Go

wget https://go.dev/dl/go1.21.3.linux-amd64.tar.gz
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.21.3.linux-amd64.tar.gz
cat <<EOF >> $HOME/.profile 
export PATH=$PATH:/usr/local/go/bin:~/go/bin
EOF
cat $HOME/.profile 
source $HOME/.profile
go version

Install minio-operator. Print version.

kubectl -n minio-operator delete deployment/minio-operator
kubectl -n minio-operator delete deployment/console

kubectl-minio init --console-tls

Validate minio-operator running

kubectl get pods -n minio-operator

NAME                              READY   STATUS    RESTARTS   AGE
minio-operator-7d988dd6b6-lckt4   1/1     Running   0          24m
console-5756b69c9f-8s8d8          1/1     Running   0          24m
minio-operator-7d988dd6b6-swvnj   1/1     Running   0          24m

Add http Nodeport to service

kubectl patch service -n minio-operator console --type='merge' -p '{"spec":{"type": "NodePort", "ports":[{"name": "http", "port": 9090, "nodePort": 31000}]}}'

Get jwt and login

kubectl -n minio-operator get secret console-sa-secret -o jsonpath="{.data.token}" | base64 --decode

Podman

sudo apt-get update -y && sudo apt-get upgrade -y
sudo apt-get install podman -y
sudo apt-get install podman-docker -y
sudo apt-get install vim -y
sudo apt-get install zip -y
sudo apt-get install make -y
sudo apt install build-essential -y

NVM

sudo apt-get install nodejs -y
sudo apt-get install npm -y
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
source ~/.bashrc
nvm install --lts && nvm use --lts && npm install -g yarn

Continue compilation

git clone https://github.com/prakashsvmx/console.git
cd console && git checkout upload-fname-url
# git checkout del-api-url-params
make assets

cd ~
git clone https://github.com/minio/minio.git
cd minio && git checkout master
vi go.mod
#### Add the following 
module github.com/minio/minio
go 1.21
replace github.com/minio/console => ../console

make build 
TAG=minio/minio:noop

##### If Error: creating build container: short-name "minio/minio:latest" did not resolve to an alias and no unqualified-search registries are defined in "/etc/containers/registries.conf" then do the following
mkdir -p $HOME/.config/containers
vi $HOME/.config/containers/registries.conf
#### Add the following 
unqualified-search-registries = ["docker.io"]

docker build -t $TAG .
podman save minio/minio:noop | sudo k3s ctr images import -
sudo k3s ctr images ls | grep minio/minio:noop

Install tenant

kubectl create ns tenant-ns
kubectl minio tenant create myminio --image localhost/minio/minio:noop --namespace tenant-ns --servers 1 --volumes 1 --capacity 1Gi
kubectl patch service -n tenant-ns myminio-console -p '{"spec":{"type": "NodePort", "ports":[{"name": "https-console", "port": 9443, "protocol": "TCP", "targetPort": 9443, "nodePort": 30090}]}}'
Clone this wiki locally