miniature-kangaroo-6093
04/17/2025, 5:28 PMmysterious-animal-29850
04/17/2025, 6:01 PMminiature-kangaroo-6093
04/17/2025, 6:15 PMmysterious-animal-29850
04/17/2025, 6:28 PMminiature-kangaroo-6093
04/17/2025, 6:35 PMmysterious-animal-29850
04/17/2025, 6:37 PMminiature-kangaroo-6093
04/17/2025, 6:54 PMmysterious-animal-29850
04/21/2025, 8:11 PMmysterious-animal-29850
04/21/2025, 8:14 PMsl-c1:~ # rke2 --version
rke2 version v1.31.7+rke2r1 (7b18bda1c5ec1e110cec206f9163f6aba3a2154d)
go version go1.23.6 X:boringcrypto
MicroOS version
sl-c1:~ # cat /etc/os-release
NAME="openSUSE Leap Micro"
VERSION="6.1"
ID="opensuse-leap-micro"
ID_LIKE="suse opensuse opensuse-leap suse-microos"
VERSION_ID="6.1"
PRETTY_NAME="openSUSE Leap Micro 6.1"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:leap-micro:6.1"
BUG_REPORT_URL="<https://bugs.opensuse.org>"
HOME_URL="<https://www.opensuse.org/>"
DOCUMENTATION_URL="<https://en.opensuse.org/Portal:LeapMicro>"
LOGO="distributor-logo-LeapMicro"
RKE2 First node config
sl-c1:~ # cat /etc/rancher/rke2/config.yaml
enable-servicelb: true
cni: calico
K8s pods running
sl-c1:~ # kubectl get po -A
NAMESPACE NAME READY STATUS RESTARTS AGE
calico-system calico-kube-controllers-564697854-l7g86 1/1 Running 0 8m59s
calico-system calico-node-tbjdt 1/1 Running 0 8m46s
calico-system calico-typha-5447f546d9-9822b 1/1 Running 0 8m37s
kube-system cloud-controller-manager-sl-c1 1/1 Running 4 (15h ago) 2d20h
kube-system etcd-sl-c1 1/1 Running 1 2d20h
kube-system helm-install-rke2-calico-crd-fqljj 0/1 Completed 3 2d20h
kube-system helm-install-rke2-calico-p7tjl 0/1 Completed 3 2d20h
kube-system helm-install-rke2-coredns-4h45q 0/1 Completed 0 2d20h
kube-system helm-install-rke2-ingress-nginx-kfk6r 0/1 Completed 0 2d20h
kube-system helm-install-rke2-metrics-server-klsqs 0/1 Completed 0 2d20h
kube-system helm-install-rke2-runtimeclasses-wfgtt 0/1 Completed 0 2d20h
kube-system helm-install-rke2-snapshot-controller-crd-rmqn9 0/1 Completed 0 2d20h
kube-system helm-install-rke2-snapshot-controller-dzhvt 0/1 Completed 0 2d20h
kube-system kube-apiserver-sl-c1 1/1 Running 4 2d20h
kube-system kube-controller-manager-sl-c1 1/1 Running 4 (15h ago) 2d20h
kube-system kube-proxy-sl-c1 1/1 Running 0 2d15h
kube-system kube-scheduler-sl-c1 1/1 Running 3 (15h ago) 2d20h
kube-system rke2-coredns-rke2-coredns-autoscaler-596dcdf688-k88j4 1/1 Running 2 (2d15h ago) 2d20h
kube-system rke2-coredns-rke2-coredns-cf7df985b-nrpwx 1/1 Running 2 (2d15h ago) 2d20h
kube-system rke2-ingress-nginx-controller-52d8f 1/1 Running 2 (2d15h ago) 2d20h
kube-system rke2-metrics-server-58ff89f9c7-tcx5k 1/1 Running 2 (2d15h ago) 2d20h
kube-system rke2-snapshot-controller-58dbcfd956-l85mr 1/1 Running 2 (2d15h ago) 2d20h
tigera-operator tigera-operator-56b7b68557-n9sxl 1/1 Running 0 8m15s
K8s Node
sl-c1:~ # kubectl get no
NAME STATUS ROLES AGE VERSION
sl-c1 Ready control-plane,etcd,master 2d20h v1.31.7+rke2r1
mysterious-animal-29850
04/21/2025, 8:16 PMminiature-kangaroo-6093
04/21/2025, 8:22 PM#!/bin/bash
set -e
## Note:
## To check if the k3s installation has been finished
## issue the "systemctl status k3sinstall.service" command.
## To finish the installation you must reboot!
## Once booted you can check the node with:
## "kubectl get nodes"
## For more check out:
## "<https://documentation.suse.com/trd/kubernetes/pdf/kubernetes_ri_k3s-slemicro_color_en.pdf>"
## Enable network
# combustion: network
## Post output on stdout
exec > >(exec tee -a /dev/tty0) 2>&1
## 1Password Token - expire in 30 days. Empty to skip
OP_SERVICE_ACCOUNT_TOKEN=ops_<some_exceptionally_long_token>
## Install 1Password
if [ "$OP_SERVICE_ACCOUNT_TOKEN" ]
then
rpm --import <https://downloads.1password.com/linux/keys/1password.asc>
zypper addrepo <https://downloads.1password.com/linux/rpm/stable/x86_64> 1password
zypper --non-interactive install 1password-cli
fi
## Add password for root user
## SUSE documentation recommends openssl passwd -6, mkpasswd --method=sha-512 works as well
## Retrieve from 1Password, otherwise the default password that is set here is: linux
if [ "$OP_SERVICE_ACCOUNT_TOKEN" ]
then
ROOT_USER_PASSWORD=$(openssl passwd -6 $(op read "<op://IT> Infrastruktuur/K3s root/password"))
NORMAL_USER_PASSWORD=$(openssl passwd -6 $(op read "<op://IT> Infrastruktuur/K3s user/password"))
else
ROOT_USER_PASSWORD='redacted'
NORMAL_USER_PASSWORD='redacted'
fi
SSH_ROOT_PUBLIC_KEY=ssh_key.pub
SSH_USER_PUBLIC_KEY=ssh_key.pub
USER_REQUIRED_PACKAGES='bash-completion btop bat nano' ## patterns-microos-cockpit cockpit
CREATE_NORMAL_USER=<some_silly_username> ## Add the username here to create a user, leave empty to skip creating one
NODE_HOSTNAME="k8s-control-0" ## If you want to add additional nodes to a cluster you must set the hostname or nodes will not be able to join
## K3s configuration
##MASTER_NODE_ADDR='172.168.255.104'
##MASTER_NODE_K3S_TOKEN
##INSTALL_K3S_EXEC='server'
INSTALL_K3S_UPSTREAM=true ## Set to false if you want to use the openSUSE rpm, also add the package name to USER_REQUIRED_PACKAGES
INSTALL_K3S_EXEC='server --cluster-init' ## Not used, just reference
## Set hostname
echo $NODE_HOSTNAME > /etc/hostname
## Mount /var and /home so user can be created smoothly
if [ "$CREATE_NORMAL_USER" ]
then
mount /var && mount /home
fi
## Retrieve SSH key
##if [ "$OP_SERVICE_ACCOUNT_TOKEN" ]
##then
## Setup SSH credentials
## TODO - 1Password does not support SSH keys in another vault
##fi
## Set root password
echo root:$ROOT_USER_PASSWORD | chpasswd -e
## Add ssh public key as authorized key for the root user
mkdir -pm700 /root/.ssh/
cat $SSH_ROOT_PUBLIC_KEY >> /root/.ssh/authorized_keys
## User creation
if [ "$CREATE_NORMAL_USER" ]
then
echo "User creation is requested, creating user."
useradd -m $CREATE_NORMAL_USER -s /bin/bash -g users
echo $CREATE_NORMAL_USER:$NORMAL_USER_PASSWORD | chpasswd -e
echo $CREATE_NORMAL_USER "ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/adminusers
mkdir -pm700 /home/$CREATE_NORMAL_USER/.ssh/
chown -R $CREATE_NORMAL_USER:users /home/$CREATE_NORMAL_USER/.ssh/
cat $SSH_USER_PUBLIC_KEY >> /home/$CREATE_NORMAL_USER/.ssh/authorized_keys
echo "Requested user has been created, requested password has been set."
else
echo "No user will be created"
fi
## Install required packages
if [ "$USER_REQUIRED_PACKAGES" ]
then
zypper ref && zypper --non-interactive install $USER_REQUIRED_PACKAGES
fi
## Setup K3s config files
mkdir -p /etc/rancher/k3s/config.yaml.d
cat k3s/registries.yaml > /etc/rancher/k3s/registries.yaml
cat k3s/config.yaml > /etc/rancher/k3s/config.yaml
mkdir -p /mnt/pv
mkdir -p /usr/libexec/kubernetes/kubelet-plugins
## Setup K3s token
if [ "$OP_SERVICE_ACCOUNT_TOKEN" ]
then
##op item get ai6gs7gbkmuo3droolbdh3dgu4
op inject -f -i k3s/token.yaml -o /etc/rancher/k3s/config.yaml.d/token.yaml
chmod +r /etc/rancher/k3s/config.yaml.d/token.yaml
fi
if $INSTALL_K3S_UPSTREAM; then
## Download and install the latest k3s installer
curl -L --output k3s_installer.sh <https://get.k3s.io> && install -m755 k3s_installer.sh /usr/bin/
## Create a systemd unit that installs k3s if not installed yet
cat install-rancher-k3s.service > /etc/systemd/system/install-rancher-k3s.service
fi
## Enable services
##systemctl enable cockpit.socket
systemctl enable sshd
systemctl enable install-rancher-k3s.service
## Unmount var and home
if [ "$CREATE_NORMAL_USER" ]
then
umount /var && umount /home
fi
echo "Configured with Combustion" > /etc/issue.d/combustion
## Close outputs and wait for tee to finish.
##exec 1>&- 2>&-; wait;
I used the default image from openSUSE: openSUSE-MicroOS-DVD-x86_64-Snapshot20250219-Media.iso
My config.yaml
tls-san:
- k3s.<some_private_domain>.org
- k3s.local
#cluster-init: true # Setup a clean cluster
embedded-registry: true # use embedded peer to peer registry
flannel-backend: "none" # Disable Flannel, in order to install Calico
disable-network-policy: true # Disable policy, in order to install Calico
disable:
- traefik # Calico Install
- servicelb
default-local-storage-path: /mnt/pv
rootless: false
selinux: true
disable-kube-proxy: true
write-kubeconfig-mode: "0644"
miniature-kangaroo-6093
04/21/2025, 8:25 PMminiature-kangaroo-6093
04/21/2025, 8:28 PMmysterious-animal-29850
04/21/2025, 8:42 PMopenSUSE-Leap-Micro.x86_64-Default-qcow.qcow2
image.