<?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 ./Crashloop.sh on Medium]]></title>
        <description><![CDATA[Stories by ./Crashloop.sh on Medium]]></description>
        <link>https://medium.com/@crashloop?source=rss-5fb577d9f9e2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*7SCNH3K-pXK7uu5h0dHoUw@2x.jpeg</url>
            <title>Stories by ./Crashloop.sh on Medium</title>
            <link>https://medium.com/@crashloop?source=rss-5fb577d9f9e2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 05:21:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@crashloop/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[Understand your process stdin/stdout: pipes, inter-process communication, GO]]></title>
            <link>https://blog.devops.dev/understand-your-process-stdin-stdout-pipes-inter-process-communication-go-5e0d0176779b?source=rss-5fb577d9f9e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/5e0d0176779b</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[system-programming]]></category>
            <category><![CDATA[interprocesscommunication]]></category>
            <category><![CDATA[pipes]]></category>
            <dc:creator><![CDATA[./Crashloop.sh]]></dc:creator>
            <pubDate>Sat, 27 Sep 2025 00:00:38 GMT</pubDate>
            <atom:updated>2025-10-01T16:34:40.903Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*om1TMUx2Sh7CnQmGR_J_Lg.png" /></figure><p>It started from the place where I needed to pass data from a parent process to a child process on my journey of creating my own container runtime. For today’s blog we gonna focus mainly on the stdin stdout of a process and how you can use pipes to exchange data.</p><blockquote>For a comfy eye experiece you may check the original blog post -&gt; <a href="https://www.crashloop.sh/posts/understand-your-proccess-stdin-stdout-and-pipes-in-go">https://www.crashloop.sh/posts/understand-your-proccess-stdin-stdout-and-pipes-in-go</a></blockquote><h3>Familiar scenario</h3><p>you have two processes running A and B, and you want the output of A to be read by B.</p><p>How do we usually do that? Pipe maybe? which in terminal is denoted by this symbol |, considering A is this command ( printf &#39;hello&#39;; sleep 2; printf &#39; world\n&#39;; ) and B is cat.</p><p>We would do ( printf &#39;hello&#39;; sleep 2; printf &#39; world\n&#39;; ) | cat right?Now here is the question, what would be the output?</p><ol><li>hello world</li><li>hello then after two seconds it print world</li></ol><p>If you chose the second option I am assuming you know what’s happening under. However if you are team 1, and wondering let’s try to unpack it together.</p><h3>Pipes</h3><p>When process A writes to it’s stdout, in our case it writes two times hello then world.</p><p>you may expected that the process finishes writing all these then somehow they get redirected to cat and it print them all.</p><p>But what happened exactly was that the process A stdout out is being poured to the write end of the pipe and the read end of the pipe is being read by the process B. So if anything get poured in the beginning of the pipe it will show at the end of the pipe and the process B can read it. it is a FIFO, first in first out.</p><p>So what is a pipe exactly? In linux vocab it is a kernel object. But what is it exactly? It is just a memory buffer, with a very limited capacity, the default is around 1048576 bytes = 1 MiB And we can actually see it.</p><pre>✗ cat /proc/sys/fs/pipe-max-size 1048576</pre><p>To conclude, the pipe is a memory buffer, where a process can writes to it and another process can read from it, just like a queue. One thing to be aware of is that the pipe is independent from the process lifecycle. Meaning if a process A write to the the pipe and it dies, the pipe is not bound to it it still exist and another process can still read from it. As the pipe leaves in the kernel space memory and managed by the kernel.</p><p>Let’s see how we can achieve this scenario in go.</p><pre>func main() {<br>    w, r, _ := os.Pipe() // Instruct the kernel to create a new pipe<br>}</pre><p>The above snippet will create a pipe and return two file descriptors. w is the write end of the pipe and r is the read end of the pipe.</p><pre>// process_inout.go<br>package main<br><br>import (<br> &quot;bufio&quot;<br> &quot;fmt&quot;<br> &quot;log&quot;<br> &quot;os&quot;<br> &quot;os/exec&quot;<br>)<br><br>func main() {<br> r, w, err := os.Pipe() // Instruct the kernel to create a new pipe<br><br> if err != nil {<br>  log.Fatal(err)<br> }<br><br> os.Stdin = nil<br> os.Stdout = w // redirect the output to the write end of the pipe<br><br> if len(os.Args) &gt; 1 &amp;&amp; os.Args[1] == &quot;child&quot; {<br>  os.Stdin = os.NewFile(uintptr(3), &quot;parent_pid_pipe&quot;) // point stdin to the read end of the pipe<br><br>  defer r.Close()<br>  reader := bufio.NewReader(os.Stdin)<br><br>  line, _ := reader.ReadString(&#39;\n&#39;)<br>  log.Printf(&quot;[PID: %v] The main process is saying : %v \n&quot;, os.Getpid(), line)<br> }<br><br> fmt.Printf(&quot;HOLA! [PID: %v] \n&quot;, os.Getpid())<br> w.Close() // close the write end of the pipe in the parent process<br><br> cmd := exec.Command(&quot;/proc/self/exe&quot;, &quot;child&quot;)<br> cmd.Stdin, cmd.Stdout, cmd.Stderr = r, cmd.Stdout, os.Stderr<br> cmd.ExtraFiles = []*os.File{r} // share the read end of the pipe with the child process<br><br> cmd.Run()<br><br>}<br><br></pre><p>Sample output of the above code, (keep reading the post, and the following output will make sense)</p><pre>✗ ./process_inout 2025/09/27 13:50:28 [PID: 354560] The main process is saying : HOLA! [PID: 354555]</pre><p>let’s read the code step by step, shall we?</p><pre>os.Stdin = nil<br>os.Stdout = w // redirect the output to the write end of the pipe</pre><p>After creating the pipe I set stdin to nil, since our main process does not need any input, and as you see I pointed the stdout to the read end of the pipe. What does that mean? Generally when writing any program we usually run fmt.Println(&quot;something&quot;) for example and it does show the output in the terminal, it is because by default both stdin and stdout is pointed to the terminal device for getting inputs and printing outputs.</p><p>And what we are doing here is that we are overriding the default to fit our usecase. Coming to the next part of the code which is the part that gonna run first.</p><pre>fmt.Printf(&quot;HOLA! [PID: %v] \n&quot;, os.Getpid())<br>w.Close() // close the write end of the pipe in the parent process<br><br>cmd := exec.Command(&quot;/proc/self/exe&quot;, &quot;child&quot;)<br>cmd.Stdin, cmd.Stdout, cmd.Stderr = cmd.Stdin, cmd.Stdout, os.Stderr<br>cmd.ExtraFiles = []*os.File{r} // share the read end of the pipe with the child process<br><br>cmd.Run()</pre><p>In a normal senario this print fmt.Printf(&quot;HOLA! [PID: %v] \n&quot;, os.Getpid()) would show on the terminal, but since we modified the defaults of our process, this line will be written to the memory buffer of the pipe. after finish writing we close the write end of the pipe.</p><p>Then the program will re-execute itself, by this special command /proc/self/exe the program will start again with an extra argument called child. as you see for the child process we are setting the defaults stdin, stdout, stderr. in an addition to passing an extra file which is the read end of the pipe. if we don&#39;t pass it then the child when re-executed it will not know how to reach to the read end of the pipe buffer.</p><p>When re-excuted it will enter the if statement block which the following part</p><pre>if len(os.Args) &gt; 1 &amp;&amp; os.Args[1] == &quot;child&quot; {<br>  os.Stdin = os.NewFile(uintptr(3), &quot;parent_pid_pipe&quot;) // point stdin to the read end of the pipe<br><br>  defer r.Close()<br>  reader := bufio.NewReader(os.Stdin)<br><br>  line, _ := reader.ReadString(&#39;\n&#39;)<br>  log.Printf(&quot;[PID: %v] The main process is saying : %v \n&quot;, os.Getpid(), line)<br> }</pre><p>Since file descriptors are just numbers starting from 0. On our child process we passed the following files: stdin, stdout, stderr, and we added an extra file cmd.ExtraFiles = []*os.File{r} that is pointing to the read end of the pipe. so we have the the following fds: <strong>0,1,2,3</strong></p><p>Then I modified the stdin of the child to point to the read end of the pipe, and I could get the fd pointing to the read end of the pipe by specifying it’s number which is 3. for the stdout I left the default since I want the output to go to the terminal from the child process.</p><p>Then I read from stdin, which is again pointing to the read end of the pipe.</p><p>Now if you read again this line, you see that the data is received by the child process via the pipe and then it get printed to the terminal.</p><pre>✗ ./process_inout 2025/09/27 13:50:28 [PID: 354560] The main process is saying : HOLA! [PID: 354555]</pre><p>We successfully created our own pipe and data flow programmatically!</p><p>Also, now you can understand what this guy | is doing and what is happening under this command ( printf &#39;hello&#39;; sleep 2; printf &#39; world\n&#39;; ) | cat</p><p>and that was it for this blog post!</p><p>Onwards!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5e0d0176779b" width="1" height="1" alt=""><hr><p><a href="https://blog.devops.dev/understand-your-process-stdin-stdout-pipes-inter-process-communication-go-5e0d0176779b">Understand your process stdin/stdout: pipes, inter-process communication, GO</a> was originally published in <a href="https://blog.devops.dev/">DevOps.dev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Go Project: Load Balancer, TCP Proxy, mTLS, and Stress Testing for Fun]]></title>
            <link>https://medium.com/@crashloop/a-go-project-load-balancer-tcp-proxy-mtls-and-stress-testing-for-fun-f0a8ee871511?source=rss-5fb577d9f9e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/f0a8ee871511</guid>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[proxy]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[./Crashloop.sh]]></dc:creator>
            <pubDate>Sun, 06 Jul 2025 15:42:44 GMT</pubDate>
            <atom:updated>2025-07-06T15:43:24.536Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JC1ZX757icwyzArH2K5kyQ.png" /></figure><p>This project isn’t meant to be production-ready, it’s a playground to explore core infrastructure concepts through code.</p><h3>Infrastructure for Fun with Golang</h3><p>The project includes several services and tools, all written from scratch in Go, to simulate real-world infrastructure pieces.</p><h3>What you can learn from this project</h3><ul><li>TLS termination and mutual TLS (mTLS) enforcement</li><li>Building simple infrastructure tools in Go (app load balancer, tcp proxy, mtls …)</li><li>Differentiating network-layer vs application-layer proxying</li><li>Writing a basic WAF and applying IP/port filtering</li><li>Managing certificates with a self-created CA</li><li>How to do stress test</li></ul><h3>Current Components</h3><h4>Application Load Balancer</h4><ul><li>Supports round-robin request distribution</li><li>Terminates HTTPS connections</li><li>Enforces mutual TLS (mTLS)</li><li>Includes a basic Web Application Firewall (WAF) using IP and port allowlists</li></ul><h4>TCP Proxy</h4><ul><li>Forwards raw bytes without application-layer logic</li><li>Useful for comparing network-layer proxying vs TLS-terminating proxies</li></ul><h4>mTLS-Enabled Client</h4><ul><li>The client is provided by the certs to present it to the server. to ensure teh mtls flow and that the client is trusted.</li></ul><h4>Certificate Generator</h4><ul><li>Creates a local Certificate Authority (CA)</li><li>Issues certificates for both clients and servers</li></ul><h4>How to Run the Stack</h4><p>This project is configured to run using make commands for simplicity.</p><p>Here’s the step-by-step process:</p><ol><li>Generate a Local CA make generate_ca This command creates a local CA that you&#39;ll use to sign client and server certificates.</li><li>Generate Certificates Generate self-signed certs (signed by the local CA) for the server and client:</li></ol><pre>make generate_self_signed_cert for=server crt=server.crt key=server.key<br>make generate_self_signed_cert for=client crt=client.crt key=client.key</pre><p>3. Run the Application Load Balancer make run_application_load_balancer The load balancer loads its config from app_loadbalancer_config.yaml. Here&#39;s a sample:</p><pre>host: localhost:3002<br>protocol: https<br>port: 3002<br>ca_location: certs/ca.crt<br>cert_location: certs/server.crt<br>key_location: certs/server.key<br>backend_servers:<br> - http://localhost:8080<br> - http://localhost:8081<br>waf:<br> allowedIPs:<br> - 10.0.0.0/8<br> - 192.168.1.0/24<br> - 172.16.0.0/12<br> - 127.0.0.1<br> allowedPorts:<br> - 80<br> - 443<br> - &quot;*&quot;</pre><p>Yes, it even has a mini WAF!</p><p>4. Run the Backend Servers These servers will receive traffic from the load balancer make run_backend_servers, The load balancer terminates TLS and forwards the request to these local backends.</p><p>5. Run the TCP Proxy This is a very simple network-level proxy that forwards raw bytes and doesn’t parse or inspect HTTP/TLS make run_tcp_proxy</p><p>The traffic now flows like this:</p><p>client → TCP Proxy → Application Load Balancer → Backend Servers</p><h3>Stress Testing the Load Balancer</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nXfIDKPeYZAgD4QM.png" /></figure><p>Once everything was in place, I ran a stress test to see how the application load balancer performs under pressure.</p><p>the tool used for stress testing is k6 by grafana</p><h3>Test Configuration</h3><ul><li>500 concurrent virtual users</li><li>61,065 total requests</li></ul><h3>Results Summary</h3><ul><li>99% of requests completed under 9.76ms</li><li>Average latency: 12.73ms</li><li>Failure rate: 0.02% (15 failed requests)</li><li>Longest request: 27.43 seconds</li></ul><p>Despite the low failure rate and fast response times for most requests, a few outliers took significantly longer than expected. That’s something I’ll be debugging next.</p><p>I also encountered this error during the test, i’m super curious to debug it</p><p>stream error: stream id 203; INTERNAL_ERROR; received from peer</p><p>This occurred under high load</p><h3>Next Steps</h3><ul><li>Investigate the outliers and 27-second response time</li><li>Debug the INTERNAL_ERROR under HTTP load</li><li>Improve load balancer error handling and timeout policies</li></ul><h3>Final Thoughts</h3><p>This project has been a rewarding way to explore core infrastructure principles while writing real code. If you’re interested in systems programming, networking, or just enjoy breaking your own tools under load, building something like this from scratch is well worth it.</p><p>And if you’re testing performance, definitely give k6 a try. It’s simple, scriptable, and integrates well with CI/CD or developer workflows.</p><h3>Github repo</h3><p><a href="https://github.com/youcefguichi/infra-for-fun-with-golang">https://github.com/youcefguichi/infra-for-fun-with-golang</a></p><p><em>Originally published at </em><a href="https://www.crashloop.sh/blog/go-project-loadbalancer-tcp-proxy-mtls-stress-testing"><em>https://www.crashloop.sh</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f0a8ee871511" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I created my own diff cli in GO !]]></title>
            <link>https://medium.com/@crashloop/i-created-my-own-diff-cli-in-go-4f3090baf684?source=rss-5fb577d9f9e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/4f3090baf684</guid>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[git]]></category>
            <dc:creator><![CDATA[./Crashloop.sh]]></dc:creator>
            <pubDate>Sat, 29 Mar 2025 20:25:12 GMT</pubDate>
            <atom:updated>2025-03-29T20:33:14.586Z</atom:updated>
            <content:encoded><![CDATA[<h3>I created my own diff cli in GO!</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ri_5DWRiAr1LsaWxSPCnIQ.png" /></figure><p>I recently tackled one of John Crickett’s challenges: creating my own `diff` tool. It was a pleasant learning and problem-solving experience.</p><p>The most enjoyable part for me was implementing the context lines feature, so I will focus on that. While implementing the LCS (Longest Common Subsequence) algorithm was more research oriented, it was equally rewarding.</p><p><strong>The Challenge with Context Lines</strong></p><p>Adding context lines wasn’t a requirement of the challenge, but I was curious and decided to include it.</p><p>Initially, I thought I could calculate the context lines for each change independently. However, this approach failed when consecutive changes were closer than the context interval. For example, consider these changes:</p><p>- Change at line 1<br>- Change at line 3</p><p>With a context depth of 2, the context for each change would be:</p><p>- Line 1: `ctxstart=0`, `ctxend=3`<br>- Line 3: `ctxstart=1`, `ctxend=6`</p><p>Using my initial approach, I would display lines `0–3` for the first change. For the second change, the `ctxstart` would need to be at least `4` to avoid duplicate context lines. This would result in the context for line 3 being `4–6`, which skips the actual change at line 3. Clearly, this wasn’t the right approach.</p><p><strong>The Solution: Merging Overlapping Indices</strong></p><p>To solve this, I decided to merge overlapping indices. In the example above, the context lines for line 1 and line 3 overlap, so the combined context should be `0–6`. This ensures no information is lost.</p><p>It took a few unit tests to get it working correctly, but the result was worth it.</p><p><strong>Your Thoughts?</strong></p><p>How would you solve this problem? Do you have a better approach?</p><p>BTW, did you notice? This story is short. 😄</p><p><strong>Solution</strong>: https://github.com/youcefguichi/gdiff</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4f3090baf684" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Is Tracking Possible for Hackers Using Dump Load Balancers?]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://blog.devops.dev/is-it-possible-to-track-a-hacker-13842a271d10?source=rss-5fb577d9f9e2------2"><img src="https://cdn-images-1.medium.com/max/1792/1*d4SffGDn1-S_D2LdRBhX2g.png" width="1792"></a></p><p class="medium-feed-snippet">Demystifying layer 4, layer 7 load balancers, proxy mode and how you can preserve your client ip.</p><p class="medium-feed-link"><a href="https://blog.devops.dev/is-it-possible-to-track-a-hacker-13842a271d10?source=rss-5fb577d9f9e2------2">Continue reading on DevOps.dev »</a></p></div>]]></description>
            <link>https://blog.devops.dev/is-it-possible-to-track-a-hacker-13842a271d10?source=rss-5fb577d9f9e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/13842a271d10</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[./Crashloop.sh]]></dc:creator>
            <pubDate>Sat, 26 Oct 2024 19:56:01 GMT</pubDate>
            <atom:updated>2024-10-28T19:08:16.532Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[OAuth 2.0: Easier Than Deciding What to Order for Dinner!]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@crashloop/oauth-2-0-easier-than-deciding-what-to-order-for-dinner-6404aeee0290?source=rss-5fb577d9f9e2------2"><img src="https://cdn-images-1.medium.com/max/2412/1*LbcgupAIxKE1emAiJOgIDA.png" width="2412"></a></p><p class="medium-feed-snippet">I have split this blog into 3 parts to keep things digestible (and to save your scrolling thumb some pain).</p><p class="medium-feed-link"><a href="https://medium.com/@crashloop/oauth-2-0-easier-than-deciding-what-to-order-for-dinner-6404aeee0290?source=rss-5fb577d9f9e2------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@crashloop/oauth-2-0-easier-than-deciding-what-to-order-for-dinner-6404aeee0290?source=rss-5fb577d9f9e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/6404aeee0290</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[./Crashloop.sh]]></dc:creator>
            <pubDate>Thu, 24 Oct 2024 10:05:34 GMT</pubDate>
            <atom:updated>2024-10-24T10:06:07.847Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Oauth 2.0: Authorization Process]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://blog.devops.dev/oauth-2-0-easy-explained-part-2-e3cab2db22ae?source=rss-5fb577d9f9e2------2"><img src="https://cdn-images-1.medium.com/max/2600/1*0Xvlic9PkOwQigiM-IOxYw.png" width="6192"></a></p><p class="medium-feed-snippet">In Part 1, I walked you through the basic concepts of OAuth 2.0 using a simple example from my own GitHub setup.</p><p class="medium-feed-link"><a href="https://blog.devops.dev/oauth-2-0-easy-explained-part-2-e3cab2db22ae?source=rss-5fb577d9f9e2------2">Continue reading on DevOps.dev »</a></p></div>]]></description>
            <link>https://blog.devops.dev/oauth-2-0-easy-explained-part-2-e3cab2db22ae?source=rss-5fb577d9f9e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/e3cab2db22ae</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[oauth]]></category>
            <dc:creator><![CDATA[./Crashloop.sh]]></dc:creator>
            <pubDate>Tue, 22 Oct 2024 20:47:55 GMT</pubDate>
            <atom:updated>2024-10-24T10:11:11.155Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Oauth 2.0 Easy Explained Part 1]]></title>
            <link>https://medium.com/@crashloop/oauth-2-0-easy-explained-part-1-185d93073381?source=rss-5fb577d9f9e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/185d93073381</guid>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[./Crashloop.sh]]></dc:creator>
            <pubDate>Tue, 22 Oct 2024 09:58:48 GMT</pubDate>
            <atom:updated>2024-10-24T10:13:16.861Z</atom:updated>
            <content:encoded><![CDATA[<h3>Oauth 2.0: Resource Server Vs Resource Owner</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gzQLX2qoJw-LxERVdIvGng.png" /></figure><p>When I first started learning about OAuth, I struggled to understand it from just a few blog posts. I had to explore multiple resources before I could fully answer all my questions.</p><p>With that in mind, this blog post will take you through the concepts step by step, building your understanding piece by piece.</p><p>Let’s get started!</p><h3>Resource Owner</h3><p>Alright, I have a personal github account and a repository called my-awesome-app, i’m enjoying coding the app and each day i push my progress to github to my reposiory.</p><p>Do i own the repository? Yes. Do i have the authority to grant or deny access to it? Yes. So i identify as the resource owner in the Oauth world.</p><p>That’s it!</p><p>What’s up with the resource server then?</p><h3>Resource Server</h3><p>I’m pushing my code to a remote repository called my-awesome-app, which is hosted on GitHub. This makes GitHub the resource server, where the code is stored.</p><p>So far, it’s simple, what’s next?</p><p>Let’s say you no longer want to manually push your code and instead want to automate the process.</p><p>As the resource owner, you need to grant the external tool permissions to push the code to your repository, which is hosted on GitHub, the resource server.</p><p>You have access to your repository because you have an account on github, but how can we allow the tool to access GitHub? You might think of sharing your email and password, but this would give the tool full access to everything, including other repositories, potentially leading to unintended actions since it would have the same permissions as you.</p><p>Let’s see how OAuth solves this problem!</p><p>Onward!</p><blockquote><a href="https://medium.com/devops-dev/oauth-2-0-easy-explained-part-2-e3cab2db22ae"><em>Click here </em></a><em>for part 2 …</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=185d93073381" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kubernetes and Tailscale: What Are Your Options?]]></title>
            <link>https://blog.devops.dev/kubernetes-and-tailscale-what-are-your-options-f4f173a431e1?source=rss-5fb577d9f9e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/f4f173a431e1</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[vpn]]></category>
            <dc:creator><![CDATA[./Crashloop.sh]]></dc:creator>
            <pubDate>Wed, 11 Sep 2024 20:30:45 GMT</pubDate>
            <atom:updated>2024-10-23T14:10:14.165Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Hj-muc9zEuo7ICG2LxmCFw.png" /></figure><p>Today we’ll show you, How to Lock down your Kubernetes API server so it’s not waving at strangers on the internet, How to keep your internal services truly internal and secure, How can Tailscale act as an identity provider and How to Limit users access with Tailscale.</p><p>Ready to make your Kubernetes experience smoother and more secure?</p><p>Let’s dive in!</p><h3>Secure Your Cluster API Server from Public Access</h3><p>Did you know that 1.6 million Kubernetes clusters are publicly accessible? You can check the numbers <a href="https://www.shodan.io/search?query=Kubernetes">here</a></p><p>Tailscale offers a way to limit access to the Kubernetes API server to specific people or services.</p><p>But first you would need to get rid of that public ip that is pointing to your cluster api server.</p><blockquote>FYI:<br>if you’re using AKS for example, you’ll need to create a private cluster from the start. AKS doesn’t allow switching from a public to a private cluster after creation, so don’t set up Tailscale thinking you can just flip a switch to disable public access later, there isn’t one. If you’re using a different provider, make sure to check their documentation concerning switching from a public to a private cluster.</blockquote><p>Alright let’s say now your api server is private, we can deploy a tailscale operator, which will act as a reverse proxy server, all the traffic coming from tailscale users, will go through the tailscale kubernetes operator, the later will forward traffic to default kubernetes api service.</p><p>To setup th tailscale operator check their official page they have a very clear instructions. <a href="https://tailscale.com/kb/1236/kubernetes-operator">tailscale kubernetes operator</a></p><h3>Expose internal services internally</h3><p>Let’s say you have a grafana instance deployed, and you would like to give access to the developers team, so they can debug their application. How are they gonna do that?</p><ol><li>I can assume that they already have access to the cluster, and then they will port-forward the grafana service locally.</li><li>Or there is an ingress entry with a public endpoint that points to grafana service.</li><li>Maybe some other way ..</li></ol><p>The first option, sounds neither practical nor a smooth operation, and you have to onboard developers on how to port-forward to there laptops, and also assist them whenever the port-forwad failed.</p><p>Come to the second option, great! Grafana is accessible directly under a public endpoint, but why would we expose grafana publically, while we only need it internally?</p><p>Tailscale offer a simple way to expose your services to your tailnet users, via the following annotation:</p><pre>apiVersion: v1<br>kind: Service<br>metadata:<br>  name: grafana<br>  annotations:<br>    tailscale.com/expose: true</pre><p>That’s it! Go to your tailscale account, browse machines and you will see grafana with a dns name that looks like grafana.tailxxx.ts.net.</p><h3>DNS, Https and TLS Certificates</h3><p>Tailscale’s Magic DNS feature simplifies managing DNS and TLS certificates for your local services. Instead of manually handling DNS entries or setting up complex certificate management processes, Magic DNS automatically assigns domain names to your local services based on their Tailscale identity. This greatly simplifies the process of accessing local services securely, even across different environments.</p><p>Magic DNS also integrates with Let’s Encrypt to automatically issue TLS certificates, ensuring that all traffic between your services is encrypted. This approach reduces the operational overhead of managing DNS and certificates while enhancing security for internal communications.</p><h3>Tailscale as an Identity Provider</h3><p>Tailscale can be used as an identity provider for your Kubernetes clusters, and it operates on two modes when using the tailscale kubernetes operator.</p><h4>Auth mode</h4><blockquote><em>In auth mode, requests from the tailnet proxied over to the Kubernetes API server are additionally impersonated using the sender’s tailnet identity. Kubernetes RBAC can then be used to configure granular API server permissions for individual tailnet identities or groups — tailscale docs</em></blockquote><p>Meaning that the users when they perform kubectl operations, the requests goes through the tailcae operator (which act as the api server proxy), the latter will impersonate your identity and forward the request to the kubernetes api claiming that it is you who did the request.</p><p>and then to make sure that the user doesn’t do more than he should, we can rbac your tailscale identity to be able to do only what you should be able to do.</p><p>For more details you can check users impersonation on kubernetes docs <a href="https://kubernetes.io/docs/reference/access-authn-authz/authentication/#user-impersonation">here</a></p><p>Example on how to set the auth mode to true on the tailscale helm chart:</p><pre>values:<br>  apiServerProxyConfig:<br>    mode: &quot;true&quot;</pre><h4>Noauth mode</h4><blockquote>In noauth mode, requests from the tailnet will be proxied over to the Kubernetes API server but not authenticated. This mechanism can be combined with another authentication/authorization mechanism, such as an authenticating proxy provided by an external IDP or a cloud provider- tailscale docs</blockquote><p>If you already have an IDP, like let’s say microsoft entra id, then you can still leverage it, and tailscale in this case will just proxy traffic to your api server.</p><h3>ACL Your Users</h3><p>Tailscale allows you to define ACLs for users accessing your Kubernetes clusters, ensuring that only authorised users can access specific resources or perform specific actions.</p><p>You can easily configure ACLs in Tailscale’s admin console to control which users have access to certain clusters, services, or resources.</p><p>For example group beta can only access the staging-cluster</p><pre>{<br>    &quot;acls&quot;: [<br>    {<br>        &quot;action&quot;: &quot;accept&quot;,<br>        &quot;src&quot;: [ &quot;group:beta&quot; ], // These sources (devices or users)<br>        &quot;dst&quot;: [ &quot;tag@staging-cluster&quot; ], // can access these destination devices on their defined ports<br>    }<br>  ]<br>}</pre><h3>Conclusion</h3><p>Integrating Tailscale with Kubernetes offers numerous benefits, from securing your API server to simplifying service exposure between clusters and improving authentication. By leveraging features like Magic DNS, TLS certificates, and access control, you can create a more secure, manageable, and efficient Kubernetes environment.</p><p><em>Originally published at </em><a href="https://www.biznesbees.com/blog/tailscale-and-kubernetes-what-are-your-options">https://www.biznesbees.com/blog/tailscale-and-kubernetes-what-are-your-options</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f4f173a431e1" width="1" height="1" alt=""><hr><p><a href="https://blog.devops.dev/kubernetes-and-tailscale-what-are-your-options-f4f173a431e1">Kubernetes and Tailscale: What Are Your Options?</a> was originally published in <a href="https://blog.devops.dev/">DevOps.dev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Is Your Container’s Root Acting a Bit More Rooty than It Should?]]></title>
            <link>https://blog.devops.dev/is-your-containers-root-acting-a-bit-more-rooty-than-it-should-41e9269e8bca?source=rss-5fb577d9f9e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/41e9269e8bca</guid>
            <category><![CDATA[containers]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[./Crashloop.sh]]></dc:creator>
            <pubDate>Mon, 10 Jun 2024 20:18:44 GMT</pubDate>
            <atom:updated>2024-06-12T18:08:12.443Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mi8UHQOjsvcy9KiXiNQHRA.png" /></figure><p>Today, we take you on a free of charge tour in the world of user namespaces in Docker containers. If you want to know how containers manage users and permissions, you are in the right place. So, buckle up, and most importantly, put on your shades, cause it is about to be LIT!</p><h3>What Are User Namespaces?</h3><p>Think of user namespaces as a magic spell that transforms how we see user IDs (UIDs) and group IDs (GIDs) inside a container.</p><p>User namespaces are a linux kernel feature. It can be viewed as a form of isolation, where processes within a user namespace do not have any privileges outside of it.</p><p>Processes can run as a root UID:0 inside a usernamespace. They will serve the purpose that some processes may need root capabilities to do certain tasks.</p><p>Alright, but then who is that “root” inside my usernamespace? Well, it is just a random superhero who comes to the realization that he can’t do much outside of his little bubble. So, outside of usernamespace it is a non root user, for example, UID: 10001!<em> cue sad music</em>.</p><h3>Why Should We Care?</h3><p>User namespaces add an extra layer of security. By mapping container users to less-privileged host users, we reduce the risk of someone wreaking havoc on the host system if they break out of the container.</p><p>you can read more about the vulnerabilities that usernamespaces mitigated <a href="https://github.com/kubernetes/enhancements/tree/217d790720c5aef09b8bd4d6ca96284a0affe6c2/keps/sig-node/127-user-namespaces#motivation">here</a></p><h3>The Magic of Mapping Users</h3><p>Now, let’s get our hands dirty with a bit of Docker wizardry. Imagine you have a Docker container running an application, and you want to map the root user inside the container to a non-root user on the host. Here’s how you can do it:</p><p>Enable User Namespace Remapping: First, you need to enable user namespace remapping in Docker. This is usually done by editing the Docker daemon configuration file /etc/docker/daemon.json and adding the following lines:</p><pre>{ &quot;userns-remap&quot;: &quot;default&quot; }</pre><p>Save and then restart docker sudo systemctl restart docker</p><p>Docker will automatically configure subordinate UID and GID mappings for us under /etc/subuid and /etc/subgid files.</p><p>Let’s go together through the content of those two files:</p><pre>cat /etc/subuid<br>dockremap:165536:65536</pre><pre>cat /etc/subgid<br>dockremap:165536:65536</pre><p>What we see is that docker will map users from our containers, first user is 165536 which will correspond to UID 0 in the docker container, second user will be 165537 which coresspond to UID 1 .. etc and we can have up to a total of 65536 users.</p><h3>Maybe a Little Fun experiment?</h3><p>Let’s create a container using docker docker run --name nginx -d nginx</p><p>Now that our container is running in the background we access it and see what we have!</p><pre>➜ docker exec -it nginx bash<br> root@8c9e45d0f244: id uid=0(root) gid=0(root) groups=0(root)</pre><p>We see that nginx is running as root! Without our previous configuration, this would be the actual root on the host system!!So, what about now?</p><pre>➜ ps aux<br> USER   PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND<br> 165536 2055858 0.0 0.0 11400 7296 ? Ss 08:41 0:00 nginx: master process nginx -g daemon off;</pre><p>As we see in the host machine, nginx is running as 165536</p><h3>kubernetes 1.30</h3><p>On the latest kubernetes version 1.30, kubernetes’ team addresses this issue by making the configuration available on k8s itself, therefore, you do not need to go all the way and configure your container runtime.</p><p>Finally, you can simply opt in user namespaces mapping by setting pod.spec.hostUsers to false</p><p><em>Originally published at </em><a href="https://www.biznesbees.com/blog/usersamespaces-with-docker-and-kubernetes"><em>https://www.biznesbees.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=41e9269e8bca" width="1" height="1" alt=""><hr><p><a href="https://blog.devops.dev/is-your-containers-root-acting-a-bit-more-rooty-than-it-should-41e9269e8bca">Is Your Container’s Root Acting a Bit More Rooty than It Should?</a> was originally published in <a href="https://blog.devops.dev/">DevOps.dev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Experiment with LLMs: Deploy a Llama3-Powered Chatbot onto Kubernetes on your Laptop!]]></title>
            <link>https://blog.devops.dev/experiment-with-llms-deploy-a-llama3-powered-chatbot-onto-kubernetes-on-your-laptop-a9b55fdfabfb?source=rss-5fb577d9f9e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/a9b55fdfabfb</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[llama-3]]></category>
            <dc:creator><![CDATA[./Crashloop.sh]]></dc:creator>
            <pubDate>Mon, 20 May 2024 08:21:01 GMT</pubDate>
            <atom:updated>2024-10-23T14:08:27.027Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UET7KQDmX_z4GYkgQ3yplg.png" /></figure><p>In this blog post, we gonna run through how you can deploy your ml workloads on kubernetes and enable GPU acceleration for it.</p><p>The diagram above shows a fun, at home experiment using nothing but ollama and your trusty dusty laptop.</p><p>Before we dig into the practical part, we want to explore what’s happening under your kubernetes cluster. Some of us are always curious how things are handled behind the scenes. So, let us give you a VIP tour,</p><p>Shall we ?</p><h3>What is Container Runtime</h3><p>Container runtime, in a nutshell, is the piece of software that is responsible for executing containers and managing their lifecycle.</p><p>Container runtime handles tasks such as pulling container images, creating, starting containers, and managing the resources and isolation for each container.</p><p>Alright,with that said, what is the relation between your cluster, your pod, and the container runtime?</p><p>Patience, we are getting there in a moment!</p><h3>Kubelet, Pod, CRI and Container Runtime</h3><p>When you deploy your pod to your cluster, the kubelet (<strong><em>kubelet is a core component on kubernetes that is responsible for the whole pod lifecycle</em></strong>) will receive the pod spec from the cluster’s API server.</p><p>In the podspec, we will have info like image, right? let&#39;s say the image is nginx, kublet will post a request to the container runtime to run a nginx image. How does kublet communicate with the container runtime? it uses what is called CRI (Container Runtime Interface).</p><p>CRI, is a standard api that allows kubelet to interact with the container runtime in a consistent manner.</p><p>After the kubelet submit the request to CRI, the container runtime will pull the image and run it based on the specification sent by the kubelet. Then, the kublet will receive back the status from the container runtime through CRI and display it. This means that the pod is running successfully and kublete can send termination requests and restarts .. etc</p><p>Does container runtime, like containerd, have the capabilities to use GPU natively? the simple answer is, No! Then, how do you enable GPU access to your workloads?</p><h3>What is Nvidia Container Runtime ?</h3><p>Nvidia Container Runtime is an extension that has capabilities of accessing GPU resources on the host machine. It serves as a wrapper for the container runtime. So, when your workload is running inside standard container runtime like containerd, it requests GPU acceleration. The extension will allow the container runtime to use the provided GPUs in the host machine.</p><p>can you guess the main character of this short story? you got it! it is container runtime, again!</p><p>Now, let us get our hands dirty, shall we?</p><h3>Cluster Setup</h3><p>First, we have to install nvidia container toolkit. It has nvidia container runtime along with other packages that provide access to GPUs. For k3s case, it uses conatinerd as the default container runtime.</p><p>Please check the official nvidia docs on how you can install the nvidia container toolkit, and configure it with containerd -&gt; <a href="https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html">installation</a></p><p>Alright, now we can spin up our cluster. We chose to use k3s for this blog post, the installation is a one liner as follows:</p><p>curl -sfL https://get.k3s.io | sh -</p><p>Test if the cluster is up and running</p><pre>➜  sudo k3s kubectl get nodes<br>NAME      STATUS   ROLES                  AGE   VERSION<br>node-01   Ready    control-plane,master   15d   v1.29.4+k3s1</pre><p>If you want to get rid of the sudo k3s you can do the following:</p><pre>sudo chmod 644 /etc/rancher/k3s/k3s.yaml<br>export KUBECONFIG=/etc/rancher/k3s/k3s.yaml<br>kubect get nodes</pre><p>Yay!! our cluster is ready!</p><h3>Deploy Ollama as a central llm-manager</h3><p>Ollama is a new project that allows you to use llms like llama3 on your local computer. It is optimized for CPUs as well, and it automatically chooses the perfect fit for your workloads. In case your GPU memory is not enough, it will switch automatically to use CPU.</p><p>deploy with onechart</p><pre>helm repo add onechart https://chart.onechart.dev &amp;&amp; helm repo update<br>helm install llm-manager onechart/onechart \<br> --set image.repository=ollama/ollama \<br> --set image.tag=latest \<br> --set containerPort=11434 \<br> --set podSpec.runtimeClassName=nvidia</pre><p>Ollama expose port 11434 by default, we also set the runtimeClassName to nvidia to benefit from the nvidia container runtime for GPU acceleration workloads.</p><pre>➜ kubectl get po,svc | grep llm-manager<br>pod/llm-manager-665765c8df-8pnz7 1/1 Running 3 (5h19m ago) 39h<br>service/llm-manager ClusterIP 10.43.240.248 &lt;none&gt; 80/TCP 4d22h</pre><p>If we check the logs, we will see that ollama will detect a GPU if you have one. In our case, it is an NVIDIA GeForce RTX 2060.</p><pre>➜ kubectl logs llm-manager-665765c8df-8pnz7<br> time=2024-05-19T07:34:34.379Z level=WARN source=amd_linux.go:163 msg=&quot;amdgpu too old gfx000&quot; gpu=0<br> time=2024-05-19T07:34:34.379Z level=INFO source=amd_linux.go:311 msg=&quot;no compatible amdgpu devices detected&quot;<br> time=2024-05-19T07:34:34.379Z level=INFO source=types.go:71 msg=&quot;inference compute&quot; id=GPU-2607f162-ae64-a3c2-13dc-0fe25020d136 library=cuda compute=7.5 driver=12.4 name=&quot;NVIDIA GeForce RTX 2060&quot; total=&quot;5.8 GiB&quot; available=&quot;5.7 GiB&quot;</pre><p>For the next step, we will create a client pod that will interacts with the llm-manager.</p><h3>Setup a Chatbot Powered by llama3 and Gradio</h3><p>We already created a simple python code and packaged it under ghcr.io/biznesbees/chatbot-v0.1.0.</p><p>Please refere to the source code here: <a href="https://github.com/biznesbees/deploy-gpu-based-ml-workloads-to-k8s">github/chatbot-v0.1.0</a></p><p>What this image do?</p><ul><li>It run a web interface powered by gradio</li><li>It will post a request for the llm-manager to pull a certain llm model if it is not available</li><li>Post text inputs</li><li>Receive answers from the chosen llm</li></ul><p>Let’s deploy our chatbot and start doing some magic!</p><pre>helm install chatbot onechart/onechart \<br> --set image.repository=ghcr.io/biznesbees/chatbot-v0.1.0 \<br> --set image.tag=latest \<br> --set vars.OLLAMA_HOST=http://llm-manager </pre><p>The code anticipates an env var OLLAMA_HOST set to the llm-manager address since the chatbot will send requests there!</p><p>Let’s port forward the chatbot to our local machine and access it through the browser.</p><pre>➜ kubectl port-forward svc/chatbot 8080:80<br> Forwarding from 127.0.0.1:8080 -&gt; 80<br> Forwarding from [::1]:8080 -&gt; 80</pre><p>I think we are ready to test our chatbot baby!!</p><h3>Run Experiments</h3><p>Alright, we gonna perform two experiments:</p><h3>1. qwen:0.5b</h3><p>As you see, we specified the Qwen Model with half billion parameters, When we hit submit, the llm-manager will download the model first if it doesn’t exist.</p><p>We can check the logs of the llm manager</p><pre>➜ kubectl logs llm-manager-665765c8df-8pnz7<br> time=2024-05-19T13:45:50.851Z level=INFO source=download.go:136 msg=&quot;downloading fad2a06e4cc7 in 4 100 MB part(s)&quot;<br> time=2024-05-19T13:47:15.893Z level=INFO source=download.go:136 msg=&quot;downloading 41c2cf8c272f in 1 7.3 KB part(s)&quot;<br> time=2024-05-19T13:47:19.053Z level=INFO source=download.go:136 msg=&quot;downloading 1da0581fd4ce in 1 130 B part(s)&quot;<br> time=2024-05-19T13:47:22.141Z level=INFO source=download.go:136 msg=&quot;downloading f02dd72bb242 in 1 59 B part(s)&quot;<br> time=2024-05-19T13:47:25.217Z level=INFO source=download.go:136 msg=&quot;downloading ea0a531a015b in 1 485 B part(s)&quot;</pre><p>After the download completes, we will get an answer from the qwen model as you see in the image; and it will use the provided GPU.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PVpxjTXvNcbfcnxK.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0CRd0X80zdF_ceah.png" /></figure><p>to check GPU usage type nvidia-smi</p><pre>➜ nvidia-smi<br> Processes:                                                                              |<br>|  GPU   GI   CI        PID   Type   Process name                              GPU Memory |<br>|        ID   ID                                                               Usage      |<br>|=========================================================================================|<br>|    0   N/A  N/A    348592      C   ...unners/cuda_v11/ollama_llama_server        942MiB |</pre><h3>2. llama:8b</h3><p>Second option is to use llama3 with 8 billion parameters, since the GPU provided can’t handle llama:8b, it will optimize the inference to use CPU.</p><p>We gonna replicate the same process, but this time, we gonna check CPU usage at inference time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1010/0*Arh1tpcpks9h0N8s.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/846/0*xQsrgYYa6IAXqNUW.png" /></figure><p>You can check the CPU usage with the top command and you will notice a huge increase in CPU utilisation.</p><pre>➜ top<br>PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND <br>407091 root      20   0 5736224   4,7g   4,3g R 776,3  31,3  16:37.00 ollama_llama_se</pre><h3>Conclusion</h3><p>On this blog post, we saw how we can easily deploy llm models with ollama and kubernetes. Also, we saw how to enable GPUs to accelerate workloads.</p><p><em>Originally published at </em><a href="https://www.biznesbees.com/blog/deploy-llama3-powered-chatbot-on-kuberentes-using-only-your-laptop"><em>https://www.biznesbees.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a9b55fdfabfb" width="1" height="1" alt=""><hr><p><a href="https://blog.devops.dev/experiment-with-llms-deploy-a-llama3-powered-chatbot-onto-kubernetes-on-your-laptop-a9b55fdfabfb">Experiment with LLMs: Deploy a Llama3-Powered Chatbot onto Kubernetes on your Laptop!</a> was originally published in <a href="https://blog.devops.dev/">DevOps.dev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>