Skip to content

Commit 08cc09d

Browse files
committed
wsl2 and raspi instructions
1 parent 8ce62e4 commit 08cc09d

File tree

3 files changed

+92
-2
lines changed

3 files changed

+92
-2
lines changed

docs/tutorials/setup_k8s.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@ This is a very easy set of instructions for setting up an experimental
99
Kubernetes 'cluster' containing a single server and
1010
ready to deploy EPICS IOCs.
1111

12-
It has been tested on Ubuntu 20.10 and Raspberry Pi OS 2021-05-07.
12+
It has been tested on the following:
13+
14+
========================== ============================================
15+
Ubuntu 20.10 any modern linux distro should also work
16+
Raspberry Pi OS 2021-05-07 See `raspberry`
17+
Windows WSL2 See `wsl`
18+
========================== ============================================
1319

1420
Give it a try, K3S provides a good uninstaller that will clean up your system
1521
if you decide to back out.
@@ -38,6 +44,8 @@ Execute this command on your server to set up the cluster master
3844

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

47+
.. _install_kubectl:
48+
4149
Install kubectl
4250
~~~~~~~~~~~~~~~
4351

docs/tutorials/useful_k8s.rst

Lines changed: 83 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Useful Kubernetes Additions
44

55
For the quickest path through the tutorial use an x86 linux machine
66
and follow the instructions here `setup_kubernetes`. For additional
7-
non-essential features use this page.
7+
options and non-essential features use this page.
88

99
Install the Kubernetes Dashboard
1010
--------------------------------
@@ -55,13 +55,95 @@ Finally, start a proxy and goto the Dashboard URL, use the above token to log in
5555
kubectl proxy &
5656
browse to http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy
5757
58+
.. _raspberry:
5859
5960
Installing on a Raspberry Pi
6061
----------------------------
6162
63+
Raspberry Pi3 and Pi4 can run the k3s server. The more memory installed the
64+
better.
65+
66+
We have not worked out how to run the client tools kubectl and helm on the Pi
67+
as yet. You can run these on a separate linux or Windows workstation. There
68+
are arm64 versions of helm and kubectl so we expect that the
69+
`64bit Raspberry Pi OS`_ would be able to run these, but this is untested.
70+
6271
For a Raspberry Pi you need a couple of extra settings to get K3S running::
6372
6473
sudo update-alternatives --set iptables /usr/sbin/iptables-legacy
6574
# edit /boot/cmdline and make sure the single line contains:
6675
# cgroup_memory=1 cgroup_enable=memory
6776
sudo reboot
77+
78+
.. _64bit Raspberry Pi OS: https://www.raspberrypi.org/forums/viewtopic.php?t=275370
79+
80+
.. _wsl:
81+
82+
Installing on Windows Subsystem for Linux
83+
-----------------------------------------
84+
85+
WSL2 gives you a linux distribution running within Windows, the following
86+
additional instructions explain how to use this platform.
87+
88+
Install k3s server
89+
~~~~~~~~~~~~~~~~~~
90+
91+
First you need Windows 10 OS build 20262 or higher.
92+
Then follow the `WSL2 instructions`_.
93+
When installing the linux distribution, choose Ubuntu.
94+
95+
Start a new WSL2 Window and bring up the k3s server as follows::
96+
97+
wget https://github.com/k3s-io/k3s/releases/download/v1.21.2%2Bk3s1/k3s
98+
sudo install -o root -g root -m 0755 k3s /usr/local/bin/k3s
99+
sudo k3s server
100+
101+
There are no services in WSL so this k3s server will run in the foreground.
102+
You need to start a second WLS window to continue as follows::
103+
104+
mkdir .kube
105+
sudo cp /etc/rancher/k3s/k3s.yaml .kube/config
106+
sudo chown giles .kube/config
107+
108+
At this point you can return to the main instructions at `install_kubectl`.
109+
110+
Get X11 GUI to Work with WSL
111+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
112+
113+
When you come to launch the GUI later on you will need some additional steps
114+
as follows.
115+
116+
First you will need install `docker for WSL`_.
117+
118+
You will also require an `X11 Server for Windows`_. When you run the server
119+
choose the option **Disable Access Control** as follows:
120+
121+
.. image:: ../images/vcxsrv.png
122+
:align: center
123+
124+
The networking for docker on WSL will not broadcast between containers so
125+
you need to use EPICS_CA_ADDR_LIST to get edm to see the example IOC
126+
PVs. To do this perform the following steps to get the name of the
127+
example IOC pod and discover its IP address, then pass that to the
128+
edm container::
129+
130+
cd bl00i
131+
132+
kubectl get pods
133+
NAME READY STATUS RESTARTS AGE
134+
example-6779d4dcf-g2cpm 1/1 Running 2 19h
135+
136+
kubectl exec -it example-6779d4dcf-g2cpm -- busybox ifconfig eth0
137+
eth0 Link encap:Ethernet HWaddr 70:85:C2:DB:70:96
138+
inet addr:192.168.86.33 Bcast:192.168.86.255 Mask:255.255.255.0
139+
140+
export DISPLAY=$(awk '/nameserver / {print $2; exit}' /etc/resolv.conf 2>/dev/null):0
141+
export LIBGL_ALWAYS_INDIRECT=1
142+
143+
# IP ADDRESS from above kubectl command
144+
./opi/stexample-gui.sh -e EPICS_CA_ADDR_LIST=192.168.86.33
145+
146+
147+
.. _WSL2 instructions: https://docs.microsoft.com/en-us/windows/wsl/install-win10
148+
.. _docker for WSL: https://docs.docker.com/docker-for-windows/wsl/
149+
.. _X11 Server for Windows: https://sourceforge.net/projects/vcxsrv/

images/vcxsrv.png

12 KB
Loading

0 commit comments

Comments
 (0)