<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.3.2">Jekyll</generator><link href="https://dimitris.karakasilis.me/feed.xml" rel="self" type="application/atom+xml" /><link href="https://dimitris.karakasilis.me/" rel="alternate" type="text/html" /><updated>2026-11-25T05:01:03+00:00</updated><id>https://dimitris.karakasilis.me/feed.xml</id><title type="html">Dimitris Karakasilis</title><subtitle>Dimitris Karakasilis&apos; personal blog.</subtitle><entry><title type="html">Every number is a middle</title><link href="https://dimitris.karakasilis.me/2026/11/23/every-number-is-a-middle.html" rel="alternate" type="text/html" title="Every number is a middle" /><published>2026-11-23T00:00:00+00:00</published><updated>2026-11-23T00:00:00+00:00</updated><id>https://dimitris.karakasilis.me/2026/11/23/every-number-is-a-middle</id><content type="html" xml:base="https://dimitris.karakasilis.me/2026/11/23/every-number-is-a-middle.html"><![CDATA[<h2 id="how-this-started">How this started</h2>

<p>In August 2024, I think it was after watching the movie <a href="https://en.wikipedia.org/wiki/The_Man_Who_Knew_Infinity_(film)">“The Man Who Knew Infinity”</a>, I found myself awake at 4 a.m. thinking about <a href="https://en.wikipedia.org/wiki/Goldbach%27s_conjecture">Goldbach’s conjecture</a> (the last time this happened was when I read <a href="https://en.wikipedia.org/wiki/Uncle_Petros_and_Goldbach%27s_Conjecture">“Uncle Petros and Goldbach’s Conjecture”</a> decades ago). This conjecture is an amazing math puzzle that is so simple to describe and yet so impossible to prove.</p>

<p>To be clear, I wasn’t hallucinating a proof here. I was merely thinking about primes and their properties, when I realized that if the conjecture is correct, then every integer greater than 1 is “enclosed” (or “defined”, if you prefer) between two primes.</p>

<p>My “breakthrough” idea was that if every even number is a sum of two primes (that’s the conjecture), then half of that number sits right in the middle of the two primes. And since every integer’s double is an even number, every integer greater than 1 is enclosed between two primes.
In other words, if we had built our math defining only prime numbers (giving symbols only to primes, let’s say), then all other integers would be defined as the middle of one or more pairs of those primes. Not some of the integers, all of them.</p>

<p>Then I thought that, given an integer, you can imagine expanding around it until you hit the first of those prime pairs, like a bubble that expands around the given integer. And I thought a visualization of that concept might reveal some patterns. For example, going back from a given integer and giving an index to every prime before it, how far in the index would one have to go to reach a prime that “defines” that integer (together, obviously, with the symmetric prime on the other side)? If we were to plot those index numbers for lots of integers, would a pattern reveal itself?
If there was a pattern, it might allow us to “predict” prime numbers by simply “reflecting” a known smaller prime to the other side of the integer it defines.</p>

<p>It was 4 a.m. at that point, and in order to get some sleep, I sent myself an email, hoping I would pick it up some other day and write a program to visualize it.</p>

<p>Two years passed and the AI boom happened. Reading about AI <a href="https://www.aljazeera.com/news/2026/11/21/riemann-hypothesis-has-the-worlds-most-famous-maths-problem-been-cracked">solving the Riemann hypothesis</a> got me thinking about the above concept again. Getting this plot should be a one-shot prompt now, right? And indeed it was. I asked <a href="https://claude.ai">Claude</a> whether this concept had already been researched and, as I expected, it had. I asked it to create a mini-page to demonstrate the concept in an interactive way. It explained the research that has been done around this concept and also built the page below.</p>

<p>Before I let you explore this on your own, here is why I wrote this. Personally, not being a genius, I don’t hope to solve any hard math or physics problems. So for me and many other average people in this world, AI doesn’t pose a threat. It’s an opportunity to learn and understand concepts that were out of reach until now, either because good teachers are hard to find or because the concepts are really hard to grasp. In any case, AI can help us understand those concepts and explore deeper, speeding up our experimentation, visualization and iterations.</p>

<p>I think it’s time for me to pick up some of the subjects I studied at university that I never really got a grasp of. In the meantime, knock yourselves out:</p>

<p><em>Disclaimer: I haven’t checked the correctness of every part of Claude’s answer and of the explanations below it. The sources are linked throughout the post and listed at the end, so you can check them yourself.</em></p>

<hr class="g-divider" />

<h2 id="claudes-answer">Claude’s answer</h2>

<p>Yes, this has been explored. “Every integer greater than 1 is the average of two primes” is a known way to restate Goldbach’s conjecture. The smallest bubble around a number n, meaning the smallest distance r for which n − r and n + r are both prime, has its own entry in the On-Line Encyclopedia of Integer Sequences, <a href="https://oeis.org/A047160">A047160</a>. Several close relatives have entries too, and they are listed at the end of this post. The backward index does not seem to have an entry of its own, but it follows directly from that distance, because it counts the primes between n − r and n. A plot should show a statistical pattern, with bands that depend on whether 3 divides n, but no exact rule that would predict a prime. The explorer below lets you check that for yourself.</p>

<h2 id="try-it">Try it</h2>

<p>Pick a number n. The dashed arcs are the radii that fail, tried in order. The first arc that lands on a prime at both ends is highlighted.</p>

<div class="card g-figure" id="explorer">
<div class="card-body">
<div class="g-controls">
<div class="input-group input-group-sm g-n">
<div class="input-group-prepend"><span class="input-group-text g-mono">n =</span></div>
<div class="input-group-prepend"><button class="btn btn-secondary" type="button" id="n-dec" aria-label="Decrease n">&minus;</button></div>
<input id="n-input" type="text" inputmode="numeric" class="form-control" value="20" aria-label="The number n" />
<div class="input-group-append"><button class="btn btn-secondary" type="button" id="n-inc" aria-label="Increase n">+</button></div>
</div>
<input id="n-range" type="range" class="custom-range g-range" min="4" max="400" value="20" aria-label="Slide n from 4 to 400" />
<button type="button" class="btn btn-sm btn-secondary" id="n-rand">Random n up to 1,000,000</button>
<div class="form-check form-check-inline"><input class="form-check-input" type="checkbox" id="zero-1" /><label class="form-check-label" for="zero-1">allow radius 0</label></div>
<div class="form-check form-check-inline"><input class="form-check-input" type="checkbox" id="all-pairs" /><label class="form-check-label" for="all-pairs">show every pair</label></div>
</div>
<div class="g-line-wrap"><svg id="line" viewBox="0 0 1000 400" role="img" aria-labelledby="readout"></svg></div>
<p class="g-readout" id="readout" aria-live="polite"></p>
</div>
</div>

<h2 id="from-sums-to-midpoints">From sums to midpoints</h2>

<p>Here are all the ways to split 20 into two whole numbers. The highlighted pairs are the ones where both numbers are prime:</p>

<div class="g-chips" id="ladder"></div>

<p>“20 is a sum of two primes” says the same thing as “there are two primes at equal distance from 10”. Since every whole number n is the midpoint of 2n, the conjecture can be stated without sums:</p>

<div class="g-math">For every whole number n &ge; 2 there is an r &ge; 0 with n &minus; r and n + r both prime.</div>

<p>Equivalently, every whole number from 2 on is the average of two primes. This reformulation is well known. It is the reason <a href="https://oeis.org/A047160">A047160</a> defines its terms with the clause “or −1 if no such m exists”: a single −1 anywhere in it would be a counterexample to Goldbach.</p>

<p>These are all the pairs of primes around the n in the explorer above:</p>

<p class="g-note" id="pairs-note"></p>
<div class="g-chips" id="pairs"></div>

<h2 id="the-smallest-circle">The smallest circle</h2>

<p>For each n, call r(n) the radius of the smallest circle that lands on two primes. That is the smallest r for which n − r and n + r are both prime. For n = 2, 3, 4, … the first values are</p>

<div class="g-math">0, 0, 1, 0, 1, 0, 3, 2, 3, 0, 1, 0, 3, 2, 3, &hellip;</div>

<p>That is <a href="https://oeis.org/A047160">A047160</a>. The zeros are the primes themselves, since a prime p is the middle of p and p. If you require two <em>different</em> primes, so r ≥ 1, you get <a href="https://oeis.org/A082467">A082467</a>:</p>

<div class="g-math">n = 4, 5, 6, &hellip;:&nbsp;&nbsp;1, 2, 1, 4, 3, 2, 3, 6, 1, 6, 3, 2, 3, 6, 1, &hellip;</div>

<p>The explorer and the graphs use this second version by default, because it matches the backward walk below, which only looks at primes strictly below n. Tick “allow radius 0” to switch to the first version. The r ≥ 1 version holding for every n ≥ 4 is a slightly stronger claim than Goldbach: every even number greater than 6 is the sum of two <em>different</em> primes. It is also believed to be true and has been checked just as far, but it is not proven either.</p>

<h2 id="walking-backwards">Walking backwards</h2>

<p>The same search can be done by walking down from n through the primes below it and numbering them. The nearest prime below n gets index 1, the next one index 2, and so on. For each prime p you check its mirror image 2n − p on the other side. The first prime whose mirror is also prime is the one that “defines” n, and its position in the walk is the index k(n). When a mirror is not prime, the chip shows its smallest factor.</p>

<p class="g-note" id="scan-note"></p>
<div class="g-chips" id="scan"></div>

<p>The walk passes every prime between n − r and n, so the index counts primes. With π(x) for the number of primes up to x:</p>

<div class="g-math">k(n) = &pi;(n &minus; 1) &minus; &pi;(n &minus; r(n) &minus; 1)</div>

<p>Near n, primes are about ln n apart on average, so k(n) is roughly r(n) / ln n.</p>

<p>A closely related quantity runs the scan in the opposite direction. The <em>minimal Goldbach partition</em> of 2n starts from the outside, at 3, 5, 7, …, and stops at the first prime p for which 2n − p is prime (<a href="https://oeis.org/A020481">A020481</a>). The walk from the middle finds the closest pair of primes and the scan from the outside finds the widest one. Tomás Oliveira e Silva, Siegfried Herzog and Silvio Pardi recorded the minimal partition for every even number up to 4 × 10<sup>18</sup> while verifying the conjecture. The largest smallest prime they met was 9781, needed for 3,325,581,707,333,960,528.</p>

<h2 id="the-graph">The graph</h2>

<p>Each dot is one n. Its height is the radius, the index, or the radius divided by (ln n)<sup>2</sup>. Dots are colored by the small odd primes that divide n, which turns out to matter a lot. Everything is computed in your browser when you change a setting. Hover to read a value, and click a dot to load that n into the explorer.</p>

<div class="card g-figure">
<div class="card-body">
<div class="g-controls">
<span class="g-small">n up to</span>
<div class="btn-group btn-group-sm" role="group" id="seg-N" aria-label="Range of n">
<button type="button" class="btn btn-secondary" data-v="1000" aria-pressed="false">1k</button>
<button type="button" class="btn btn-secondary active" data-v="10000" aria-pressed="true">10k</button>
<button type="button" class="btn btn-secondary" data-v="100000" aria-pressed="false">100k</button>
<button type="button" class="btn btn-secondary" data-v="1000000" aria-pressed="false">1M</button>
</div>
<div class="btn-group btn-group-sm" role="group" id="seg-metric" aria-label="Height of each dot">
<button type="button" class="btn btn-secondary active" data-v="r" aria-pressed="true">radius r</button>
<button type="button" class="btn btn-secondary" data-v="k" aria-pressed="false">index k</button>
<button type="button" class="btn btn-secondary" data-v="rn" aria-pressed="false">r / (ln n)&sup2;</button>
</div>
<div class="form-check form-check-inline"><input class="form-check-input" type="checkbox" id="log-y" /><label class="form-check-label" for="log-y">log scale</label></div>
<div class="form-check form-check-inline"><input class="form-check-input" type="checkbox" id="zero-2" /><label class="form-check-label" for="zero-2">allow radius 0</label></div>
</div>
<div class="g-legend" id="legend"></div>
<div class="g-chart-box" id="chart-box">
<canvas id="plot" aria-label="Scatter plot of the chosen measure for every n in range"></canvas>
<canvas id="overlay" tabindex="0" aria-label="Hover or use the arrow keys to inspect values"></canvas>
<div class="g-tip" id="tip" hidden=""></div>
</div>
<div class="g-stats" id="stats"></div>
<details open="">
<summary>Record radii in this range</summary>
<p class="g-note mt-2 mb-2">Each row is an n whose radius is larger than that of every smaller n.</p>
<div class="g-table-wrap"><table class="table table-sm" id="records"><thead><tr><th>n</th><th>radius r</th><th>pair</th><th>index k</th><th>r / (ln n)&sup2;</th></tr></thead><tbody></tbody></table></div>
</details>
</div>
</div>

<h2 id="reading-the-graph">Reading the graph</h2>

<h3 id="the-radius-grows-slowly">The radius grows slowly</h3>

<p>The radius does grow, but so slowly that the scatter plot hides it. The x axis is linear, so most of the dots sit in the right part of the range, where (ln n)<sup>2</sup> barely changes. Between n = 500,000 and 1,000,000 it only goes from 172 to 191. Averaging the radius over ranges of n makes the growth visible:</p>

<table class="table table-sm g-mono">
  <thead>
    <tr>
      <th>range of n</th>
      <th style="text-align: right">mean r</th>
      <th style="text-align: right">largest r</th>
      <th style="text-align: right">mean r / (ln n)²</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>100 to 200</td>
      <td style="text-align: right">11.3</td>
      <td style="text-align: right">42</td>
      <td style="text-align: right">0.45</td>
    </tr>
    <tr>
      <td>1,000 to 2,000</td>
      <td style="text-align: right">26.6</td>
      <td style="text-align: right">168</td>
      <td style="text-align: right">0.50</td>
    </tr>
    <tr>
      <td>10,000 to 20,000</td>
      <td style="text-align: right">46.9</td>
      <td style="text-align: right">486</td>
      <td style="text-align: right">0.51</td>
    </tr>
    <tr>
      <td>100,000 to 200,000</td>
      <td style="text-align: right">73.2</td>
      <td style="text-align: right">1,086</td>
      <td style="text-align: right">0.52</td>
    </tr>
    <tr>
      <td>500,000 to 1,000,000</td>
      <td style="text-align: right">96.1</td>
      <td style="text-align: right">1,515</td>
      <td style="text-align: right">0.53</td>
    </tr>
  </tbody>
</table>

<p>The mean radius grows about nine times over this span, while the mean of r / (ln n)<sup>2</sup> stays close to 0.5. The heuristic behind this comes from G. H. Hardy and J. E. Littlewood (1923). The number of ways to write an even number 2n as a sum of two primes is expected to be roughly</p>

<div class="g-math">G(2n) &asymp; 2&Pi;&#8322; &middot; &prod;<sub>p | n, p odd</sub> (p &minus; 1)/(p &minus; 2) &middot; 2n / (ln 2n)&sup2;</div>

<p>Here Π₂ ≈ 0.6602 is the twin prime constant, and the product runs over the odd primes that divide n. The pairs are spread over about n possible radii, so a typical gap between radii that work is around (ln n)<sup>2</sup>, and the smallest working radius is of that size too. The statistics under the graph put the two numbers side by side: the mean radius and (ln N)<sup>2</sup> for the largest n in range.</p>

<h3 id="the-bands-come-from-divisibility-by-3-5-7-">The bands come from divisibility by 3, 5, 7, …</h3>

<p>The colored layers in the graph come from the product term in that formula. Suppose 3 does not divide n. Then for any radius that is not a multiple of 3, one of n − r and n + r is a multiple of 3. For example, with n = 10 and r = 1 you get 9 and 11. So only one radius in three can work. When 3 divides n, the two ends are either both multiples of 3 or neither is, so two radii in three can work. That doubles the chances, which is the factor (3 − 1)/(3 − 2) = 2. The same reasoning gives 4/3 for 5 and 6/5 for 7.</p>

<p id="band-note"></p>

<h3 id="the-index-looks-like-a-waiting-time">The index looks like a waiting time</h3>

<p>Here is how often each index value occurs in the range selected in the graph above:</p>

<div class="card g-figure">
<div class="card-body">
<div class="g-legend" id="hist-legend"></div>
<div class="g-chart-box" id="hist-box">
<svg id="hist" viewBox="0 0 1000 340" role="img" aria-label="Histogram of the index k"></svg>
<div class="g-tip" id="htip" hidden=""></div>
</div>
</div>
</div>

<p id="hist-note"></p>

<p>This is the shape you get from flipping a biased coin and counting the flips until the first heads. Each prime you pass on the walk down has a mirror that is prime with a probability of roughly c / ln n, where c depends on the small prime factors of n. The checks behave close to independently, so the index follows a <em>geometric distribution</em>, the dashed line. Its mean grows slowly with n, in proportion to ln n.</p>

<h2 id="could-the-index-hand-us-a-prime-for-free">Could the index hand us a prime for free?</h2>

<p>The hope in the original email was a shortcut. If k(n) followed a rule, you could compute it for any n, take the k-th prime below n, reflect it through n, and get a prime above n without searching.</p>

<p>The graphs show a statistical regularity: the index is usually small, it is smaller when 3 divides n, and its spread follows the geometric curve. They show no rule that gives the exact value. Index 1 is the most common, but at a million it holds for only about one n in seven, and values above 100 appear. A rule that always returned the right k would be a formula that produces primes on demand. Mathematicians have searched for such formulas for centuries, and the coin-flip behavior above is what the heuristics predict instead.</p>

<p>A rule would also not save any work. To trust the reflected number you would still have to test it for primality, and that test is the expensive step of any prime search. Finding some prime above n is already easy. Bertrand’s postulate, proved by Chebyshev in 1852, guarantees a prime between n and 2n. In practice, testing n + 1, n + 2, … with a fast primality test reaches a prime after about ln n tries.</p>

<p>The picture of the integers as midpoints of primes still holds up. The circles around each n stay small, roughly the size of (ln n)<sup>2</sup>, and they shrink when n has small odd factors. Proving that the smallest circle always exists is Goldbach’s conjecture itself.</p>

<h2 id="further-reading">Further reading</h2>

<ol>
  <li>OEIS <a href="https://oeis.org/A047160">A047160</a>: for n ≥ 2, the smallest m ≥ 0 such that n − m and n + m are both primes. This is the radius r(n) with radius 0 allowed.</li>
  <li>OEIS <a href="https://oeis.org/A082467">A082467</a>: the least k &gt; 0 such that n − k and n + k are both primes. This is the radius used by default in this post.</li>
  <li>OEIS <a href="https://oeis.org/A020481">A020481</a>: the least prime p with p + q = 2n and q prime, the minimal Goldbach partition.</li>
  <li>OEIS <a href="https://oeis.org/A002375">A002375</a>, <a href="https://oeis.org/A045917">A045917</a> and <a href="https://oeis.org/A002372">A002372</a>: the number of ways to write 2n as a sum of two primes, counted in slightly different ways. Plotted, these give the Goldbach comet.</li>
  <li>T. Oliveira e Silva, S. Herzog and S. Pardi, “Empirical verification of the even Goldbach conjecture and computation of prime gaps up to 4·10<sup>18</sup>”, <em>Mathematics of Computation</em> 83 (2014), 2033–2060. The project page, with the table of the largest minimal partitions, is at <a href="https://sweet.ua.pt/tos/goldbach.html">sweet.ua.pt/tos/goldbach.html</a>.</li>
  <li>G. H. Hardy and J. E. Littlewood, “Some problems of ‘Partitio numerorum’; III: On the expression of a number as a sum of primes”, <em>Acta Mathematica</em> 44 (1923), 1–70. This is the source of the heuristic formula above.</li>
  <li>Wikipedia: <a href="https://en.wikipedia.org/wiki/Goldbach%27s_conjecture">Goldbach’s conjecture</a> and <a href="https://en.wikipedia.org/wiki/Bertrand%27s_postulate">Bertrand’s postulate</a>.</li>
</ol>

<p class="g-note"><em>All numbers in this post are computed live in your browser, with a sieve of Eratosthenes up to 2,000,000.</em></p>]]></content><author><name></name></author><category term="math" /><category term="primes" /><category term="goldbach" /><summary type="html"><![CDATA[Goldbach's conjecture, seen from the middle, with an interactive explorer]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://dimitris.karakasilis.me/images/every-number-is-a-middle.png" /><media:content medium="image" url="https://dimitris.karakasilis.me/images/every-number-is-a-middle.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Test Ride QJ SVT650X</title><link href="https://dimitris.karakasilis.me/2023/10/07/qj-svt650x-review.html" rel="alternate" type="text/html" title="Test Ride QJ SVT650X" /><published>2023-10-07T00:00:00+00:00</published><updated>2023-10-07T00:00:00+00:00</updated><id>https://dimitris.karakasilis.me/2023/10/07/qj-svt650x-review</id><content type="html" xml:base="https://dimitris.karakasilis.me/2023/10/07/qj-svt650x-review.html"><![CDATA[<p><img src="/images/svt650x-1.jpg" alt="svt650x" /></p>

<p>Έχοντας περάσει τα τελευταία 6+ χρόνια με ένα gsf1250 μοντέλο 2010, ήταν φυσικό να έχω αρχίσει να λοξοκοιτάζω
άλλα μηχανάκια, χωρίς πάντως να έχω αποφασίσει ακόμα, με ποια δικαιολογία θα αλλάξω μία μηχανή που δεν έχει παραπονεθεί
για τίποτε, σε όποια δοκιμασία και να την έχω υποβάλει.</p>

<p>Όπως και να χει, είχα ήδη διαμορφώσει την άποψη ότι μία μηχανή με λιγότερα κυβικά και κάποιες δυνατότες εκτός δρόμου, θα ταίριαζε
καλύτερα στις σημερινές ανάγκες μου, σε σχέση με όταν αγόρασα τον “ληστή”. Και να σου, να ξεπηδάνε μεσαία δικύλιδρα το ένα μετά το
άλλο με πολλά από αυτά να είναι από κινέζικους κατασκευαστές. Χαζεύεις λοιπόν τα βιντεάκια και βλέπεις από κάτω στα σχόλια:
“αντίο μεταπώληση”, “ότι πληρώνεις παίρνεις”, “δεν θα είναι αξιόπιστο” και άλλα τέτοια.</p>

<p>Επειδή είμαι άνθρωπας περίεργος όμως, και μου αρέσει να βγάζω τα δικά μου συμπεράσματα, δεν είχα αποκλείσει ακόμα τίποτα.
Περνάω λοιπόν από τον φίλο μου τον Βαγγέλη (Moto Parras - Πύργος Ηλείας) να τσεκάρω ένα από τα μηχανάκια που μου είχε τραβήξει την προσοχή, το QJ svt650x. Έχοντας μάλλον διαβάσει την σκέψη μου, και ξέροντας ίσως τις προκαταλήψεις απέναντι στους κινέζους κατασκευαστές, μου έκανε μία πρόταση που δεν μπορούσα να αρνηθώ. “Πάρ’την Παρασκευή και φέρτη μου την Δευτέρα” μου λέει. “Δεν θα την ζορίσω” του λέω. “Δεν με πειράζει, την έχω στρώσει, κάνε ότι θέλεις” μου λέει. Τι στο καλό… κανείς δεν λέει όχι σε κάτι τέτοιο!</p>

<p>Έτσι γρήγορα γρήγορα, η εκδρομή κανονίζεται. Σάββατο πρωί, παππούς, πατέρας και γιός (εγώ είμαι ο “πατέρας”), καβαλάμε μία BMW K1300R (του παππού) και το QJ και φεύγουμε από Πύργο για Καρκαλού για να δούμε αν μπορεί να μας συγκινήσει μία δικύλινδρη μοτοσυκλέτα 650 κυβικών καθώς θα καβαλάμε εναλλάξ, μία το QJ και μία το αεροπλάνο (aka K1300R).</p>

<p>Πρώτα καβαλάω εγώ το QJ. “Κουμπώνω” γρήγορα στο μηχανάκι αν και δεν είμαι συνηθισμένος στην όρθια θέση του on-off. Το πρώτο κομμάτι της διαδρομής είναι ανοιχτές ευθείες και δοκιμάζω να βρω με ποια ταχύτητα ταξιδεύει φυσικά αυτή η μηχανή. Ανοίγω γκάζι, κλείνω γκάζι, αποφασίζω ότι στα 130 μπορείς να ταξιδεύεις για πάντα και αν θελήσεις να προσπεράσεις
έχεις ακόμα αρκετό ζουμί. Μέχρι το τέλος τη μέρας είχα ανακαλύψει ότι ανοίγει μέχρι τα 180 χωρίς ιδιαίτερο κόπο, αλλά δεν δοκίμασα να επιμείνω παραπάνω, αφενός γιατί τελείωνε ο autobahn αφετέρου γιατί δεν ήμουν σίγουρος αν οι ευλογίες του Βαγγέλη περιλάμβαναν ξεζούμισμα μέχρι να πάρω κάποιο εξάρτημα στο χέρι.</p>

<p><strong>Συμπέρασμα πρώτο:</strong> δεν είναι μηχανή sport touring. Για όποιον αγαπάει τα ελληνικά όρια ταχύτητας είναι παραπάνω από αρκετή. Για όποιον δεν τα αγαπάει, μπορεί να του εξασφαλίσει όμορφες φωτογραφίες από την τροχαία. Όποιος όμως έχει συνηθίσει σε power wheelies και μηχανές που σου μακραίνουν τα χέρια, μάλλον δεν θα βρει εδώ την συγκίνηση.</p>

<p>Μετά την Ολυμπία οι ευθείες τελειώνουν και αρχίζει ο κλασικός φιδίσιος δρόμος των ελληνικών βουνών. Στρωμένος πότε πότε με ολοκαίνουργια άσφαλτο λες και είσαι σε πίστα και άλλες φορές με άσφαλτο από το 1940 και λακούβες που σου προκαλούν υψοφοβία. Και κάπου εδώ το svt μοίαζει να είναι στο “σπίτι του”. Το μπροστινό αρχικά μου δίνει την εντύπωση ότι χρειάζεται λιγότερη προφόρτιση αλλά γρήγορα το ξεχνάω. Η μηχανή στρίβει και συμπεριφέρεται υποδειγματικά. Τα φρένα είναι άγκυρες, το κιβώτιο και ο συμπλέκτης δίνουν την εντύπωση ότι είναι ψηφιακά. Προερχόμενος από το ροπάτο bandit, φοβόμουν ότι με το 650 θα πιαστεί το χέρι μου από τις αλλεπάλληλες αλλαγές ταχυτήτων για να το πείσω να ξεκολλήσει. Αλλά όχι, το μοτέρ είναι λάστιχο, και καθώς έχω πάρει το ελεύθερο από τον ιδιοκτήτη του, δοκιμάζω όλο το εύρος των στροφών.</p>

<p><strong>Συμπέρασμα δεύτερο:</strong> το μοτέρ είναι ζωηρό σε όλο το φάσμα των στροφών του και συγχωρεί ακόμα και αν μπεις με “λάθος” σχέση σε στροφή.</p>

<p>Φτάνουμε Καρκαλού και καθώς ο δρομείς είναι ανώμαλοι άνθρωποι και δεν χάνουν προπόνηση παρά μόνο αν πεθάνει συγγενής πρώτου βαθμού, παρατάω τον παππού και τον εγγονό στον φίλο Στέφανο (ιδιοκτήτης του <a href="https://thisoa.gr/">ξενοδοχείου Θεισόα</a>) και βγαίνω να κάνω 17χλμ στο απίστευτο ελατόδασος που είναι ανάμεσα στην Καρκαλού και την Ελάτη. Διαπιστώνω ότι η διαδρομή που είχα σχεδιάσει από το google maps να τρέξω, θα ήταν πολύ καλή για να δοκιμάσω τις off road δυνατότητες του QJ αλλά επειδή το BMW δεν έχει φτιάχτεί για να λασπώνεται (φάτηνε BMW!) τελικά την κάνω μόνο τρέχοντας. Αν πάντως κάποιος βρεθεί στην Καρκαλού, με ένα svt650χ και διάθεση να το δοκιμάσει στο χώμα, ορίστε το gpx: <a href="/files/karkalou.gpx">karkalou.gpx</a>.</p>

<p>Έχοντας τρέξει 17χλμ και έχοντας φάει μπόλικο χοιρινό με σέλινο (ευχαριστούμε Στέφανε!), είναι ώρα να αλλάξουμε μηχανές και να πάμε προς τα πίσω. Μόλις αλλάζουμε μηχανές και ανεβαίνει στο BMW, λέει ο Κωνσταντίνος (ο γιός μου): “Τι σελάρα είναι αυτή!”. Εντάξει, να πω εδώ ότι η σέλα του BMW είναι after market gel, γιατί και οι Γερμανοί φαντάζονται ανθρώπους με σιδερένιους κώλους αλλά όπως και να χει, η διαφορά για τον συνεπιβάτη είναι εμφανής.</p>

<p><strong>Συμπέρασμα τρίτο:</strong> η σέλα του συνεπιβάτη θα μπορούσε να είναι πιο αναπαυτική. Και η σέλα του οδηγού θα μπορούσε να είναι πιο αναπαυτική αλλά δεν ήταν κάτι που με πείραξε. Ίσως οι Γερμανοί και οι Κινέζοι να έχουν εμένα στο μυαλό τους όταν σχεδιάζουν τις σέλες τους.</p>

<p>Ο “παππούς” παραδίδει το F16 και ανεβαίνει στο δικύλινδρο 650. Την προηγούμενη μέρα, έχοντας οδηγήσει το μηχανάκι μόνο για 3 λεπτά σε μία ευθεία, έχει ήδη εκφράσει την επιθυμία να μείνει με το BMW μέχρι τα βαθειά γεράματα. Λίγες στροφές αργότερα, βλέποντας τις ακατανόητες χειρονομίες που μου κάνει από μπροστά αντιλαμβάνομαι ότι το 650 δημιουργεί συναισθήματα χαράς στην εθισμένη στην ιπποδύναμη καρδία του μπαρουτοκαπνισμένου μηχανόβιου. “Άι στο καλό” λέω και περιμένω μέχρι τα Λαγκάδια, όπου κάναμε στάση για σουφλέ σοκολάτας με παγωτό και καφέ, για να επιβεβαιώσω ότι οι υποψίες μου είναι αληθινές. Η μηχανή κάνει ότι της λες χωρίς ασάφειες και κουνήματα και το στροφιλίκι είναι ευχαρίστηση.</p>

<p><strong>Συμπέρασμα τέταρτο:</strong> υπάρχει χαρά και κάτω από τα 150 άλογα</p>

<p>Έχοντας διανύσει περίπου 200χλμ η μέρα φτάνει σιγά σιγά στο τέλος της και πλησιάζουμε στο σπίτι. Έχοντας πάρει την έγκριση του Κωνσταντίνου του μικρού (εγγονός) και του Κωνσταντίνου του μεγάλου (παππούς), ολοκληρώνω στο μυαλό μου το σχέδιο αντικατάστασης του bandit. Και μοιάζει κάπως έτσι:</p>

<p>Θα δώσω τα λεφτά που κανονικά αγοράζεις ένα scouter, θα μπορώ να κάνω ότι έκανα με το bandit και επι πλέον θα μπορώ να λασπώνομαι αν θέλω.</p>

<p>Αυτό θα πρέπει να αρκεί για να πάρει έγκριση αν και μάλλον θα πρέπει να πάω βόλτα και τα υπόλοιπα μέλη του συμβουλίου την Κυριακή. Σε κάθε περίπτωση, ευχαριστώ τον Βαγγέλη που μου εμπιστεύτηκε την μηχανή του, τον Στέφανο για το απίστευτο χοιρινό με σέλινο, τον Κωνσταντίνο που δεν διαμαρτυρήθηκε καθόλου στο δικάβαλο και τον πατέρα μου που δεν άνοιξε πυρ με το μαχητικό σε όλη την διάρκεια της διαδρομής.</p>

<p>Καλά χιλιόμετρα σε όλους και πάντα ασφαλείς επιστροφές σε αυτούς που αγαπάτε!</p>

<p><img src="/images/svt650x.jpg" alt="svt650x" /></p>]]></content><author><name></name></author><category term="moto" /><category term="gr" /><summary type="html"><![CDATA[Μικρή βόλτα, εντυπώσεις και συμπεράσματα]]></summary></entry><entry><title type="html">Self Hosted CI</title><link href="https://dimitris.karakasilis.me/2022/12/26/self-hosted-ci.html" rel="alternate" type="text/html" title="Self Hosted CI" /><published>2022-12-26T00:00:00+00:00</published><updated>2022-12-26T00:00:00+00:00</updated><id>https://dimitris.karakasilis.me/2022/12/26/self-hosted-ci</id><content type="html" xml:base="https://dimitris.karakasilis.me/2022/12/26/self-hosted-ci.html"><![CDATA[<h2 id="why">Why</h2>

<p>Don’t you enjoy how everything is for free these days? You host your code for free, you get <a href="https://github.com/features/actions">a free CI with computing resources for free</a>.
And you <a href="https://github.com/features/codespaces">don’t even need an IDE or a workstation</a>. Everybody loves free things. But as someone said, “if you don’t pay for the product, you are the product”. Is that really true in every case? I don’t know. What I do know though, is that it happened in the past, that we became <a href="https://www.theregister.com/2021/08/31/docker_desktop_no_longer_free/">too used to free services and then one day everything changed</a> and we had to look for alternatives. And alternatives we found, that’s true. But we have to learn our lesson. We need to be prepared or even better, not fall in, what I call, the “convenience trap” at all.</p>

<h2 id="what">What</h2>

<p>Drop convenience you said Dimitris? What do you suggest? That we start hosting everything ourselves?</p>

<p>No my dear friend, that’s not what I’m suggesting. Thankfully, there are <a href="https://docs.codeberg.org/getting-started/what-is-codeberg/#what-is-codeberg-e.v.%3F">less suspicious free services</a> that we can use as long as we are ready to make some changes.</p>

<p>What I found is that for some of the most popular services that people use nowadays, there is a free/opensource/non-profit alternative that could be used. But sometimes, it misses some features, or it’s simply different from what people are used to. Some examples:</p>

<ul>
  <li><a href="https://twitter.com/">Twitter</a> -&gt; <a href="https://mastodon.social">Mastodon</a></li>
  <li><a href="https://github.com/">GitHub</a> -&gt; <a href="https://codeberg.org/">Codeberg</a> / <a href="https://gitea.io/">Gitea</a></li>
  <li>Windows -&gt; Linux</li>
</ul>

<p>and the list goes on…</p>

<p>This post is about the solution I found for one of the missing features while trying to switch from <a href="https://github.com/">Github</a> to <a href="https://codeberg.org/">Codeberg</a>. And that feature is CI (GitHub offers Github Actions for free [1]).</p>

<h2 id="how">How</h2>

<p>CI is a very special kind of a service. It:</p>

<ul>
  <li>is needed in almost every project (you do write tests, right?)</li>
  <li>sometimes needs lots of resources</li>
  <li>has to be publicly available (to see test results)</li>
  <li>has to integrate with the Code hosting service (Github, Codeberg etc)</li>
</ul>

<p>yet it:</p>

<ul>
  <li>is idling for a large portion of the time</li>
  <li>doesn’t need to store information for too long (old build logs quickly become irrelevant)</li>
  <li>has configuration usually stored next to the code, at least the important parts (e.g. pipelines)</li>
</ul>

<p>So let’s say you have 10 or 100 projects, which all have tests and have CI needs. But you don’t work on all of them all the time. Even if you were willing to go into the trouble of setting up your own CI server, would you keep it running all the time just for those weekends when you find time to work on that Arduino powered lunar rover you are working on?
Cloud resources are expensive. Local resources on the other hand are not.</p>

<p>Here is my suggestion. What if you could host the CI on your own machine, yet make it available online whenever it’s needed with minimum cost?
I created a repository that will help you do exactly that:</p>

<p><a href="https://codeberg.org/dkarakasilis/self-hosted-ci">https://codeberg.org/dkarakasilis/self-hosted-ci</a></p>

<p>In a nutshell, this is how it works:</p>

<ul>
  <li>You get yourself the smallest public machine possible. I chose the smallest Digital Ocean droplet for 4 dollars per month but you can choose something else, as long as it has a public IP address and you have SSH access to it.</li>
  <li>You point your desired domain to that machine. In other words you create an A record on your nameserver, pointing your domain to the IP address of the above machine.</li>
  <li>You start a Kubernetes cluster anywhere you like. I just run <code class="language-plaintext highlighter-rouge">k3d cluster create myci</code> but there is a really large number of options [2].</li>
  <li>You deploy cert-manager using helm (this is needed in order to have a properly signed letsencrypt certificate for the CI server).</li>
  <li>You use my helm chart to deploy <a href="https://woodpecker-ci.org/">Woodpecker CI</a> and the nginx-ssh-proxy component.</li>
</ul>

<p>Done!</p>

<p>Probably the part that may not be completely clear is the <code class="language-plaintext highlighter-rouge">nginx-ssh-proxy</code>. This is just a Kubernetes Deployment that does 2 things:</p>

<ul>
  <li>creates an SSH tunnel to the public machine to forward ports 80 and 443 to the Pod’s local ports 80 and 443</li>
  <li>runs an nginx reverse proxy that forwards the ports 80 and 443 to the same ports of the Traefik Ingress controller, running on the cluster</li>
</ul>

<p>In other words, any request reaching ports 80/443 of the public machine, will eventually hit the traefik ingress controller, thus all ingresses on the cluster will work as if we had made the cluster publicly available.</p>

<p>The benefits:</p>

<ul>
  <li>We don’t need to have the whole cluster hosted on the cloud (less costly)</li>
  <li>We didn’t have to forward any ports or change any local network configuration</li>
  <li>The cluster could be replaced with another one with zero changes in configuration</li>
</ul>

<p>The drawbacks:</p>

<ul>
  <li>There can be a combination of security holes that may allow someone to escape the HTTP protocol, into the Pod, from there into the Node and from there to the host machine and possibly attack other machines on your local network. While this is possible, it depends on your setup and it takes more than one security hole in more than one projects to allow someone to do that. Check my suggestion on the project README about using <a href="https://kairos.io">Kairos</a> as a better and more secure alternative to k3d.</li>
  <li>Your CI will only be available for as long as you keep the cluster up and running. When your CI is gone, Codeberg won’t be able to reach it and obviously won’t be able to start any jobs on it.</li>
  <li>You need to take care of CI configuration yourself (e.g. what values to pass through the helm chart when deploying). But that’s why I called the alternative “the convenience trap”.</li>
</ul>

<h2 id="conclusion">Conclusion</h2>

<p>I hope this post shows that it’s possible and even maybe easy to bypass some of the problems you face when you decide to free yourself from vendor lock-in.
If not, then I’d like to hear your thoughts so don’t hesitate to reach out. If you have suggestions on how to improve this solution feel free to open an issue or a Pull Request!</p>

<p>Have fun!</p>

<p>[1] <a href="https://codeberg.org/Codeberg-CI">The codeberg team has a hosted service in the works</a>. But this article is about avoiding vendor lock-in. In that sense, it will still apply when that service is open to everyone.</p>

<p>[2] For now, the helm chart assumes this cluster is running the <a href="https://doc.traefik.io/traefik/providers/kubernetes-ingress/">traefik ingress controller</a> but this may become configurable on the helm chart in the future.</p>]]></content><author><name></name></author><category term="kubernetes" /><category term="woodpecker" /><category term="drone" /><category term="CI" /><category term="codeberg" /><category term="gitea" /><summary type="html"><![CDATA[Because avoiding vendor lock-in doesn't have to be hard.]]></summary></entry><entry><title type="html">Introducing fuzzygui</title><link href="https://dimitris.karakasilis.me/2020/10/26/fuzzygui.html" rel="alternate" type="text/html" title="Introducing fuzzygui" /><published>2020-10-26T00:00:00+00:00</published><updated>2020-10-26T00:00:00+00:00</updated><id>https://dimitris.karakasilis.me/2020/10/26/fuzzygui</id><content type="html" xml:base="https://dimitris.karakasilis.me/2020/10/26/fuzzygui.html"><![CDATA[<p>Recently I started using the awesome <a href="https://github.com/junegunn/fzf">fzf</a> tool both from <a href="https://github.com/junegunn/fzf.vim">withing vim</a> but also for other use cases (e.g. in combination with <a href="https://www.passwordstore.org/">pass</a>). If you haven’t used fuzzy search before, please try that. It will change the way you work for ever.</p>

<p>One simple example on how to use it with pass is the following function (just put it in your <code class="language-plaintext highlighter-rouge">.bashrc</code>):</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Fuzzy finder for pass manager (regex removes extensions ;) )</span>
<span class="k">function </span>fuzzypass <span class="o">{</span>
  <span class="nb">pushd</span> ~/.password-store
  find <span class="k">*</span> | fzf | <span class="nb">sed</span> <span class="s1">'s/\(.*\)\..*/\1/'</span> | xargs pass
  <span class="nb">popd</span>
<span class="o">}</span>
</code></pre></div></div>

<p>While I’m waiting for my <a href="https://www.pine64.org/pinephone/">pinephone</a> to arrive I started re-programming my mind for a phone without all the Android apps I’m used to (e.g. lastpass). A tool like fzf could be used for a number of solutions (see the project’s README for a couple of examples) but I would rather not start a terminal emulator every time I need to search for something. Although I don’t have a pine phone to give it a try yet, I went on and created a gui drop-in replacement for fzf anyway.</p>

<p>I initially considered extending fzf and opening a PR to add an optional gui to it but looking at the code, that proved to be harder than using a library that provides fuzzy search functionality to implement the tool from scratch. So I did exactly that. Thankfully <a href="https://github.com/sahilm/fuzzy">sahilm/fuzzy</a> provides a nice interface and did the job prefectly. The only thing I needed to do was to wire it with a gtk gui.</p>

<p><a href="https://github.com/jimmykarily/fuzzygui/releases/tag/0.3">Version 0.3 is out</a>, so give it a try and let me know what you think. I’m considering adding some command line options to control the size of the window and the number of listed results in the future releases so stay tuned!</p>

<h2 id="links">Links</h2>

<ul>
  <li><a href="https://github.com/jimmykarily/fuzzygui">fuzzygui</a></li>
  <li><a href="https://github.com/junegunn/fzf">fzf</a></li>
  <li><a href="https://www.passwordstore.org/">pass</a></li>
  <li><a href="https://github.com/sahilm/fuzzy">sahilm/fuzzy</a></li>
  <li><a href="https://www.pine64.org/pinephone/">pinephone</a></li>
</ul>]]></content><author><name></name></author><category term="fzf" /><category term="fuzzy" /><category term="search" /><summary type="html"><![CDATA[You know, for fuzzy search]]></summary></entry><entry><title type="html">Kubernetes VS PaaS</title><link href="https://dimitris.karakasilis.me/2019/07/15/k8s-vs-paas.html" rel="alternate" type="text/html" title="Kubernetes VS PaaS" /><published>2019-07-15T00:00:00+00:00</published><updated>2019-07-15T00:00:00+00:00</updated><id>https://dimitris.karakasilis.me/2019/07/15/k8s-vs-paas</id><content type="html" xml:base="https://dimitris.karakasilis.me/2019/07/15/k8s-vs-paas.html"><![CDATA[<p><img src="/images/raw_vegetables.jpg" alt="Raw Vegetables" /></p>

<p>If you asked me 3 years ago, I would probably define the professional part of myself as a “Rails developer”. Back then, most of my new projects started with a proof of concept deployed on a free Heroku account. The reason is simple, that was the fastest way to get my Ruby application live. At the same time it was the cheapest (free right?) so that was a no-brainer.</p>

<p>The last 2.5 years, my work has been mostly on CloudFoundry and Kubernetes. CloudFoundry is an Open Source PaaS solution and Kubernetes is a Container orchestration platform. I work on a project that combines these two (<a href="https://github.com/suse/scf">SUSE CloudFoundry</a> runs CloudFoundry on top of Kubernetes). There is an argument I’ve heard more than once regarding running a PaaS on top of Kubernetes and that is: “Why deploy CloudFoundry on top of Kubernetes and not use Kubernetes directly?”. Maybe it’s my science studies, maybe it’s Myth Busters, but I had to test this theory. Thankfully, 2 times a year we get a week to hack on anything we want at SUSE (<a href="https://hackweek.suse.com/">Check it out</a>) so I got the time I needed a couple of weeks ago.</p>

<h2 id="scope-of-the-experiment">Scope of the experiment</h2>

<p>You can only do so much in a week so I had to limit the scope of this experiment. The question to be answered was simply “As an application developer, is it realistic to skip PaaS and live with just Kubernetes?”.</p>

<p>To be fair, the initial effort to set things up shouldn’t affect the final verdict very much because that depends on your starting point, prior knowledge and other factors. What is more interesting is how the everyday life of a developer that uses Kubernetes compares to that of a developer that uses a Platform like CloudFoundry or Heroku. And I mean production stuff (TLS, DNS, Backups, HA etc). But given most of the time was spent on the initial setup, I can’t guarantee fair judgment.</p>

<h2 id="the-experiment">The experiment</h2>

<p>A week was not enough to setup everything I needed for a production deployment with Kubernetes but that might also be because I also spent some time setting up my development environment with a local cluster (more on that later). But here is what I tried.</p>

<h3 id="ci">CI</h3>

<p>This is the first thing I had to setup. With CloudFoundry (I will use CloudFoundry as the representative of PaaS for this experiment), all you need is your code and the <code class="language-plaintext highlighter-rouge">cf</code> cli. The moment you push your code with <code class="language-plaintext highlighter-rouge">cf push</code>, the platform finds the dependencies your application needs, the language you use and builds a container image for your application. It then runs it using it’s own container orchestrator (which <a href="https://www.cloudfoundry.org/project-eirini/">can be Kubernetes</a> by the way).</p>

<p>In the raw Kubernetes world, all you have is the orchestrator. You need something to build your application image. There are some options that promise an experience similar to that of PaaS but none of them worked smoothly for me. Here they are:</p>

<ul>
  <li>
    <p>Cloud Native buildpacks (<a href="https://buildpacks.io/">https://buildpacks.io/</a>)</p>

    <p>Although this project is very promising and at some point these buildpacks will also be used in CloudFoundry itself, there is no Ruby buildpack yet and the application I chose to work on was in Ruby. Also, I would need a CI to run the <code class="language-plaintext highlighter-rouge">pack</code> tool anyway.</p>
  </li>
  <li>
    <p>Knative build component (<a href="https://github.com/knative/build">https://github.com/knative/build</a>)</p>

    <p>I followed the guides and installed Knative on my cluster. I tried to use the <a href="https://github.com/knative/build-templates/tree/master/kaniko">kaniko build template</a> as <a href="https://knative.dev/docs/build/build-templates/#example-template">suggested in the docs</a> but after spending a day I couldn’t get an image to build. Also, the knative build README on GitHub currently shows a NOTE about a deprecation proposal so there is a possibility that this process will change in the future. For these reasons I decided to skip this option as well.</p>

    <p>In the end, I decided to build a <a href="https://github.com/jimmykarily/kubaas/tree/master/examples/concourse_pipeline">simple pipeline in Concourse</a> that builds the application image when I commit to the master branch. Every project needs a CI system anyway so having a pipeline for the image was a small price to pay.</p>
  </li>
</ul>

<h3 id="database">Database</h3>

<p>When using a PaaS, your operator has setup a marketplace of services that you can bind to your app. You might get something similar from your cloud provider that you can use in your Kubernetes cluster. I opted for a Postgres database deployed in the same cluster as my application. I set this up <a href="https://github.com/jimmykarily/kubaas/blob/master/examples/app-helm/requirements.yaml#L2">as a requirement of my helm chart</a>. This ofcourse means I will have to take care of replication, backups and everything. Given the limited time for this experiment I can only guess how much complexity this adds but since there are other options (managed cloud database) this shouldn’t count against the final score for raw Kubernetes.</p>

<h3 id="tls">TLS</h3>

<p>Production ready means the web application should be served over HTTPS with a valid certificate signed by a known authority. Setting this up in Kubernetes should be very simple with the use of <a href="https://docs.cert-manager.io/en/latest/">cert-manager</a>. It will take care of creating certificates for you signed by <a href="https://docs.cert-manager.io/en/latest/tasks/issuers/index.html#supported-issuer-types">various issuers</a> (letsencrypt included). If you use ingress it can even <a href="https://docs.cert-manager.io/en/latest/tasks/issuing-certificates/ingress-shim.html">do that automatically</a> for your ingress resources using annotations.</p>

<p>Theory once again proved to be quite different from reality. My “production” cluster of choice was <a href="https://cloud.google.com/kubernetes-engine/">GKE</a>. It took me a while to find out <a href="https://github.com/jetstack/cert-manager/issues/1666">the reason</a> I couldn’t get automated creation of certificates for my nginx ingress resources. I’m sure there are workarounds but setting this up surely took more time than I expected. Depending on the PaaS of your choice your mileage might vary there too so it’s hard to compare.</p>

<h3 id="things-skipped">Things skipped</h3>

<p>A production setup could, and probably should, take care of more than the above requirements. Some examples:</p>

<ul>
  <li>Zero downtime deployments (blue - green deployments maybe?)</li>
  <li>Load balancing and HA</li>
  <li>Database and application deployment rollbacks</li>
  <li>Automatic scaling up and down</li>
  <li>Monitoring and notifications when weird things happen</li>
  <li>other</li>
</ul>

<h2 id="bonus-material---development-environment">Bonus material - Development environment</h2>

<p>If you are deploying on Kubernetes, why not use Kubernetes for development too? There are many options when it comes to local clusters (<a href="https://kubernetes.io/docs/setup/learning-environment/minikube/">minikube</a>, <a href="https://microk8s.io/">microk8s</a>, <a href="https://github.com/kubernetes-sigs/kind">kind</a> and others). I encourage you to give them a try but my choice for this experiment was <code class="language-plaintext highlighter-rouge">kind</code> because it doesn’t have many dependencies and doesn’t run in a virtual machine (it’s docker in docker). You can find a <code class="language-plaintext highlighter-rouge">Make</code> target <a href="https://github.com/jimmykarily/kubaas/blob/master/Makefile#L4">in my repo</a> that will spin up a local cluster for you in a temporary directory. I also added <a href="https://github.com/jimmykarily/kubaas/tree/master/examples/concourse_pipeline">an example Concourse pipeline</a> and an example application <a href="https://github.com/jimmykarily/kubaas/tree/master/examples/app-helm">helm chart</a> that you can use as a guide for your apps. The pipeline will build an image for your application but you will need to create a Dockerfile for it. If you are planning to deploy a Ruby on Rails application you can have a look at <a href="https://github.com/jimmykarily/kubaas/blob/master/examples/RoR_Dockerfile">my example Dockerfile</a> for inspiration.</p>

<p>For my experiment I even run Concourse on my local cluster using the <a href="https://github.com/helm/charts/tree/master/stable/concourse">provided helm chart</a>. Check the <a href="https://github.com/jimmykarily/kubaas#automation---ci">README</a> for more information.</p>

<h2 id="the-verdict">The verdict</h2>

<p>The perfect production setup doesn’t exist except in the tales we tell over beers. All we can hope for is something good enough for the use case at hand. That said, making your production environment more stable, bullet proof and all the good things is an art and a never ending process. The question was “Can a developer skip PaaS and consume raw Kubernetes?” and I tried to gather enough data to support an answer to that question.</p>

<p>With many things still unclear my verdict is that, yes you <em>can</em> use Kubernetes directly and there are good reasons to do so. Namely:</p>

<ul>
  <li>No additional layers - less things to debug (only applies when your PaaS is not running on bare metal).</li>
  <li>Multiple public offerings to choose from. No vendor lock-in. Moving to a different Kubernetes provider is easier than moving to a different PaaS.</li>
  <li>Expect it to become cheaper as more vendors enter the market.</li>
  <li>More flexible (you can tweak everything in the infrastructure if you so desire).</li>
  <li>Big community. Expect tools and solutions to appear that will make your life easier as a developer in the future.</li>
</ul>

<p>So, you <em>can</em> use Kubernetes as a developer but you probably shouldn’t because:</p>

<ul>
  <li>Kubernetes was not designed with developers as the target audience. There seems to be <a href="https://github.com/google/kf">a shift of focus</a> but it’s still too early to say that Kubernetes UX is on par with PaaS.</li>
  <li>You need to know a lot about Kubernetes before you get an app running for production.</li>
  <li>Needs additional tools to have a proper pipeline to deploy apps (e.g. CI, KNative etc)</li>
  <li>Every workflow needs to be implemented by the developer. Other platforms are more opinionated and have that sorted out for you (E.g. deploy to staging, rollback deployments with/without migrations, etc)</li>
</ul>

<p>If you were hoping for a yes or no answer you might be disappointed but this post only meant to be an opinion, not a global truth. I hope you find this useful and that you give it a try too. My plan is to continue on this experiment and I might come up with more information through a new post.</p>

<p>Until then, stay happy and keep hacking.</p>

<p><em>Thanks to Ettore Di Giacinto and Ilias Spyropoulos for their comments and review of this post</em></p>

<h2 id="links">Links</h2>

<ul>
  <li><a href="https://github.com/jimmykarily/kubaas">The repo of the experiment</a></li>
  <li><a href="https://www.suse.com/c/the-holy-grail-of-paas-on-kubernetes/">Recommended blog post from Troy Topnik on the same subject</a></li>
</ul>]]></content><author><name></name></author><category term="Kubernetes" /><category term="PaaS" /><summary type="html"><![CDATA[Can a developer skip PaaS and consume raw Kubernetes?]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://dimitris.karakasilis.me/images/raw_vegetables.jpg" /><media:content medium="image" url="https://dimitris.karakasilis.me/images/raw_vegetables.jpg" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">First steps in 3D printing</title><link href="https://dimitris.karakasilis.me/2019/04/23/first-steps-with-3d-printing.html" rel="alternate" type="text/html" title="First steps in 3D printing" /><published>2019-04-23T00:00:00+00:00</published><updated>2019-04-23T00:00:00+00:00</updated><id>https://dimitris.karakasilis.me/2019/04/23/first-steps-with-3d-printing</id><content type="html" xml:base="https://dimitris.karakasilis.me/2019/04/23/first-steps-with-3d-printing.html"><![CDATA[<p><img src="/images/drumkit.jpg" alt="DruKit" /></p>

<p>About a year ago, as part of <a href="https://hackweek.suse.com/">SUSE’s HackWeek</a> I started building my own electronic drum kit. So ambitious was I, that I wanted to create every single part of it, the module included. For those of you who don’t know what the drum module is, it’s the thing that converts your actions (hits on the drum triggers) to MIDI events and eventually to sound.</p>

<p>I hate to admit that after reading and learning about peak detectors and multiplexers and a lot of other interesting stuff, I ended up buying a used drum module from Alesis for 100 euros after a year cause the project was stalled.</p>

<p>The good news is that I bought my first 3D printer in order to print the connectors for the drum kit mount and other things. Being a developer I found a lot of joy creating my things in <a href="https://www.openscad.org/">OpenSCAD</a>. At last, my code can create objects in the real world!</p>

<p>I created a GitHub project to host all my things and I made it public for everybody to benefit. I will keep adding information and READMEs to make it more complete but most of my <code class="language-plaintext highlighter-rouge">scad</code> files are parametric so you can tweak them to your needs. Let me know if you find any of these interesting or need help. Enjoy:</p>

<p><a href="https://github.com/jimmykarily/3dprints">https://github.com/jimmykarily/3dprints</a></p>]]></content><author><name></name></author><category term="3D printing" /><category term="Open Source" /><summary type="html"><![CDATA[Introducing my open source 3D objects]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://dimitris.karakasilis.me/images/drumkit.jpg" /><media:content medium="image" url="https://dimitris.karakasilis.me/images/drumkit.jpg" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">SUSE Cloud Application Platform on MicroK8s</title><link href="https://dimitris.karakasilis.me/2019/01/27/scf-on-microk8s.html" rel="alternate" type="text/html" title="SUSE Cloud Application Platform on MicroK8s" /><published>2019-01-27T00:00:00+00:00</published><updated>2019-01-27T00:00:00+00:00</updated><id>https://dimitris.karakasilis.me/2019/01/27/scf-on-microk8s</id><content type="html" xml:base="https://dimitris.karakasilis.me/2019/01/27/scf-on-microk8s.html"><![CDATA[<p>Unless you’ve been living under a rock, you probably know what <a href="https://kubernetes.io/">kubernetes</a> is. If you have been living under a rock (which is nothing to be ashamed of), kubernetes is a production-grade container orchestrator or in simple words a way to use containers in production to deploy applications and services.</p>

<p>There are a number of ways to try kubernetes locally (check <a href="https://kubernetes.io/docs/setup/pick-right-solution/#local-machine-solutions">this link</a>). A couple of weeks ago I decided to give <a href="https://microk8s.io/">MicroK8s</a> a try. The idea of MicroK8s was very appealing to me because they use your machine’s resources without you having to decide on a VM size beforehand. There is a nice comparison of MicroK8s and Minikube by Thomas Pliakas if you are interested: <a href="https://codefresh.io/kubernetes-tutorial/local-kubernetes-linux-minikube-vs-microk8s/">link</a>.</p>

<p>My goal was to run two of the main components of <a href="https://www.suse.com/products/cloud-application-platform/">SUSE Cloud Application Platform</a>  (<a href="https://github.com/suse/scf">scf</a> and UAA) on top of MicroK8s and see if I could use it for local development or quick demos. Everything worked fine in the end and below you can find the steps I followed to achieve that.</p>

<h2 id="set-up-microk8s">Set up MicroK8s</h2>

<p>MicroK8s run on <a href="https://snapcraft.io/">Snap</a>. To install Snap on openSUSE Tumbleweed I followed the instructions here: <a href="https://forum.snapcraft.io/t/installing-snap-on-opensuse/8375">https://forum.snapcraft.io/t/installing-snap-on-opensuse/8375</a></p>

<ul>
  <li>Start snapd:</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">sudo </span>systemctl start snapd
<span class="nv">$ </span><span class="c"># Consider enabling the snapd service to automatically start it after reboots</span>
<span class="nv">$ </span><span class="c"># sudo systemctl enable snapd</span>
</code></pre></div></div>

<ul>
  <li>Add snap bin directory to your path (add this to your bashrc or similar):</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">export </span><span class="nv">PATH</span><span class="o">=</span><span class="nv">$PATH</span>:/snap/bin
</code></pre></div></div>

<ul>
  <li>Install MicroK8s:</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>snap <span class="nb">install </span>microk8s <span class="nt">--classic</span>
</code></pre></div></div>

<ul>
  <li>Start MicroK8s:</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>microk8s.start
</code></pre></div></div>

<ul>
  <li>Enable kube dns and the default storage class:</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>microk8s.enable dns storage
</code></pre></div></div>

<ul>
  <li>Point kubectl to your cluster:</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>microk8s.config <span class="o">&gt;</span> microk8s_kubeconfig
<span class="nv">$ </span><span class="nb">export </span><span class="nv">KUBECONFIG</span><span class="o">=</span><span class="nv">$PWD</span>/microk8s_kubeconfig
</code></pre></div></div>

<ul>
  <li>Check that dns and storage work:</li>
</ul>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>watch kubectl get pods <span class="nt">-n</span> kube-system
</code></pre></div></div>

<p>Wait until both pods become ready (<code class="language-plaintext highlighter-rouge">hostpath-provisioner-*</code> and <code class="language-plaintext highlighter-rouge">kube-dns-*</code>). In my case I had to open my firewall and also permit the communication between the pods using the fix mentioned <a href="https://microk8s.io/docs/#my-pods-cant-reach-the-internet-but-my-microk8s-host-machine-can">here</a>:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">sudo </span>iptables <span class="nt">-P</span> FORWARD ACCEPT
</code></pre></div></div>

<h2 id="prepare-for-scf">Prepare for <a href="https://github.com/suse/scf">scf</a></h2>

<p>Before we deploy scf on our fresh cluster there are a couple of changes we need to make in the configuration of docker and kubelet in MicroK8s.</p>

<h3 id="fix-ulimit-in-containers">Fix ulimit in containers</h3>

<p>There is a script that calls <code class="language-plaintext highlighter-rouge">ulimit</code> inside a container and it will fail with the following error unless we change docker’s settings:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>[2019-01-07 12:08:27+0000] /var/vcap/jobs/uaa/bin/uaa_ctl: line 47:
ulimit: open files: cannot modify limit: Operation not permitted
</code></pre></div></div>

<p>Open the file <code class="language-plaintext highlighter-rouge">/var/snap/microk8s/current/args/docker-daemon.json</code> and set the content to this:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>{
  "insecure-registries" : ["localhost:32000"],
  "default-ulimits": {
    "nofile": {
      "Name": "nofile",
      "Hard": 65536,
      "Soft": 65536
     }
  }
}
</code></pre></div></div>

<p>Apply the change with:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">sudo </span>systemctl restart snap.microk8s.daemon-docker.service
</code></pre></div></div>

<p>If you are interested to know more, here are some links:</p>

<ul>
  <li><a href="https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-configuration-file">docker docs</a></li>
  <li><a href="https://stackoverflow.com/questions/24318543/how-to-set-ulimit-file-descriptor-on-docker-container-the-image-tag-is-phusion">stack overflow</a></li>
  <li><a href="https://github.com/cloudfoundry/uaa-release/blob/master/jobs/uaa/templates/bin/uaa_ctl.erb#L46">the offending code</a></li>
</ul>

<h3 id="dont-inherit-dns">Don’t inherit DNS</h3>

<p>In my system’s <code class="language-plaintext highlighter-rouge">/etc/resolv.conf</code> I had this line:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>search suse.de
</code></pre></div></div>

<p>This (by default) was inherited inside the pods resolv.conf file (See here why: <a href="https://kubernetes.io/docs/tasks/administer-cluster/dns-custom-nameservers/#introduction">kubernetes</a>, <a href="https://github.com/ubuntu/microk8s/blob/master/microk8s-resources/actions/dns.yaml#L209">MicroK8s</a>)</p>

<p>This resulted in router-0 pod to fail to become ready (it was adding suse.de in the routing-api-0 hostname).
To avoid this (or other similar) problem, open <code class="language-plaintext highlighter-rouge">/var/snap/microk8s/current/args/kubelet</code> and add this line in the existing options:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>--resolv-conf=""
</code></pre></div></div>

<p>Apply the change with:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">sudo </span>systemctl restart snap.microk8s.daemon-kubelet.service
</code></pre></div></div>

<h3 id="allow-privileged-containers">Allow privileged containers</h3>

<p>Some of the pods will try to run containers in privileged mode and you need to allow this on your cluster.</p>

<p>Add <code class="language-plaintext highlighter-rouge">--allow-privileged=true</code> in <code class="language-plaintext highlighter-rouge">/var/snap/microk8s/current/args/kubelet</code> and <code class="language-plaintext highlighter-rouge">/var/snap/microk8s/current/args/kube-apiserver</code> and restart microk8s (<code class="language-plaintext highlighter-rouge">microk8s.stop</code> and <code class="language-plaintext highlighter-rouge">microk8s.start</code>)</p>

<h3 id="enable-swap-accounting">Enable swap accounting</h3>

<p>One more thing you need to ensure is that you have swapaccount enabled on your host system (since this is the kernel that is being used by all the containers). All you need to do is to add <code class="language-plaintext highlighter-rouge">swapaccount=1</code> in your kernel options. Here is how I did that but you should use whatever works for your system:</p>

<ul>
  <li>Edit <code class="language-plaintext highlighter-rouge">/etc/default/grub</code> and add <code class="language-plaintext highlighter-rouge">swapaccount=1</code> in the <code class="language-plaintext highlighter-rouge">GRUB_CMDLINE_LINUX_DEFAULT</code> (or <code class="language-plaintext highlighter-rouge">GRUB_CMDLINE_LINUX</code>)</li>
  <li>Update grub: <code class="language-plaintext highlighter-rouge">sudo grub2-mkconfig -o /boot/grub2/grub.cfg</code></li>
  <li>Reboot your system to apply the change</li>
</ul>

<h2 id="deploy-scf">Deploy scf</h2>

<p>We will deploy the openSUSE based version of CloudFoundry (Cloud Application Platform comes with SLE stemcell and stack). Grab the latest release from here: https://github.com/SUSE/scf/releases. In my case it was <a href="https://github.com/SUSE/scf/releases/download/2.14.5/scf-opensuse-2.14.5+cf2.7.0.0.g6360c016.zip">the 2.14.5 zip file</a>.</p>

<p>Extract the zip file to your desired location:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">mkdir </span>tmp
<span class="nv">$ </span><span class="nb">cd </span>tmp
<span class="nv">$ </span>wget https://github.com/SUSE/scf/releases/download/2.14.5/scf-opensuse-2.14.5+cf2.7.0.0.g6360c016.zip
<span class="nv">$ </span>unzip scf-opensuse-2.14.5+cf2.7.0.0.g6360c016.zip
</code></pre></div></div>

<p>Install tiller:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>helm init <span class="nt">--upgrade</span>
<span class="nv">$ </span>watch helm version
</code></pre></div></div>
<p>(wait until the tiller version appears)</p>

<p>Create the scf-config-value.yaml (replace <code class="language-plaintext highlighter-rouge">192.168.1.152</code> everywhere in the file
with the one returned by <code class="language-plaintext highlighter-rouge">microk8s.config | grep server</code>):</p>

<div class="language-yaml highlighter-rouge"><div class="highlight"><pre class="highlight"><code>
<span class="na">env</span><span class="pi">:</span>
  <span class="na">DOMAIN</span><span class="pi">:</span> <span class="s">192.168.1.152.nip.io</span>


  <span class="c1"># UAA host and port</span>
  <span class="na">UAA_HOST</span><span class="pi">:</span> <span class="s">uaa.192.168.1.152.nip.io</span>
  <span class="na">UAA_PORT</span><span class="pi">:</span> <span class="m">2793</span>

<span class="na">sizing</span><span class="pi">:</span>
  <span class="na">cc_uploader</span><span class="pi">:</span>
    <span class="na">capabilities</span><span class="pi">:</span> <span class="pi">[</span><span class="s2">"</span><span class="s">SYS_RESOURCE"</span><span class="pi">]</span>
  <span class="na">diego_api</span><span class="pi">:</span>
    <span class="na">capabilities</span><span class="pi">:</span> <span class="pi">[</span><span class="s2">"</span><span class="s">SYS_RESOURCE"</span><span class="pi">]</span>
  <span class="na">diego_brain</span><span class="pi">:</span>
    <span class="na">capabilities</span><span class="pi">:</span> <span class="pi">[</span><span class="s2">"</span><span class="s">SYS_RESOURCE"</span><span class="pi">]</span>
  <span class="na">diego_ssh</span><span class="pi">:</span>
    <span class="na">capabilities</span><span class="pi">:</span> <span class="pi">[</span><span class="s2">"</span><span class="s">SYS_RESOURCE"</span><span class="pi">]</span>
  <span class="na">nats</span><span class="pi">:</span>
    <span class="na">capabilities</span><span class="pi">:</span> <span class="pi">[</span><span class="s2">"</span><span class="s">SYS_RESOURCE"</span><span class="pi">]</span>
  <span class="na">router</span><span class="pi">:</span>
    <span class="na">capabilities</span><span class="pi">:</span> <span class="pi">[</span><span class="s2">"</span><span class="s">SYS_RESOURCE"</span><span class="pi">]</span>
  <span class="na">routing_api</span><span class="pi">:</span>
    <span class="na">capabilities</span><span class="pi">:</span> <span class="pi">[</span><span class="s2">"</span><span class="s">SYS_RESOURCE"</span><span class="pi">]</span>

<span class="na">kube</span><span class="pi">:</span>
  <span class="c1"># The IP address assigned to the kube node pointed to by the domain.</span>
  <span class="na">external_ips</span><span class="pi">:</span> <span class="pi">[</span><span class="s2">"</span><span class="s">192.168.1.152"</span><span class="pi">]</span>

  <span class="c1"># Run kubectl get storageclasses</span>
  <span class="c1"># to view your available storage classes</span>
  <span class="na">storage_class</span><span class="pi">:</span>
    <span class="na">persistent</span><span class="pi">:</span> <span class="s2">"</span><span class="s">microk8s-hostpath"</span>
    <span class="na">shared</span><span class="pi">:</span> <span class="s2">"</span><span class="s">shared"</span>

  <span class="na">auth</span><span class="pi">:</span> <span class="s">none</span>

<span class="na">secrets</span><span class="pi">:</span>
  <span class="c1"># Create a password for your CAP cluster</span>
  <span class="na">CLUSTER_ADMIN_PASSWORD</span><span class="pi">:</span> <span class="s">password</span>

  <span class="c1"># Create a password for your UAA client secret</span>
  <span class="na">UAA_ADMIN_CLIENT_SECRET</span><span class="pi">:</span> <span class="s">password</span>
</code></pre></div></div>

<p>Deploy uaa:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>helm <span class="nb">install </span>helm/uaa-opensuse <span class="se">\</span>
<span class="nt">--name</span> susecf-uaa <span class="se">\</span>
<span class="nt">--namespace</span> uaa <span class="se">\</span>
<span class="nt">--values</span> scf-config-values.yaml
</code></pre></div></div>

<p>Wait until UAA pods become ready:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>watch kubectl get pods <span class="nt">-n</span> uaa
</code></pre></div></div>

<p>Install scf:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ SECRET</span><span class="o">=</span><span class="si">$(</span>kubectl get pods <span class="nt">--namespace</span> uaa <span class="se">\</span>
<span class="nt">-o</span> <span class="nv">jsonpath</span><span class="o">=</span><span class="s1">'{.items[?(.metadata.name=="uaa-0")].spec.containers[?(.name=="uaa")].env[?(.name=="INTERNAL_CA_CERT")].valueFrom.secretKeyRef.name}'</span><span class="si">)</span>

<span class="nv">$ CA_CERT</span><span class="o">=</span><span class="s2">"</span><span class="si">$(</span>kubectl get secret <span class="nv">$SECRET</span> <span class="nt">--namespace</span> uaa <span class="se">\</span>
<span class="nt">-o</span> <span class="nv">jsonpath</span><span class="o">=</span><span class="s2">"{.data['internal-ca-cert']}"</span> | <span class="nb">base64</span> <span class="nt">--decode</span> -<span class="si">)</span><span class="s2">"</span>

<span class="nv">$ </span>helm <span class="nb">install </span>helm/cf-opensuse <span class="se">\</span>
<span class="nt">--name</span> susecf-scf <span class="se">\</span>
<span class="nt">--namespace</span> scf <span class="se">\</span>
<span class="nt">--values</span> scf-config-values.yaml <span class="se">\</span>
<span class="nt">--set</span> <span class="s2">"secrets.UAA_CA_CERT=</span><span class="k">${</span><span class="nv">CA_CERT</span><span class="k">}</span><span class="s2">"</span>
</code></pre></div></div>

<p>Wait until all pods become ready:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>watch kubectl get pods <span class="nt">-n</span> scf
</code></pre></div></div>

<p>ClouFoundry is now ready to be used. Setup the api (replace <code class="language-plaintext highlighter-rouge">192.168.1.152</code> with the correct ip as before):</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>cf api <span class="nt">--skip-ssl-validation</span> https://api.192.168.1.152.nip.io
</code></pre></div></div>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>cf login
</code></pre></div></div>

<p>(credentials are <code class="language-plaintext highlighter-rouge">admin</code> and <code class="language-plaintext highlighter-rouge">password</code> if you used the scf-config-values.yaml from above)</p>

<p>Enjoy!</p>

<h2 id="conclusion">Conclusion</h2>

<p>This experiment proved to be the easiest way to deploy scf locally so far for me. It is also quite flexible since I don’t need to know how many resources I will need for my CloudFoundry applications beforehand.</p>

<p>Although I used SUSE Cloud Application Platform components for this experiment, it can also be used to deploy any helm package out there. For example, I successfully deployed <a href="https://github.com/helm/charts/tree/master/stable/concourse">Concourse CI</a> on the same cluster. Having everything running on the same machine drove my SSD to its limits though.</p>

<p>If you were looking for docker-compose files to deploy containerized applications locally, with microk8s you can now look for a helm chart as an alternative.</p>

<p>While finishing this post, I watched the <a href="https://www.youtube.com/watch?v=okw8brTi6MY">recording of an interesting TGI Kubernetes episode</a> where <a href="https://github.com/kubernetes-sigs/kind">“kind”</a> ([K]ubernetes [IN] [D]ocker) was presented. I think that will be the next local kubernetes solution I will try.</p>

<p>Stay tuned…</p>]]></content><author><name></name></author><category term="microk8s" /><category term="cloudfoundry" /><category term="scf" /><category term="suse" /><category term="kubernetes" /><summary type="html"><![CDATA[A step by step guide]]></summary></entry><entry><title type="html">Going live!</title><link href="https://dimitris.karakasilis.me/2019/01/11/going-live.html" rel="alternate" type="text/html" title="Going live!" /><published>2019-01-11T18:07:12+00:00</published><updated>2019-01-11T18:07:12+00:00</updated><id>https://dimitris.karakasilis.me/2019/01/11/going-live</id><content type="html" xml:base="https://dimitris.karakasilis.me/2019/01/11/going-live.html"><![CDATA[<figure class="post-figure"><a href="https://500px.com/photo/248954203/lake-reflections-by-nicoletta-bendevi"><img src="/images/lake_reflections.jpg" alt="Lake Reflections" title="Lake Reflections by Nicoletta Bendevi" /></a><figcaption>Lake Reflections by Nicoletta Bendevi</figcaption></figure>

<p>The year is 2019 and I need a place where I can write my own guides, thoughts or whatever I think might be of interest to others. Of course one could do that on Medium, Facebook, Linkedin or other but then you have limited control over your own writings. Creating a blog is really simple and cheap so here we are.</p>

<p>This is the very first post, in a blog that no one reads (yet) but it could be a start of something good. Every tree starts small but not all trees grow to the same size. Hoping this will evolve to something useful…</p>

<figure class="highlight"><pre><code class="language-ruby" data-lang="ruby"><span class="nb">puts</span> <span class="s2">"Hello World!"</span></code></pre></figure>]]></content><author><name>Dimitris Karakasilis</name></author><category term="general" /><summary type="html"><![CDATA[First post of my new blog]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://dimitris.karakasilis.me/images/lake_reflections.jpg" /><media:content medium="image" url="https://dimitris.karakasilis.me/images/lake_reflections.jpg" xmlns:media="http://search.yahoo.com/mrss/" /></entry></feed>