<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.4.1">Jekyll</generator><link href="https://govekar.net/feed.xml" rel="self" type="application/atom+xml" /><link href="https://govekar.net/" rel="alternate" type="text/html" /><updated>2026-09-20T16:34:05+00:00</updated><id>https://govekar.net/feed.xml</id><title type="html">LovroG05’s blog</title><subtitle>This site is my learning blog. It is THE blog to see how I learn programming and devops related skills.</subtitle><entry><title type="html">Learning Kubernetes</title><link href="https://govekar.net/2026/09/20/learning-kubernetes.html" rel="alternate" type="text/html" title="Learning Kubernetes" /><published>2026-09-20T00:00:00+00:00</published><updated>2026-09-20T00:00:00+00:00</updated><id>https://govekar.net/2026/09/20/learning-kubernetes</id><content type="html" xml:base="https://govekar.net/2026/09/20/learning-kubernetes.html"><![CDATA[<p>Some time ago, I decided to build a nice way to deploy my projects in my homelab, which consists of 3 proxmox hosts and a NAS. I used to have a couple of VMs with docker installed and simply deployed it via docker compose, but that has one large problem: I often pull machines from my “rack” to tinker with them, and that means services are down.</p>

<p>Naturally, this calls for some kind of a system with replication, and having spent time on <a href="https://www.reddit.com/r/ProgrammerHumor/">r/ProgrammerHumor</a>, I immediately thought of Kubernetes. After reading and trying my way through the tutorial at <a href="https://kubernetes.io/docs/setup/">kubernetes.io</a>, I created 3 Ubuntu server VMs, one on each host. With 4 GB of RAM and 2 CPUs, they aren’t too heavy on my homelab. I then installed <a href="https://docs.k3s.io/quick-start">K3s</a> on them, connecting them into a cluster.</p>

<p>The application we are deploying today is a stateless <a href="https://jekyllrb.com/">Jekyll</a> site in a docker image.</p>

<p>First, let’s create a namespace, so that our configs and resources are separated: <code class="language-plaintext highlighter-rouge">kubectl create namespace blog</code>.</p>

<p>Since this is a docker image, we will need to get it from somewhere, and since that isn’t docker hub, we need to add credentials for our registry. This can be done with: <code class="language-plaintext highlighter-rouge">kubectl create secret docker-registry regcred2 --docker-server=domain --docker-username=username --docker-password=password -n blog</code>.</p>

<p>The <code class="language-plaintext highlighter-rouge">-n blog</code>, which you will undoubtedly see again, selects the namespace we created earlier.</p>

<p>Next, let’s create a deployment configuration file. This is a yaml file, that can be created in the repository, or anywhere else, since you can use it from your laptop with kubectl.</p>

<div class="language-yaml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="na">apiVersion</span><span class="pi">:</span> <span class="s">apps/v1</span>
<span class="na">kind</span><span class="pi">:</span> <span class="s">Deployment</span>
<span class="na">metadata</span><span class="pi">:</span>
  <span class="na">name</span><span class="pi">:</span> <span class="s">blog</span>
  <span class="na">namespace</span><span class="pi">:</span> <span class="s">blog</span>
<span class="na">spec</span><span class="pi">:</span>
  <span class="na">replicas</span><span class="pi">:</span> <span class="s">3</span> 
  <span class="na">selector</span><span class="pi">:</span>
    <span class="na">matchLabels</span><span class="pi">:</span> <span class="pi">{</span> <span class="nv">app</span><span class="pi">:</span> <span class="nv">blog</span> <span class="pi">}</span>
  <span class="na">template</span><span class="pi">:</span>
    <span class="na">metadata</span><span class="pi">:</span>
      <span class="na">labels</span><span class="pi">:</span> <span class="pi">{</span> <span class="nv">app</span><span class="pi">:</span> <span class="nv">blog</span> <span class="pi">}</span>
    <span class="na">spec</span><span class="pi">:</span>
      <span class="na">imagePullSecrets</span><span class="pi">:</span>
        <span class="pi">-</span> <span class="na">name</span><span class="pi">:</span> <span class="s">regcred2</span>
      <span class="na">containers</span><span class="pi">:</span>
        <span class="pi">-</span> <span class="na">name</span><span class="pi">:</span> <span class="s">blog</span>
          <span class="na">image</span><span class="pi">:</span> <span class="s">registry-domain/lovrog05/blog:latest</span> 
          <span class="na">ports</span><span class="pi">:</span> <span class="pi">[{</span> <span class="nv">containerPort</span><span class="pi">:</span> <span class="nv">80</span> <span class="pi">}]</span>
          <span class="na">resources</span><span class="pi">:</span>
            <span class="na">requests</span><span class="pi">:</span> <span class="pi">{</span> <span class="nv">memory</span><span class="pi">:</span> <span class="nv">16Mi</span><span class="pi">,</span> <span class="nv">cpu</span><span class="pi">:</span> <span class="nv">10m</span> <span class="pi">}</span>
</code></pre></div></div>

<p>This can be applied with <code class="language-plaintext highlighter-rouge">kubectl apply -f blog.yaml</code>.</p>

<p>Notice the line <code class="language-plaintext highlighter-rouge">replicas: 3</code>, which tells us we want 3 instances of this application. Since we have 3 host VMs, k3s will try to automatically put one on each VM. However, how do we split the load between the pods?</p>

<p>For that, we need to create a Load balancer service, which can come with its own yaml config file:</p>

<div class="language-yaml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="na">apiVersion</span><span class="pi">:</span> <span class="s">v1</span>
<span class="na">kind</span><span class="pi">:</span> <span class="s">Service</span>
<span class="na">metadata</span><span class="pi">:</span>
  <span class="na">name</span><span class="pi">:</span> <span class="s">blog</span>
  <span class="na">namespace</span><span class="pi">:</span> <span class="s">blog</span>
  <span class="na">annotations</span><span class="pi">:</span>
    <span class="na">metallb.universe.tf/loadBalancerIPs</span><span class="pi">:</span> <span class="s">10.169.250.4</span>
<span class="na">spec</span><span class="pi">:</span>
  <span class="na">type</span><span class="pi">:</span> <span class="s">LoadBalancer</span>
  <span class="na">selector</span><span class="pi">:</span> <span class="pi">{</span> <span class="nv">app</span><span class="pi">:</span> <span class="nv">blog</span> <span class="pi">}</span>
  <span class="na">ports</span><span class="pi">:</span>
    <span class="pi">-</span> <span class="na">port</span><span class="pi">:</span> <span class="m">80</span>
      <span class="na">targetPort</span><span class="pi">:</span> <span class="m">80</span>
</code></pre></div></div>

<p><code class="language-plaintext highlighter-rouge">metallb.universe.tf/loadBalancerIPs: 10.169.250.4</code> comes into play since I also run MetalLB in place of ServiceLB, K3s default, a type of load balancer for bare-metal clusters, which sets LAN static IPs within a set range to each deployment’s LoadBalancer, allowing me to point my reverse proxy at each deployed app.</p>

<p>This can once again be applied with <code class="language-plaintext highlighter-rouge">kubectl -n blog apply -f service.yaml</code>.</p>

<p>So, now I can view my own blog on my local network even when I am working on one of my machines, which is pretty neat, I guess.</p>]]></content><author><name></name></author><summary type="html"><![CDATA[Some time ago, I decided to build a nice way to deploy my projects in my homelab, which consists of 3 proxmox hosts and a NAS. I used to have a couple of VMs with docker installed and simply deployed it via docker compose, but that has one large problem: I often pull machines from my “rack” to tinker with them, and that means services are down.]]></summary></entry><entry><title type="html">Welcome to Jekyll!</title><link href="https://govekar.net/jekyll/update/2026/09/04/welcome-to-jekyll.html" rel="alternate" type="text/html" title="Welcome to Jekyll!" /><published>2026-09-04T16:48:15+00:00</published><updated>2026-09-04T16:48:15+00:00</updated><id>https://govekar.net/jekyll/update/2026/09/04/welcome-to-jekyll</id><content type="html" xml:base="https://govekar.net/jekyll/update/2026/09/04/welcome-to-jekyll.html"><![CDATA[<p>You’ll find this post in your <code class="language-plaintext highlighter-rouge">_posts</code> directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run <code class="language-plaintext highlighter-rouge">jekyll serve</code>, which launches a web server and auto-regenerates your site when a file is updated.</p>

<p>Jekyll requires blog post files to be named according to the following format:</p>

<p><code class="language-plaintext highlighter-rouge">YEAR-MONTH-DAY-title.MARKUP</code></p>

<p>Where <code class="language-plaintext highlighter-rouge">YEAR</code> is a four-digit number, <code class="language-plaintext highlighter-rouge">MONTH</code> and <code class="language-plaintext highlighter-rouge">DAY</code> are both two-digit numbers, and <code class="language-plaintext highlighter-rouge">MARKUP</code> is the file extension representing the format used in the file. After that, include the necessary front matter. Take a look at the source for this post to get an idea about how it works.</p>

<p>Jekyll also offers powerful support for code snippets:</p>

<figure class="highlight"><pre><code class="language-ruby" data-lang="ruby"><span class="k">def</span> <span class="nf">print_hi</span><span class="p">(</span><span class="nb">name</span><span class="p">)</span>
  <span class="nb">puts</span> <span class="s2">"Hi, </span><span class="si">#{</span><span class="nb">name</span><span class="si">}</span><span class="s2">"</span>
<span class="k">end</span>
<span class="n">print_hi</span><span class="p">(</span><span class="s1">'Tom'</span><span class="p">)</span>
<span class="c1">#=&gt; prints 'Hi, Tom' to STDOUT.</span></code></pre></figure>

<p>Check out the <a href="https://jekyllrb.com/docs/home">Jekyll docs</a> for more info on how to get the most out of Jekyll. File all bugs/feature requests at <a href="https://github.com/jekyll/jekyll">Jekyll’s GitHub repo</a>. If you have questions, you can ask them on <a href="https://talk.jekyllrb.com/">Jekyll Talk</a>.</p>]]></content><author><name></name></author><category term="jekyll" /><category term="update" /><summary type="html"><![CDATA[You’ll find this post in your _posts directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run jekyll serve, which launches a web server and auto-regenerates your site when a file is updated.]]></summary></entry></feed>