<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>K8s on sysarcher/@ich_code</title><link>https://sysarcher.github.io/categories/k8s/</link><description>Recent content in K8s on sysarcher/@ich_code</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Tue, 10 Nov 2020 21:22:37 +0200</lastBuildDate><atom:link href="https://sysarcher.github.io/categories/k8s/index.xml" rel="self" type="application/rss+xml"/><item><title>VM Optimizations for RT</title><link>https://sysarcher.github.io/posts/realtime-linux-vms/</link><pubDate>Tue, 10 Nov 2020 21:22:37 +0200</pubDate><guid>https://sysarcher.github.io/posts/realtime-linux-vms/</guid><description>&lt;p&gt;QEMU/KVM are a popular backend for OpenStack. In StarlingX Openstack (&lt;code&gt;stx-openstack&lt;/code&gt;) this is also the case. I&amp;rsquo;ll try to describe various techniques that I used to optimize RT behavior on an STX 4.0.1 cluster with worker nodes.&lt;/p&gt;
&lt;h4 id="terminology"&gt;Terminology&lt;/h4&gt;
&lt;p&gt;&lt;strong&gt;Bare-Metal&lt;/strong&gt; is a a physical computer and it&amp;rsquo;s base OS&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Host&lt;/strong&gt; is a bare-metal machine that runs VMs&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Thread&lt;/strong&gt; is a core of a CPU&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;CPU thread&lt;/strong&gt; refers to the thread on the host system CPU&lt;/p&gt;</description><content:encoded><![CDATA[<p>QEMU/KVM are a popular backend for OpenStack. In StarlingX Openstack (<code>stx-openstack</code>) this is also the case. I&rsquo;ll try to describe various techniques that I used to optimize RT behavior on an STX 4.0.1 cluster with worker nodes.</p>
<h4 id="terminology">Terminology</h4>
<p><strong>Bare-Metal</strong> is a a physical computer and it&rsquo;s base OS</p>
<p><strong>Host</strong> is a bare-metal machine that runs VMs</p>
<p><strong>Thread</strong> is a core of a CPU</p>
<p><strong>CPU thread</strong> refers to the thread on the host system CPU</p>
<p><strong>vCPU thread</strong> is a thread on a VM&rsquo;s virtualized CPU</p>
<p><em>Note: I borrowed terminology heavily from <a href="https://null-src.com/posts/qemu-optimization/post.php">this article on <code>null-src</code></a></em></p>
<h3 id="isolating-cpus">Isolating CPUs</h3>
<p><a href="https://shrmrf.github.io/rants/stx/2020/11/09/STX-for-RT.html">My last article covers this topic</a>. Isolating a VM&rsquo;s vCPU threads from the host system ensures that host&rsquo;s processes don&rsquo;t interfere with the VM.</p>
<h3 id="scheduling-openstack-vms-on-isolated-cores">Scheduling Openstack VMs on isolated cores</h3>
<h3 id="cpu-affinity">CPU Affinity</h3>
<h4 id="using-taskset">using <code>taskset</code></h4>
<h3 id="linux-process-scheduler-tuning">Linux Process Scheduler Tuning</h3>
<h3 id="grub-cmdline">GRUB cmdline</h3>
<p>Okay&hellip; don&rsquo;t delete the <code>console</code> entries in your command line&hellip; the entries below are for isolated cpu 1. This is not a comprehensive list&hellip; Just append whatever makes sense to you.</p>
<pre tabindex="0"><code>GRUB_CMDLINE_LINUX_DEFAULT=&#34;threadirqs rcu_nocbs=1 rcu_nocb_poll isolcpus=1 nohz_full=1 nohz=off intel_pstate=disable nosoftlockup nohalt&#34;
</code></pre>]]></content:encoded></item><item><title>On-prem Kubernetes</title><link>https://sysarcher.github.io/posts/k8s-on-prem/</link><pubDate>Sun, 14 Jun 2020 21:22:37 +0200</pubDate><guid>https://sysarcher.github.io/posts/k8s-on-prem/</guid><description>&lt;p&gt;I have spent time looking at edge deployments of kubernetes, especially, those that are managed by the Ops team in an industry 4.0 setting. Here are my candidates:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;KubeEdge&lt;/li&gt;
&lt;li&gt;k3s and k3os&lt;/li&gt;
&lt;li&gt;StarlingX&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I present my brief impressions of each below. This post will need updates as my research goes on.&lt;/p&gt;
&lt;h3 id="background"&gt;Background&lt;/h3&gt;
&lt;p&gt;&lt;em&gt;Edge&lt;/em&gt; is often used as a vague term for either one of CDN, factory network or IT data center. There is a fair amount of confusion where cloud transforms into &amp;ldquo;Edge&amp;rdquo;.&lt;/p&gt;</description><content:encoded><![CDATA[<p>I have spent time looking at edge deployments of kubernetes, especially, those that are managed by the Ops team in an industry 4.0 setting. Here are my candidates:</p>
<ul>
<li>KubeEdge</li>
<li>k3s and k3os</li>
<li>StarlingX</li>
</ul>
<p>I present my brief impressions of each below. This post will need updates as my research goes on.</p>
<h3 id="background">Background</h3>
<p><em>Edge</em> is often used as a vague term for either one of CDN, factory network or IT data center. There is a fair amount of confusion where cloud transforms into &ldquo;Edge&rdquo;.</p>
<p><em>Fog</em> apparently is used to describe the same concepts and maintains the vaporous water analogue that is so popular in this space (think about it: data lake, fog, clouds &hellip;) Usage of the term &ldquo;Fog&rdquo; has been tainted by Cisco. <a href="https://www.cisco.com/c/en/us/solutions/enterprise-networks/edge-computing.html">They make a poor attempt</a> to show the difference. Meh.</p>
<p><em>kubernetes</em> is a container orchestrator that has become extremely popular in the last few years. It provides a common API to manage all containers running in your system.</p>
<p><em>Cloud native</em> is used to describe container-first and container-based systems. (my own definition)</p>
<p><em>CNCF</em> is the cloud native computing foundation. It manages projects that specifically target cloud native systems. It does not manage all cloud-native projects. To the contrary, there is a small list of projects that are managed by CNCF.</p>
<p><em>Linux Foundation</em> maintains a set of open source projects. LF Edge is the subgroup that does this for projects targeting Edge deployments. LF projects are of all types.</p>
<p><em>OpenStack Foundation</em> is another foundation that was originally formed for OpenStack&rsquo;s projects (next item) but it seems to now be accepting projects related to other systems.</p>
<p><em>OpenStack</em> is the most popular open source cloud. It&rsquo;s the OG thing: was popular before docker, k8s or anything container-related was mainstream. There are still many users of OpenStack in the wild and it&rsquo;s not going anywhere soon.</p>
<h3 id="kubeedge">KubeEdge</h3>
<p>KubeEdge is a CNCF sandbox project designed to extend Kubernetes from cloud to edge. The IoT Edge has unique challenges that no one solution can provide a complete solution for. KubeEdge is designed to meet the challenge of:</p>
<ul>
<li>Network Reliability</li>
<li>Resource constraint; and</li>
<li>Scalability</li>
</ul>
<p>KubeEdge has agents running on the Edge. The control plane resides on the Cloud and if there&rsquo;s a network failure/disconnect, the agents keep on doing the necessary control operations. Metadata is synchronized as soon as the connection is restored.</p>
<p>KubeEdge is an opinionated take on the Edge: it provides services and frameworks for messaging and networking. And, since it&rsquo;s opinionated, everyone might not agree with it.</p>
<p>My opinion is that KubeEdge will keep on serving a large userbase but it might not be extremely well suited to the 20% market that wants extra flexibility. How it pans out long-term is yet to be seen.</p>
<p>KubeEdge is bringing edge-edge communication which will be interesting combined with newer enhancements in the Linux kernel (read: Wireguard.) This is an extremely interesting project but for the Industry I&rsquo;m working in, might not be the first choice - atleast for me.</p>
<h3 id="k3s">k3s</h3>
<p>K3s is a take on Kubernetes that removes lot&rsquo;s of stuff off of standard kubernetes.</p>
<h4 id="k3os">k3os</h4>
<p><em>benefits of not maintaining your OS and it&rsquo;s downsides</em></p>
<h3 id="starlingx">StarlingX</h3>
<p>StarlingX is an integration project centered around Kubernetes. StarlingX makes an opinionated set of decisions for people looking to use Kubernetes for their infrastructure. StarlingX (STX) is part of the OpenStack foundation which is a testament to it&rsquo;s high quality.</p>
]]></content:encoded></item><item><title>Kata annotations</title><link>https://sysarcher.github.io/posts/kata-annotations/</link><pubDate>Tue, 11 Jun 2019 21:22:37 +0200</pubDate><guid>https://sysarcher.github.io/posts/kata-annotations/</guid><description>&lt;p&gt;&lt;em&gt;Annotations are a great feature in Kubernetes and a means for communicating to kata some options. &lt;a href="https://github.com/kata-containers/documentation/issues/486"&gt;They are being documented as of the time of this writing&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Using annotations, you can:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Customize the Kernel that is used (see &lt;code&gt;KernelPath&lt;/code&gt; example below)&lt;/li&gt;
&lt;li&gt;Change the guest image (&lt;code&gt;ImagePath&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Hypervisor (&lt;code&gt;HypervisorPath&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Firmware (&lt;code&gt;FirmwarePath&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;etc. etc. (All of the annotations are listed in &lt;a href="https://github.com/kata-containers/runtime/blob/master/virtcontainers/pkg/annotations/annotations.go"&gt;&lt;code&gt;annotations.go&lt;/code&gt;&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="using-a-custom-kernel"&gt;Using a Custom Kernel&lt;/h3&gt;
&lt;p&gt;Here is the &lt;code&gt;yaml&lt;/code&gt; file I used to apply a custom kernel:&lt;/p&gt;</description><content:encoded><![CDATA[<p><em>Annotations are a great feature in Kubernetes and a means for communicating to kata some options. <a href="https://github.com/kata-containers/documentation/issues/486">They are being documented as of the time of this writing</a></em></p>
<p>Using annotations, you can:</p>
<ul>
<li>Customize the Kernel that is used (see <code>KernelPath</code> example below)</li>
<li>Change the guest image (<code>ImagePath</code>)</li>
<li>Hypervisor (<code>HypervisorPath</code>)</li>
<li>Firmware (<code>FirmwarePath</code>)</li>
<li>etc. etc. (All of the annotations are listed in <a href="https://github.com/kata-containers/runtime/blob/master/virtcontainers/pkg/annotations/annotations.go"><code>annotations.go</code></a>)</li>
</ul>
<h3 id="using-a-custom-kernel">Using a Custom Kernel</h3>
<p>Here is the <code>yaml</code> file I used to apply a custom kernel:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span><span style="color:#f92672">apiVersion</span>: <span style="color:#ae81ff">v1</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">kind</span>: <span style="color:#ae81ff">Pod</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">metadata</span>:
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">annotations</span>:
</span></span><span style="display:flex;"><span>        <span style="color:#f92672">com.github.containers.virtcontainers.KernelPath</span>: <span style="color:#e6db74">&#34;/usr/share/kata-containers/vmlinuz-4.19.31-40&#34;</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">name</span>: <span style="color:#ae81ff">kata-example</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">spec</span>:
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">runtimeClassName</span>: <span style="color:#ae81ff">kata-qemu</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">containers</span>:
</span></span><span style="display:flex;"><span>  - <span style="color:#f92672">name</span>: <span style="color:#ae81ff">nginx-container</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">image</span>: <span style="color:#ae81ff">nginx</span>
</span></span></code></pre></div><p>The <code>metadata</code> key contains the <code>annotations</code> map. All of the annotations are listed in <a href="https://github.com/kata-containers/runtime/blob/master/virtcontainers/pkg/annotations/annotations.go"><code>annotations.go</code></a> on the main repo.</p>
]]></content:encoded></item><item><title>Kata and Kubernetes</title><link>https://sysarcher.github.io/posts/kata-k8s/</link><pubDate>Sun, 19 May 2019 21:22:37 +0200</pubDate><guid>https://sysarcher.github.io/posts/kata-k8s/</guid><description>&lt;h3 id="setting-up-kata-using-docker"&gt;Setting up Kata using Docker&lt;/h3&gt;
&lt;p&gt;This is documented here: &lt;a href="https://github.com/kata-containers/packaging/blob/master/kata-deploy/README.md#docker-quick-start"&gt;https://github.com/kata-containers/packaging/blob/master/kata-deploy/README.md#docker-quick-start&lt;/a&gt;&lt;/p&gt;
&lt;h3 id="using-minikube-and-kata"&gt;Using Minikube and Kata&lt;/h3&gt;
&lt;p&gt;&lt;a href="https://github.com/kata-containers/documentation/pull/445#"&gt;This PR&lt;/a&gt; is adding the documentation to get started with &lt;code&gt;minikube&lt;/code&gt;: &lt;a href="https://github.com/kata-containers/documentation/pull/445#"&gt;https://github.com/kata-containers/documentation/pull/445#&lt;/a&gt;&lt;/p&gt;
&lt;h3 id="using-kubeadm"&gt;Using &lt;code&gt;kubeadm&lt;/code&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;First, set up a Kubernetes cluster using &lt;code&gt;kubeadm&lt;/code&gt;: &lt;a href="https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/"&gt;https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;then, &lt;a href="https://github.com/kata-containers/packaging/blob/master/kata-deploy/README.md#kubernetes-quick-start"&gt;https://github.com/kata-containers/packaging/blob/master/kata-deploy/README.md#kubernetes-quick-start&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="conclusion"&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Using the new &lt;code&gt;kata-deploy&lt;/code&gt; method, it is very easy to set up a Kubernetes cluster that uses Kata Containers.&lt;/p&gt;</description><content:encoded><![CDATA[<h3 id="setting-up-kata-using-docker">Setting up Kata using Docker</h3>
<p>This is documented here: <a href="https://github.com/kata-containers/packaging/blob/master/kata-deploy/README.md#docker-quick-start">https://github.com/kata-containers/packaging/blob/master/kata-deploy/README.md#docker-quick-start</a></p>
<h3 id="using-minikube-and-kata">Using Minikube and Kata</h3>
<p><a href="https://github.com/kata-containers/documentation/pull/445#">This PR</a> is adding the documentation to get started with <code>minikube</code>: <a href="https://github.com/kata-containers/documentation/pull/445#">https://github.com/kata-containers/documentation/pull/445#</a></p>
<h3 id="using-kubeadm">Using <code>kubeadm</code></h3>
<ul>
<li>First, set up a Kubernetes cluster using <code>kubeadm</code>: <a href="https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/">https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/</a></li>
<li>then, <a href="https://github.com/kata-containers/packaging/blob/master/kata-deploy/README.md#kubernetes-quick-start">https://github.com/kata-containers/packaging/blob/master/kata-deploy/README.md#kubernetes-quick-start</a></li>
</ul>
<h3 id="conclusion">Conclusion</h3>
<p>Using the new <code>kata-deploy</code> method, it is very easy to set up a Kubernetes cluster that uses Kata Containers.</p>
]]></content:encoded></item></channel></rss>