main
1<!DOCTYPE html>
2<html lang="en">
3<head>
4<!-- Sep 03, 2024 -->
5<meta charset="utf-8" />
6<meta name="viewport" content="width=device-width, initial-scale=1" />
7<title>Kubernetes on NixOS</title>
8<meta name="author" content="Vincent Demeester" />
9<meta name="keywords" content="post" />
10<meta name="generator" content="Org Mode" />
11<link rel="stylesheet" type="text/css" href="/css/2022.css" />
12<link rel="stylesheet" type="text/css" href="/css/syntax.css" />
13<link rel='icon' type='image/x-icon' href='/images/favicon.ico'/>
14<meta name='viewport' content='width=device-width, initial-scale=1'>
15</head>
16<body>
17<main id="content" class="content">
18<header>
19<h1 class="title">Kubernetes on NixOS</h1>
20</header><p>
21This document will serve to document the way I setup my own little personal kubernetes
22cluster on NixOS. I am using virtual machines for this (as of today) because it is simpler
23to use, and as for <a href="microk8s.html">microk8s</a> document, I rely on the fact that my network setup is capable
24of assigning a predefined IP to a given mac address.
25</p>
26<section id="outline-container-Why%20Kubernetes%20at%20home%20%3F" class="outline-2">
27<h2 id="Why%20Kubernetes%20at%20home%20%3F">Why Kubernetes at home ?</h2>
28<div class="outline-text-2" id="text-Why%20Kubernetes%20at%20home%20%3F">
29<p>
30The first question that can come to mind is “why the hell do you want to setup a
31kubernetes cluster at home” ? And… that’s a valid question.
32</p>
33
34<p>
35I work daily on Kubernetes and OpenShift, and on a CI/CD tooling that I want to be as
36useful as possible. If I don’t use it myself, what the hell am I doing right ? That’s the
37main reason why setuping a Kubernetes (and of course <a href="https://tekton.dev">Tekton</a> on it) — gaining operational
38knowledge, find the gap and enhancements, …
39</p>
40</div>
41</section>
42<section id="outline-container-Bootstrap%20the%20cluster" class="outline-2">
43<h2 id="Bootstrap%20the%20cluster">Bootstrap the cluster</h2>
44<div class="outline-text-2" id="text-Bootstrap%20the%20cluster">
45<p>
46How big should the cluster be ? 3 nodes or 5 nodes ?
47Let’s start with 3, and figure the rest out.
48</p>
49
50<p>
51We need to do the following to boostrap the cluster:
52</p>
53<ul class="org-ul">
54<li>Configure the network to allocate a set of IP for a set a MAC address</li>
55<li>Create VMs images (<code>qcow2</code>) with NixOS and the base system on</li>
56<li>Create VMs on a remote server libvirt</li>
57<li><i>Hopefully</i> enjoy, and <code>ssh</code> onto them in need be</li>
58</ul>
59
60<p>
61Ideally, the image we build is using the configuration, this means we should, in theory,
62use <code>nixos-generate</code> targeting our <i>node</i> configuration, and it should be the exact same thing
63used for <code>morph</code>.
64</p>
65
66<p>
67Once the images are created, we need to copy them to the right host and from there, create
68the virtual machine. Ideally, we do this automatically, command-line, …
69</p>
70</div>
71</section>
72<section id="outline-container-References" class="outline-2">
73<h2 id="References">References</h2>
74<div class="outline-text-2" id="text-References">
75</div>
76<div id="outline-container-%5B%5Bhttps%3A%2F%2Fnixos.wiki%2Fwiki%2FKubernetes%5D%5BKubernetes%20-%20NixOS%20Wiki%5D%5D" class="outline-3">
77<h3 id="%5B%5Bhttps%3A%2F%2Fnixos.wiki%2Fwiki%2FKubernetes%5D%5BKubernetes%20-%20NixOS%20Wiki%5D%5D"><a href="https://nixos.wiki/wiki/Kubernetes">Kubernetes - NixOS Wiki</a></h3>
78<div class="outline-text-3" id="text-%5B%5Bhttps%3A%2F%2Fnixos.wiki%2Fwiki%2FKubernetes%5D%5BKubernetes%20-%20NixOS%20Wiki%5D%5D">
79<p>
80<span class="timestamp-wrapper"><span class="timestamp">[2020-06-11 Thu 15:25]</span></span>
81</p>
82</div>
83</div>
84</section>
85</main>
86<footer id="postamble" class="status">
87<footer>
88 <small><a href="/" rel="history">Index</a> • <a href="/sitemap.html">Sitemap</a> • <a href="https://dl.sbr.pm/">Files</a></small><br/>
89 <small class='questions'>Questions, comments ? Please use my <a href="https://lists.sr.ht/~vdemeester/public-inbox">public inbox</a> by sending a plain-text email to <a href="mailto:~vdemeester/public-inbox@lists.sr.ht">~vdemeester/public-inbox@lists.sr.ht</a>.</small><br/>
90 <small class='copyright'>
91 Content and design by Vincent Demeester
92 (<a rel='licence' href='http://creativecommons.org/licenses/by-nc-sa/3.0/'>Some rights reserved</a>)
93 </small><br />
94</footer>
95</footer>
96</body>
97</html>