Veeam Kasten with Rancher K3s, WSL 2 & first App: Guide


Userlevel 4
Badge +4

Thought i would Re-post this blog post here :

The original Post

www.mritsurgeon.co.za/2022/03/veeam-kastens-with-rancher-k3s-wsl-2.html

Intro  

 

I wanted to run a small lab environment on my laptop , i would normally do this contained in a VM on hyper V or Vmware Workstation. Since we can Install Windows Subsystem Linux , i decided why not just use WSL to achieve the same.

What I’ve done is install windows subsystem Linux on windows & then Install K3s then install Kasten’s , then install a application called sock shop from Weave Works

Here are the steps , from WSL install to Application install 

**NOTE 

For WSL i recommend creating a config to limit its usage or you will see VMMEM process use most of your system resources. 

See the tail end of this post for config example i used.

WSL:

In PowerShell as administrator run the following :

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

wsl --list --online

wsl --install -d ubuntu-20.04

 

AVvXsEiEO84i2XWnO3RgUt3lkNvwO_ftBUKjjD_NNN2f0rtjldnAS7CKD-bMJ9ePSa76dzCzZuJmTHtMeqxvRAw3G7Pi8CPNnqx1BxDokkQe03QkiN8RFRtgCUbWYok-vOxO8dWczlMxNxVz5F9kPbXNI9uVHL5Fx5B88nJasVDnFxMlj9Sf3wHwmoc5z21L=s16000

 

You will then be prompted with WSL Ubuntu Terminal , finish the installation, and create User & Password

AVvXsEgUn-whz9KlebD_-5ndH-NAAijq32zfPBnuQ5kyuQil7yQrjInCiPv1lm0OGCCnjvrSUTpHnJrW8KReUje48eqeceNa6XDxPxf8iCQEM5vfZQhpl1n6YJLH9HNaN8kCtdUBA7t-dyIky9SXM8J306IG5g0L3A6DHN2NSboAZ5JINCjdEFits7pRs428=s16000

You could also find the terminal through a start menu search

AVvXsEhJihEbrrmVJrKI0Rn4-mp72aVrtLexXfvaQ6dVrYV3QSDhgkl8erC_QIQ4rFAuJElukzhLnQpa3mkXCJWGf7uu73_QE6R7wR3MBN9eaBP6weoh4krlaApIrtJgO4WPMhbKrE2CAeoGTEfgkmw3r415WICtHU_sxYgDBRH58RDkeUk5ygl9aG2XCAeA=s16000
 

Next Prep Linux for K3s Install

Enable systemd as the init system in WSL to you can get normal behavior

sudo -b unshare --pid --fork --mount-proc /lib/systemd/systemd --system-unit=basic.target

sudo -E nsenter --all -t $(pgrep -xo systemd) runuser -P -l $USER -c "exec $SHELL"

Turn off Nftables and use legacy iptables only  ( k3s Doesn’t support NFtables )

sudo update-alternatives --set iptables /usr/sbin/iptables-legacy

Install K3s : Is a lightweight Kubernetes distribution by Rancher labs

sudo curl -sfL https://get.k3s.io | sh -

AVvXsEgh_SSChd3UOgNXVQIatSRL4tLkaMRUAC10FsTUYQACEiwnsTdzRDOzvkOlBU4tnYlDEbpas8Yo01AUdCd25QnUNCw2_csihwXJ9mkP6r9cYr8V_rq4R2LKamVjZU2MDpglEmCObtP64dZieOEWlyDVGDNvu7AeEb891t47jR3cXTWMbmWMKf_hKmkW=s16000

Confirm its installed by checking the version

k3s --version

Check configuration : you want PASS

k3s check-config

Launch K3s Server ( in the background )

screen -d -m -L -Logfile /var/log/k3s.log k3s server

Next Install Helm  

Helm is a software package manager for Kubernetes , we will use helm install our apps , like Kasten

Helm install

sudo curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash

Verify install

helm version

Create Kube Config file ( Helm  Kasten’s install will look for this )

First we will create a folder .kube

Change directory to home your user

cd /home/” ur user “

Make a directory .kube

sudo  mkdir .kube

Change ownership of .kube

sudo chown -R "ur user" /home/ur user/.kube/

generate config file

sudo kubectl config view --raw >~/.kube/config

 

Next Install Kastens

Add helm repository for Kastens

sudo helm repo add kasten https://charts.kasten.io/

create Kastens namespace

sudo kubectl create ns kasten-io

install Kastens using helm ( generate config file should allow Helm to us that for install , but put Kubeconfig in if it doesn’t )

sudo helm install k10 kasten/k10 --namespace=kasten-io --kubeconfig /etc/rancher/k3s/k3s.yaml

At this point its deploying Kastens we can watch this live

sudo Kubectl get pods --namespace kasten-io --watch

They will slowly start one by one ignore the errors unless they don’t go away , mine took 18 odd minutes, Again depends on Laptop and resorces available.

When all containers are running and ready 1/1 , 3/3 , you can move on.

To exit watch , press Ctrl + C

AVvXsEgVnmKBCIRTW2P9e56Z_2k97KnE1qcexrWxcr3jlQRsibIO3NLpGOSkb63rFFJ6-UlcdgW6OS5sI7WPFu4YQSSWMKmKq4mosZjGfbk9l0cO61uOSK2qkecwwWoK7zahwQh6jydNTE1Yhrm-DxDlPA6k8pfmwkl1f4H1phrJYh7vhlfbTMBb6mwI-XdF=s16000

 

Then we Expose the port so we can access the web ui

sudo kubectl --namespace kasten-io port-forward service/gateway 8080:8000 &

Then access this URL to get to K10 Dashboard

http://127.0.0.1:8080/k10/#/dashboard

AVvXsEgVwBWVnLmBEHJGjd45cTEm7aES6GtZ9afxFPJKqSpY2za2s3rhphZatniYcmeL-OiKYcd_JSoJKinR2v8cxxs8gJz15lDbUGM7gEDDpEkwV6VHkd722eHlLHnKdAuC_Bj-TVOHC9ByFOlmSnjzo8oQK8Hfx63EyPLoFhtpbvNmKjqdc0ZXqD9epKiy=s16000

 

 

 

Next we can install a Application

We will deploy Sock-shop

Sock Shop simulates the user-facing part of an e-commerce website that sells socks

Open a new ubuntu WSL terminal

Run PWD to check you still in your home directory

Use Git to clone the deployment to WSL

sudo git clone https://github.com/microservices-demo/microservices-demo

Create sock shop Namespace

sudo kubectl create namespace sock-shop

Apply the Deployment Yaml

sudo kubectl apply -f microservices-demo/deploy/kubernetes/complete-demo.yaml

 

Or  CD to microservices-demo/deploy/Kubernetes /    

Skip if you ran the one above  sudo kubectl apply -f complete-demo.yaml

 

Watch the containers create like we did with kastens

sudo kubectl get pods --namespace sock-shop --watch

This again took some time to get up

AVvXsEjz_gigpcKOZxnL_jGQ-Sryg-TwldpeL_Wgnaa_mVMusgz3sGQrgytz2nK9kanPRLpeZxMpuMuvJwBp-fSzoGEzx9DXnToawFY6GrDgFn5QBfS-O1r58f2SdCfZMAYj2MW0kN9XMk7dq-Hg4Brfpozyyn__CqSO0f0U_Yfm3LQv812aV_FhOekzJySd=s16000

 

Next we use a describe command to get information about sock shop to get its url & port

Sudo kubectl describe svc front-end -n sock-shop

AVvXsEhtGx5oAqFowAAOMHVVdvkSdfqCkM9uRRlQJeqxeGPz_N0xe5lY6im7zQ2jTcJVm0L_FNpHVCAnf2wrLftARYdcRFcItKmSXQQqpk_0aDEfrma6HnLJct9pGMYp5t7UrekWOWzLJ7X3z_SAmIn4Nkq0RKTPfciDbpsfQD5pBhbM0a6qdunMT_qts93R=s16000
 

Its url will be :

http://127.0.0.1:30001

AVvXsEjY6wcSFjix5yC___p1UXz5gyDLAcwY4ybKigR3xEYaek1FyXAfDh9FEaRF1iQsRKuT3GoVJJdWB5RbXFPBeOUBTyGdFH9Bj4ssNa_ajj4TfbWSUCiZfy-VnuIRdRSOctyPaXZCg4QwWbq74p3Blx_6lU8fkpAuW26ZE0wNUS4YXuxMuzM02tNWlfxC=s16000

 

From here you can use Kastens to back up the sockshop and recreate it etc…

This does eat alot of resources on your laptop at one point I was at 99% memory usage, before setting WSL .config.

WSL  .Config

So to hard stop WSL to give memory back run this is PowerShell

wsl –shutdown

When wsl is shutdown, you can create a config that will limit its usage

In ur user profile directory  C:\Users\User>

Create a .wslconfig   file ( make sure to remove the .txt if you use notepad )

In the file paste the following ( modify below as you see fit , for best performance on your Laptop )

 

[wsl2]

memory=10gb

swap=32

 

Conclusion :

 

I used multiple Tools , Software & projects , to have a Lab that i can play round with on my laptop for testing , to read up on each here are the links...

WSL : https://docs.microsoft.com/en-us/windows/wsl/

K3s : https://rancher.com/docs/k3s/latest/en/

Veeam Kastens : https://www.kasten.io/

Sock Shop Demo App : https://go.weave.works/socks

 

Please comment , Share or give mods.


8 comments

Badge

Thanks for sharing. 

Badge

Command “ sudo -E nsenter --all -t $(pgrep -xo systemd) runuser -P -l $USER -c "exec $SHELL"

results in “nsenter: failed to parse pid: ‘runuser’ “

Badge

Running this on standalone ubuntu works better with systemd working out of the box. But working on getting all K10 pods started- seems something else is needed to be configured in k3s (aggregator, ingress, etc) and Kasten doesn’t work with k3s out of the box

Userlevel 7
Badge +22

Running this on standalone ubuntu works better with systemd working out of the box. But working on getting all K10 pods started- seems something else is needed to be configured in k3s (aggregator, ingress, etc) and Kasten doesn’t work with k3s out of the box

Hi robert1231, Kasten should work fine on k3s as I have done a bunch of installs. Where are you having the issue?

For ingress you can change the type to traefik in the helm command and that should work.

Anyways, if you can give a bit more information we can try to help.

 

cheers

 

Geoff

Badge

Running this on standalone ubuntu works better with systemd working out of the box. But working on getting all K10 pods started- seems something else is needed to be configured in k3s (aggregator, ingress, etc) and Kasten doesn’t work with k3s out of the box

Hi robert1231, Kasten should work fine on k3s as I have done a bunch of installs. Where are you having the issue?

For ingress you can change the type to traefik in the helm command and that should work.

Anyways, if you can give a bit more information we can try to help.

 

cheers

 

Geoff

Thanks for the response Geoff and willingness to help!

I attempted to use nginx but opted to drop that and use K3s “out of the box” as much as possible. I have a completely fresh Ubunutu box, I install K3s, Helm and Kasten. Everything seems to work fine but 4-5 Pods get hung in the Pending state (have tried restarting all the pods, re-imaging the machine and starting fresh, etc). Below are all the commands I have run and a k10 get pods output. Trying to gather logs on the pods stuck in Pending state yield no results, but I can get logs for pods that are running

 

I should also note the k3s check-config and K10 primer script both Pass

 

Commands run:
-sudo apt update

-sudo apt install curl

-sudo apt install screen

-sudo apt -y upgrade && systemctl reboot

-curl -sfL https://get.k3s.io | sh -

-k3s check-config

-sudo chmod 644 /etc/rancher/k3s/k3s.yaml

-screen -d -m -L -Logfile /var/log/k3s.log k3s server

-curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash

-helm version

-cd /home/” ur user “

-sudo  mkdir .kube

-sudo chown -R "ur user" /home/ur user/.kube/

-kubectl config view --raw >~/.kube/config

-helm repo add kasten https://charts.kasten.io/

-kubectl create ns kasten-io

-curl https://docs.kasten.io/tools/k10_primer.sh | bash

-helm install k10 kasten/k10 --namespace=kasten-io --kubeconfig /etc/rancher/k3s/k3s.yaml

 

Here are my Kasten pods afterwards…

Pods stuck in “Pending” state

 

Hope this is helpful! Let me know if I can provide any other information. Thank you again

Userlevel 7
Badge +22

Running this on standalone ubuntu works better with systemd working out of the box. But working on getting all K10 pods started- seems something else is needed to be configured in k3s (aggregator, ingress, etc) and Kasten doesn’t work with k3s out of the box

Hi robert1231, Kasten should work fine on k3s as I have done a bunch of installs. Where are you having the issue?

For ingress you can change the type to traefik in the helm command and that should work.

Anyways, if you can give a bit more information we can try to help.

 

cheers

 

Geoff

Thanks for the response Geoff and willingness to help!

I attempted to use nginx but opted to drop that and use K3s “out of the box” as much as possible. I have a completely fresh Ubunutu box, I install K3s, Helm and Kasten. Everything seems to work fine but 4-5 Pods get hung in the Pending state (have tried restarting all the pods, re-imaging the machine and starting fresh, etc). Below are all the commands I have run and a k10 get pods output. Trying to gather logs on the pods stuck in Pending state yield no results, but I can get logs for pods that are running

 

Commands run:
-sudo apt update -sudo apt install curl -sudo apt install screen -sudo apt -y upgrade && systemctl reboot -curl -sfL https://get.k3s.io | sh - -k3s check-config -sudo chmod 644 /etc/rancher/k3s/k3s.yaml -screen -d -m -L -Logfile /var/log/k3s.log k3s server -curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash -helm version -cd /home/” ur user “ -sudo  mkdir .kube -sudo chown -R "ur user" /home/ur user/.kube/ -kubectl config view --raw >~/.kube/config -helm repo add kasten https://charts.kasten.io/ -kubectl create ns kasten-io -curl https://docs.kasten.io/tools/k10_primer.sh | bash -helm install k10 kasten/k10 --namespace=kasten-io --kubeconfig /etc/rancher/k3s/k3s.yaml

 

Here are my Kasten pods afterwards…

Pods stuck in “Pending” state

 

Hope this is helpful! Let me know if I can provide any other information. Thank you again

Hi,

Yes pending state can mean a few things. try do to a kubectl describe -n kasten-io (any pod that is pending) and see if it gives a hint about why it is not being scheduled. Ingress is not an issue yet since pods are pending. One thing to keep in mind is that I believe if you just install k3s default it goes to one of the later versions which might not be supported yet by kasten (just a quick thing to check), if that was the case then you can tell k3s to install an older versions.

Apart from that perhaps it is complaining about “node has insufficient resources”, you would see that in the describe command.

 

cheers

 

Badge

Running this on standalone ubuntu works better with systemd working out of the box. But working on getting all K10 pods started- seems something else is needed to be configured in k3s (aggregator, ingress, etc) and Kasten doesn’t work with k3s out of the box

Hi robert1231, Kasten should work fine on k3s as I have done a bunch of installs. Where are you having the issue?

For ingress you can change the type to traefik in the helm command and that should work.

Anyways, if you can give a bit more information we can try to help.

 

cheers

 

Geoff

Thanks for the response Geoff and willingness to help!

I attempted to use nginx but opted to drop that and use K3s “out of the box” as much as possible. I have a completely fresh Ubunutu box, I install K3s, Helm and Kasten. Everything seems to work fine but 4-5 Pods get hung in the Pending state (have tried restarting all the pods, re-imaging the machine and starting fresh, etc). Below are all the commands I have run and a k10 get pods output. Trying to gather logs on the pods stuck in Pending state yield no results, but I can get logs for pods that are running

 

Commands run:
-sudo apt update -sudo apt install curl -sudo apt install screen -sudo apt -y upgrade && systemctl reboot -curl -sfL https://get.k3s.io | sh - -k3s check-config -sudo chmod 644 /etc/rancher/k3s/k3s.yaml -screen -d -m -L -Logfile /var/log/k3s.log k3s server -curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash -helm version -cd /home/” ur user “ -sudo  mkdir .kube -sudo chown -R "ur user" /home/ur user/.kube/ -kubectl config view --raw >~/.kube/config -helm repo add kasten https://charts.kasten.io/ -kubectl create ns kasten-io -curl https://docs.kasten.io/tools/k10_primer.sh | bash -helm install k10 kasten/k10 --namespace=kasten-io --kubeconfig /etc/rancher/k3s/k3s.yaml

 

Here are my Kasten pods afterwards…

Pods stuck in “Pending” state

 

Hope this is helpful! Let me know if I can provide any other information. Thank you again

Hi,

Yes pending state can mean a few things. try do to a kubectl describe -n kasten-io (any pod that is pending) and see if it gives a hint about why it is not being scheduled. Ingress is not an issue yet since pods are pending. One thing to keep in mind is that I believe if you just install k3s default it goes to one of the later versions which might not be supported yet by kasten (just a quick thing to check), if that was the case then you can tell k3s to install an older versions.

Apart from that perhaps it is complaining about “node has insufficient resources”, you would see that in the describe command.

 

cheers

 

I just installed the latest stable k3s, which I believe is v1.25.0. I might not be using the kubectl describe command correctly (see below)

 

 

Userlevel 5
Badge

In Detail explanation provided @Geoff Burke sir

Comment