<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Cristian Delgado on Medium]]></title>
        <description><![CDATA[Stories by Cristian Delgado on Medium]]></description>
        <link>https://medium.com/@crissdell?source=rss-24876b37ec0c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*wW7B2IxuCYN13zvTSuPkwQ.jpeg</url>
            <title>Stories by Cristian Delgado on Medium</title>
            <link>https://medium.com/@crissdell?source=rss-24876b37ec0c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 03:37:23 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@crissdell/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to run untrusted workloads in your organization]]></title>
            <link>https://medium.com/@crissdell/how-to-run-untrusted-workloads-in-your-organization-d6a62630a54b?source=rss-24876b37ec0c------2</link>
            <guid isPermaLink="false">https://medium.com/p/d6a62630a54b</guid>
            <category><![CDATA[kata]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[containerization]]></category>
            <dc:creator><![CDATA[Cristian Delgado]]></dc:creator>
            <pubDate>Sat, 07 Nov 2026 18:11:55 GMT</pubDate>
            <atom:updated>2026-11-08T23:43:20.769Z</atom:updated>
            <content:encoded><![CDATA[<p>I’m quite sure you have been there, when a provider tells you that you need to run their binary, and just gives you the image or some Helm chart that you must run in order to use it.</p><p>But underneath lies an image that you don’t know, that you dont trust, that you can’t audit. Or take another case, you are deploying a model, and the image doesn’t come with the model itself, its downloaded at startup time, so you don’t know what the model can bring.</p><p>Not a Medium member? <a href="https://xwayland.com/posts/kata">You can read this article for free here.</a></p><p>All of these scenarios are critical if you are a bank or a fintech and you process data with this image, and you use this model to predict something else.</p><p>To solve this problem ,an OpenInfra project arises: “Kata Containers”, This is the first part of a serie talking about Confidential Containers.</p><p>So you may be are wondering, what is really is Kata Containers?, Its an OCI runtime that runs each pod inside a lightweight virtual machine, but how is that different from the classic runc that Kubernetes uses by default.</p><p>Usually, when you run under the runc RuntimeClass, all the pods share the same kernel as the worker node, so they share the syscalls. If a vulnerability is eventually found, it can affect all the pods. In the case of Kata, if a bug is exploited, it only exposes one pod; the attackers would need to break the hypervisor’s kernel to access the other pods, so all workloads using Kata are sandboxed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/851/1*IonBwaMN6VmmJI600O40RQ.png" /></figure><p>Let’s try this out and see if it really solves this problem. Personally, I use MicroK8s because I’m currently using Ubuntu, but you can use any other Kubernetes flavor you have. With Ubuntu, I can easily install MicroK8s with classic confinement and enable observability with just a few commands.</p><p>First things first, let’s install Kata in order to be able to be use as a RuntimeClass inside microk8s.</p><p>You can find the installation process below.</p><p><a href="https://kata-containers.github.io/kata-containers/helm-configuration/">Helm - Kata Containers Docs</a></p><p>Once you have it installed, you can list all the runtimes that are present in your cluster.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/617/1*oV5r-ysKviSQ9i_u-zV75w.png" /></figure><p>Now let’s use kata-qemu as a runtimeclass.</p><h3>Isolation</h3><p>Now, we are going to create two pods with runc as the default and one with Kata. Then we are going to run uname -r .</p><p>As we can see in the images below, runc as expected shares the host kernel, while the Kata pod, it use a totally different kernel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*bgdd0YWOjY9dgxCFglLt5g.png" /><figcaption>runc-pod</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/1*YRwgSW8vwygSdJYMNipGKg.png" /><figcaption>kata-pod</figcaption></figure><p>The only difference between those pods is that a RuntimeClass was added to the second one.</p><p>This is the proof that the container are not just isolated by namespaces, They are now running inside their own lightweight VM.</p><h3>Process Visibility</h3><p>In both pods, I’ve spawned a specific process, sleep 3600.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/948/1*zB1kh1fQwJGE1oxzgeWBvw.png" /></figure><p>In the runc pod, as expected from the host machine, we can see the process “sleep 3600” from the host machine, because it’s running with runc, that it’s just a regular process wrapped in namespaces.</p><p>On the other side, in the Kata pod, there is no sleep process at all, only the QEMU process is visible , the process lives inside the provisioned machine, out of reach from the host machine.</p><h3>Breaking from a privileged pod to the host machine.</h3><p>For a moment, let’s analyze the command below, and what I’m really trying to achieve with it.</p><p>nsenter, as its name suggests is a command to enter namespaces, it attaches to the namespace of a process in this case PID 1, and within that process I’m accessing to the mount namespace in order to execute “cat /etc/hostname”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/947/1*MjdsoRaolv9Yx1LFWCGSow.png" /></figure><p>Here we have the two outcomes, in the runc pod, with the shared host kernel there is no boundary, so the container can access to the host’s hostname.</p><p>On the contrary, in the Kata pod, the command tries to access the PID 1, that in a normal machine is the init process, so it fails.</p><p>When I was a little more younger, I used to visit my local parish, there was a lot of books, and one in particular caught my attention, “Luces y sombras de la Iglesia” and I can’t recall it well, but one part of the book said “Donde hay mucha luz, la sombra es más intensa. — Where there is much light, the shadow is more intense”.</p><p>You may be wondering, why I’ve suddenly changed the subject , from containers to religion. Well, not everything that shines is exactly gold. In this case Kata seems too good to be true, there must be a catch somewhere, and you are right, there is a catch. Some disadvantages you may want to take into consideration if you really want to use it in your organization.</p><p>With both containers already scheduled, all I needed was to enable observability on microk8s, you can easily do that with, “microk8s enable observability” which under the hood installs the tempo, grafana and prometheus daemonsets to scrape metrics from the cluster and pods.</p><p>These dashboards show a clear difference in usage memory usage, when the pods are idle, as we can see, by default Kata uses around ~ 320MiB, because, Kata is a whole virtual machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*Ill-Q1z9EM16lUnDyNWZxw.png" /></figure><p>With runc, the container is just a normal Linux process. With Kata, there is a lot more processes in ordert to run a busybox image, container-shim-kata-v2, it would be the hypervisor and virtiofs, which is the glue between host’s filesystem and the VM.</p><p><em>What is virtiofs?</em></p><p>If you remember, the image is inside a lightweight virtual machine, and this machine can’t see the host’s files. Something must carry the files across that boundary, and virtiofs solves that problem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*VlqWw5KggNWAJElm0quuIg.png" /></figure><p>The host kernel is the actual system (microk8s), then we have container-shim-kata-v2 that is the pod manager, k8s never talks to the VM directly, this talks to QEMU to create the vm, virtiofs shares the container’s files from the host into the VM. and finally we have qemu, the program that is the virtual machine, inside it, there is the guest kernel, kata-agent which receives the shim commands to create the actual container and busybox the actual workload.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4MC_m0BhPttic5OEgqWlxw.png" /></figure><p>Now, this panel show how much CPU each process takes to keep pods idle. In short QEMU, is never idle because it in charge to keep running a whole operating system inside it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/789/1*s88WhdIalw049zHVRT5a3Q.png" /></figure><p>So far, we can actually see three things.</p><p>The pod that run under Kata RuntimeClass is sandboxed, any workload within the container can reach outside. If the workload is compromised it can only reach the pod’s guest kernel.</p><p>The cost to run Kata is mostly RAM.</p><p>Kata is more complex to debug and monitor, because is a sandboxed environment.</p><h4>So when should you use Kata?</h4><p>When the workload is untrusted or it has third party code, when compliance or security requires some level of isolation, or when it’s a sensitive workload.</p><p>Next in the series is “Confidential Containers”. I also want to write about a CNCF project kubevirt that may replace some hypervisors in the future and how it’s diferent from Kata.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d6a62630a54b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PREEMPT_RT is finally in Linux!]]></title>
            <link>https://medium.com/@crissdell/preempt-rt-is-finally-in-linux-27c0c789a4e5?source=rss-24876b37ec0c------2</link>
            <guid isPermaLink="false">https://medium.com/p/27c0c789a4e5</guid>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[fedora]]></category>
            <category><![CDATA[embedded]]></category>
            <category><![CDATA[real-time-operating]]></category>
            <dc:creator><![CDATA[Cristian Delgado]]></dc:creator>
            <pubDate>Wed, 09 Oct 2024 04:26:52 GMT</pubDate>
            <atom:updated>2024-10-09T04:26:52.318Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1019/1*KnIX1_PMhz-fHUwJpV9M0A.png" /></figure><p>While ago I wrote about Zephyr an RTOS ( currently a project under de umbrella of Linux Foundation). It has been quite a bit, but following the latest news, last week was finally merged quite interesting features into the Linux kernel (Linux 6.12-rc1) like QR code Panic messages, sched_ext and the most awaited feature PREEMPT_RT (Real Time Linux).</p><p><a href="https://zephyrproject.org/">Zephyr Project - A proven RTOS ecosystem, by developers, for developers</a></p><p>Although for a couple of years, Archlinux has been shipping a patched kernel with this feature, now it’s oficially mainline.</p><p>Since Linux 5.15, PREEMPT_RT has been partially merged into the mainline Linux kernel.</p><p>but… What exactly is an RTOS?</p><p>It’s an OS that focused explicitly to process real time applications.</p><p>Its a time-bound system which has well-defined, fixed time contraints, where the processing must be done within the defined constraints or the system will fail.</p><p>gotcha!, but now … What is preemption?</p><p>In simple words, is the ability to stop whatever the CPU is running to run another task, and in an RTOS any task should be preemptible, both in userspace and kernelspace.</p><p>Now that the merge windows are closed , the focus shifts to testing. I encourage you to download and try the Release Candidate kernel from Linus’ git tree.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/695/1*3hAthiZG7GkYsO9-awtfow.png" /><figcaption>Linus’ tree (Linux Kernel 6.12-rc1)</figcaption></figure><p>Well, it’s time to compile it and test it!</p><p>First, download and extract the kernel source.</p><p>I always remember this comics, is still kind of funny.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/0*iIgVISUKvf-bViq1.png" /><figcaption>https://xkcd.com/1168/</figcaption></figure><pre>$ tar -xzf Linux-6.12-rc1.tar.gz</pre><p>Lets add the features that we actually want to try.</p><pre>$ make menuconfig</pre><p>Currently my kernel was compiled with “Voluntary Kernel Preemption (Desktop)”, so if there are a specific process that yields “voluntarily” the CPU it will call yield() system call, then the kernel checks if there are other processes that are ready to run. If there are other processes, the kernel will perform a context switch and load the state of the process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/1*QDkj4567EUpuM_9RyOpwdQ.png" /><figcaption>Default Value for my Kernel</figcaption></figure><p>In this case high priority tasks will always preempt a low priority tasks, at userspace and kernelspace, ensuring that critical operations are executed promptly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*eEE7GCOkM4d6ELTR77yhoQ.png" /><figcaption>Desired Value</figcaption></figure><p>Once you selected all the values, it’s compilation time!</p><pre>make<br>sudo make modules_install<br>sudo make install</pre><p>This will generate this files, initramfs, system.map and vmlinuz.</p><p>Now, its time to modify the grub loader.</p><pre>sudo grub2-mkconfig -o /boot/grub2/grub.cfg</pre><p>Don’t forget to validate that you create a valid entry.</p><pre>grubby --info=ALL </pre><p>and reboot it!</p><p>Siehe da! , now testing time!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/829/1*JeYnUcqcpGEg6F2PpBPLvQ.png" /></figure><p>In order to test our new build kernel, we’ll need some components that may be available in your favorite distribution, well that wasn’t my case, so you also can find those utilities here. (RT-TESTS)</p><p><a href="https://linuxsoft.cern.ch/cern/centos/7/rt/x86_64/repoview/rt-tests.html">Linux @ CERN</a></p><p>With cyclictest we can test the latency, where the most important value is the maximum detected latency, because this can give an idea of the worst case latency, in my case 2016 us, that is a quite high value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/788/1*8vK6BXfu18G4jn3GxCMECQ.png" /></figure><p>But now, let’s make it real, the goal is to ilustrate how a high priority task will preempt a low priority task.</p><p>The premise is simple, lets run two tasks concurrently, where one last 0.5 and the other 1.0, and assign a priorities to each one of them.</p><pre><br>#include &lt;stdio.h&gt;<br>#include &lt;pthread.h&gt;<br>#include &lt;sched.h&gt;<br>#include &lt;time.h&gt;<br>#include &lt;unistd.h&gt;<br>// This task will take 0.5 seconds <br>void* high_priority_task(void* arg) {<br>    while (1) {<br>        printf(&quot;High-priority task running\n&quot;);<br>        usleep(500000);<br>    }<br>}<br>//Meanwhile this task will take 1 second.<br>void* low_priority_task(void* arg) {<br>    while (1) {<br>        printf(&quot;Low-priority task running\n&quot;);<br>        usleep(1000000);<br>    }<br>}<br><br>int main() {<br>    pthread_t thread1, thread2;<br>    struct sched_param param1, param2;<br>    pthread_attr_t attr1, attr2;<br>    pthread_attr_init(&amp;attr1);<br>    pthread_attr_init(&amp;attr2);<br><br>    // Here happens the magic!!!<br>    pthread_attr_setschedpolicy(&amp;attr1, SCHED_FIFO);<br>    pthread_attr_setschedpolicy(&amp;attr2, SCHED_FIFO);<br><br>    // Set major priority to task1 over task2<br>    param1.sched_priority = 80;<br>    param2.sched_priority = 60;<br>    pthread_attr_setschedparam(&amp;attr1, &amp;param1);<br>    pthread_attr_setschedparam(&amp;attr2, &amp;param2);<br><br>    // To simulate concurrent tasks, we create threads<br>    pthread_create(&amp;thread1, &amp;attr1, high_priority_task, NULL);<br>    pthread_create(&amp;thread2, &amp;attr2, low_priority_task, NULL);<br><br>   pthread_join(thread1, NULL);<br>    pthread_join(thread2, NULL);<br>}</pre><p>So the finals results, as we can see the high-priority task will preempt over the Low-priority task.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/343/1*uloV01Wtjw507FrhJ9YIlA.png" /></figure><p>This is huge!, this opens up new possibilities for Linux kernel in a wider range of applications that require this kind of deterministic performance. Since IoT devices, Automotive Grade Linux, Healthcare, and obviously embedded military applications (missile control).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=27c0c789a4e5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>