Skip to content

build kubectl‐minio

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

See operator 1861

loginctl enable-linger ubuntu

Install k3s

sudo touch /dev/kmsg
curl -sfL https://get.k3s.io | K3S_KUBECONFIG_MODE="644" sh -s - --snapshotter=fuse-overlayfs
sudo journalctl -f -u k3s.service
sudo systemctl status k3s

Install krew

(
  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

Clone operator

git clone https://github.com/jiuker/operator.git
git checkout fix_charts

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

Supporting tools

sudo apt-get update && sudo apt-get upgrade -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 && nvm use && npm install -g yarn

Install plugin

#build & install kubectl-minio plugin
#make plugin-binary
cd ~/operator/kubectl-minio
CGO_ENABLED=1 go build --ldflags "-s -w" -trimpath -o ../kubectl-minio

Podman

sudo apt-get install podman -y
sudo apt-get install podman-docker -y
TAG=minio/operator:noop
mkdir ~/operator/minio-operator
cd ~/operator && make assets && make binary && docker build -t $TAG .
podman save minio/operator:noop | sudo k3s ctr images import -
sudo k3s ctr images ls | grep minio/operator:noop

Test plugin

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

~/operator/kubectl-minio/kubectl-minio init --console-tls --image localhost/minio/operator:noop --console-image localhost/minio/operator:noop

kubectl -n minio-operator get deployment/console -o yaml
kubectl -n minio-operator get pods
kubectl -n minio-operator logs pod/console-7c9584c85f-89sl7 
Clone this wiki locally