1---
2title: "Road to local k8s"
3date: 2020-07-13
4tags: ['kubernetes', 'linux', 'fedora']
5---
6
7# Goal
8
9The goal is to deploy kubernetes on my local networks, and keep everything as
10reproducible as possible.
11
12# Stack
13
14I\'ll use Fedora Core OS, Matchbox and Terraform [^1], a match the requirements
15for Tectonic [^2]
16
17## Steps
18
19- Network Setup DHCP/TFTP/DNS [^3]
20- Matchbox [^4]
21- PXE network boot environment
22- Terraform Tectonic [^5]
23
24## Network Setup DHCP/TFTP/DNS
25
26First learning the basics again:
27
28- <https://linuxhint.com/install_dhcp_server_ubuntu/>
29- <https://www.youtube.com/watch?v=XQ3T14SIlV4>
30
31To check open ports
32
33```shell
34lsof -Pni | grep LISTEN
35```
36
37Run the provided [^6] image with `dnsmasq` and PXE toolkit
38
39``` {.bash org-language="sh"}
40docker run --rm --cap-add=NET_ADMIN --net=host quay.io/coreos/dnsmasq \
41 -d -q \
42 --dhcp-range=192.168.1.3,192.168.1.254 \
43 --enable-tftp --tftp-root=/var/lib/tftpboot \
44 --dhcp-match=set:bios,option:client-arch,0 \
45 --dhcp-boot=tag:bios,undionly.kpxe \
46 --dhcp-match=set:efi32,option:client-arch,6 \
47 --dhcp-boot=tag:efi32,ipxe.efi \
48 --dhcp-match=set:efibc,option:client-arch,7 \
49 --dhcp-boot=tag:efibc,ipxe.efi \
50 --dhcp-match=set:efi64,option:client-arch,9 \
51 --dhcp-boot=tag:efi64,ipxe.efi \
52 --dhcp-userclass=set:ipxe,iPXE \
53 --dhcp-boot=tag:ipxe,http://matchbox.example.com:8080/boot.ipxe \
54 --address=/matchbox.example/192.168.1.2 \
55 --log-queries \
56 --log-dhcp
57```
58
59## Matchbox
60
61## PXE network boot environment
62
63## Terraform Tectonic
64
65------------------------------------------------------------------------
66
67# Links
68
69[^1]: <https://coreos.com/tectonic/docs/latest/install/bare-metal/metal-terraform.html>
70
71[^2]: <https://coreos.com/tectonic/docs/latest/install/bare-metal/requirements.html>
72
73[^3]: <https://coreos.com/matchbox/docs/latest/network-setup.html>
74
75[^4]: <https://coreos.com/matchbox/docs/latest/deployment.html>
76
77[^5]: <https://coreos.com/tectonic/releases/>
78
79[^6]: <https://github.com/poseidon/matchbox/tree/v0.7.0/contrib/dnsmasq>