<?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 Paulo Kieffer on Medium]]></title>
        <description><![CDATA[Stories by Paulo Kieffer on Medium]]></description>
        <link>https://medium.com/@paulokieffer?source=rss-f86db3fc72e1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*AFN6pLtJGrmgULTC</url>
            <title>Stories by Paulo Kieffer on Medium</title>
            <link>https://medium.com/@paulokieffer?source=rss-f86db3fc72e1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 12:31:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@paulokieffer/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[Go serverless in Kubernetes with Knative]]></title>
            <link>https://medium.com/ilegra/go-serverless-in-kubernetes-with-knative-596db906c96a?source=rss-f86db3fc72e1------2</link>
            <guid isPermaLink="false">https://medium.com/p/596db906c96a</guid>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[knative]]></category>
            <dc:creator><![CDATA[Paulo Kieffer]]></dc:creator>
            <pubDate>Thu, 24 Oct 2019 14:20:04 GMT</pubDate>
            <atom:updated>2019-10-29T23:07:39.340Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/735/0*Y3kq482yZmvDZrZK.png" /></figure><p><strong>What the fucking Knative is?</strong></p><p>Knative is an open-source project set up by engineers from Google, Pivotal, and other industry leaders. <br>It’s a collection of components that extends Kubernetes with focus on managing cloud services such as creating pods, auto-scaling, blue/green deploy and networking, making our lives simpler when coding serveless functions.</p><h3>Advantages over other frameworks</h3><p>In my research, Knative was the most complete framework when considering topics just like installation, implementation, configuration and <br>its mainly features: auto-scaling (including scale to zero) and blue/green deploy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/934/1*tNFSAGFqDFB9u7SnA11F7w.png" /><figcaption>Others serveless frameworks</figcaption></figure><h3>Installing Knative</h3><p>You can get some samples of how to install Knative in minikube and different cloud providers such as Google, Azure, Ibm, on this link:</p><p><a href="https://knative.dev/docs/install/">https://knative.dev/docs/install/</a></p><h3><strong>Knative components</strong></h3><p><strong>Build</strong>: Responsible for creating and managing containers. We only provide the code and Knative Build looks after the rest.</p><p>In others words, it allows you to define a process that runs to completion and can provide status. For example, fetch, build, and package your code by using a Knative Build which communicates whether the process succeeds.</p><p><strong>Serving</strong>: Responsible for deploying HTTP applications like AWS Lambda.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/0*_U1KDuzsIIhGVs3C.png" /></figure><p><strong>Eventing</strong>: Responsible for building event-driven applications.</p><p>Obs.: When this post has written only Google Cloud Scheduler, Google Cloud Storage and Kubernetes were active development, the others were just proof of concept.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hy_JADbfKQWuWS_pVb5oTw.png" /></figure><h3>Let’s code</h3><p>In this quick example, we are going to make up a simple function with Go in order to say hello to the world 😁. (for this example I’ve used minikube as a cluster)</p><ol><li>Creating a helloworld.go file:</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/494/1*-pxQRMioooQ6hy7HTGQYWw.png" /></figure><p>2. Creating a Dockerfile</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/649/1*nlnC7R7fi8zoJmrVHpyXiQ.png" /></figure><p>3. Creating a service.yaml</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/420/1*ZOMcQhvQGYx2Lpd-qNTvtQ.png" /></figure><p>4. Building and deploying</p><pre>docker build -t paulokrj/helloworld-go .<br>docker push paulokrj/helloworld-go</pre><p>5. Deploying the app</p><pre>kubectl apply --filename service.yaml</pre><p>6. Checking the pods</p><p>Before executing the request we can see there isn’t any pods.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/516/1*ThfZFYkYlJhO2suZb9BvdA.png" /><figcaption>kubectl get pods</figcaption></figure><p>7. Executing</p><p>Now you can do a simple request to helloworld-go.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/1*IMR5C48S6POQ260U5Q2KZw.png" /></figure><p>8. Checking active pods</p><p>Now if we execute the command ‘kubectl get pods’, it will show up the helloworld-go pod which was just been created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/586/1*jVQSMmFwXqYajXbpaV0qMw.png" /></figure><p>9. The pod is over</p><p>After 90 seconds without requests, the Knative will scale our pod to zero.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*3csDa23dg8xqvXRJ22iuyQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/616/1*R9__SMJHyhh6LPY9RWmcUg.png" /></figure><h3><strong>Autoscaler</strong></h3><p>With Knative autoscaler it’s possible to control the number of pods per service, considering two kinds of metrics: concurrency requests and cpu usage.<br>Knative per default uses concurrency requests as metric and after 100 concurrency requests brought a new pod up.</p><p>Talking about default configuration, if you don’t type the rules to scaling, knative will scale to zero when it spends 90 seconds without requests and, to “N” pods, when a lot of requests are brought up.</p><p>You can change this metrics by just typing a comand like the following example:</p><pre>spec:<br>  template:<br>    metadata:<br>      autoscaling.knative.dev/minScale: &quot;2&quot;<br>      autoscaling.knative.dev/maxScale: &quot;10&quot;</pre><p>Another option is to control the scaling by the cpu usage. We just need to change the class of validation and add up the percentage rule:</p><pre>spec<strong>:</strong><br>     template<strong>:</strong><br>       metadata<strong>:</strong><br>         annotations<strong>:</strong><br>           <em># Standard Kubernetes CPU-based autoscaling.</em><br>           autoscaling.knative.dev/class<strong>:</strong> hpa.autoscaling.knative.dev<br>           autoscaling.knative.dev/metric<strong>:</strong> cpu</pre><h3>Removing the service</h3><p>To remove the sample app from your cluster, delete the service record:</p><pre>kubectl delete --filename service.yaml</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=596db906c96a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ilegra/go-serverless-in-kubernetes-with-knative-596db906c96a">Go serverless in Kubernetes with Knative</a> was originally published in <a href="https://medium.com/ilegra">ilegra</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>