<?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 Tom Gallacher on Medium]]></title>
        <description><![CDATA[Stories by Tom Gallacher on Medium]]></description>
        <link>https://medium.com/@tomgco?source=rss-57aa1d99b3ba------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*WqWQET_q3rqP21SG.jpg</url>
            <title>Stories by Tom Gallacher on Medium</title>
            <link>https://medium.com/@tomgco?source=rss-57aa1d99b3ba------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 00:39:27 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tomgco/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[Making the “YLD Happy Police” Slack Bot]]></title>
            <link>https://medium.com/yld-blog/making-the-yld-happy-police-slack-bot-fc8a31078bd5?source=rss-57aa1d99b3ba------2</link>
            <guid isPermaLink="false">https://medium.com/p/fc8a31078bd5</guid>
            <category><![CDATA[slack]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[bots]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[moderation]]></category>
            <dc:creator><![CDATA[Tom Gallacher]]></dc:creator>
            <pubDate>Mon, 08 Jul 2019 13:55:35 GMT</pubDate>
            <atom:updated>2019-07-08T13:55:35.093Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lkU5hSc5nkBLJL-ipwCJkQ.jpeg" /><figcaption>https://www.pexels.com/photo/glass-bottles-on-shelf-1771809/</figcaption></figure><p>Engaging in conversation is one of the core principles when building and maintaining a remote culture! It is then intuitive to say that certain jargon, abuse or harassment, even if not originally said with a malicious intent, stop people from contributing to conversations, or even worse, stop them from engaging altogether, this can also be extended to counter-productive vocabulary such as the use of negatively associated words and poor machine translations. Having something that can provide insight into what others might interpret, especially in a multi-lingual company is a valuable tool, and is a great way to keep the conversations about inclusivity relevant.</p><p>Google’s Jigsaw has been working on this problem for a while, and have built <a href="https://www.perspectiveapi.com/">https://www.perspectiveapi.com</a> to help moderation teams and commenters to get real-time feedback on the quality of their conversations. As part of this project, Jigsaw has been engaging with the Kaggle Data Science community by publishing labelled datasets, which means us mere mortals can now explore and begin to build our own models!</p><p>The model is based on the Jigsaw dataset, which was obtained by asking people to rate internet comments on a scale from “Very toxic” to “Very healthy”. Jigsaw then defined “toxic” as… “a rude, disrespectful, or unreasonable comment that is likely to make you leave a discussion.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/674/1*G1SzoQOkY98JxEPvQqpZjA.png" /><figcaption>We have a #yelling channel, it is great :D And our ML Bot is using Slack reactions!</figcaption></figure><p>We decided to take this dataset as an exercise to see what we could produce with minimal effort, and implement it in a fun an exciting way! As you might have seen in a previous post, we have been using Uber’s Ludwig as a 0 “code” alternative to building ML models. Tensorflow and Keras are great, but they aren’t easy to prototype and teach!</p><p>The first step is to install our dependencies, we are running on GPU instances to speed up learning, but don’t be scared, google provide free GPU machines for ML research at <a href="https://colab.research.google.com/">https://colab.research.google.com</a>! Which is AWESOME!</p><pre>#!/usr/bin/env python3.7</pre><pre>pip install ludwig<br>pip install tensorflow-gpu==1.13.1<br>python -m spacy download en</pre><p>Once installed, our next step is to build a model, this sounds scary, but in essence, we need to declare our inputs in our training dataset and map them to outputs.</p><pre>comment_text,toxic,severe_toxic,obscene,threat,insult,identity_hate</pre><p>Using the header from our training.csv file we can start building and testing models using Ludwig’s YAML configuration format.</p><pre>input_features:<br>  - name: comment_text<br>    type: text<br>    level: word<br>    encoder: parallel_cnn<br>    preprocessing:<br>      lowercase: true</pre><pre>output_features:<br>  - name: toxic<br>    type: binary<br>  - name: severe_toxic<br>    type: binary<br>  - name: threat<br>    type: binary<br>  - name: insult<br>    type: binary<br>  - name: obscene<br>    type: binary<br>  - name: identity_hate<br>    type: binary</pre><p>And in its most simplistic way, this will give you a usable model that we can begin to integrate with!</p><p>As our model is in python, we decided to just go ahead and write the bot in python — and from what you can see from below, it is super simple!</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/60aeb32d85c00300a44073b944315ad3/href">https://medium.com/media/60aeb32d85c00300a44073b944315ad3/href</a></iframe><p>And just like that, we have a slackbot that runs against our model and returns an emoji reaction and the response time? Just over 1 second :D Which I think isn’t too bad for a PoC.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fc8a31078bd5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/yld-blog/making-the-yld-happy-police-slack-bot-fc8a31078bd5">Making the “YLD Happy Police” Slack Bot</a> was originally published in <a href="https://medium.com/yld-blog">YLD Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Machine Learning for Developers]]></title>
            <link>https://medium.com/yld-blog/machine-learning-for-developers-182a9903a118?source=rss-57aa1d99b3ba------2</link>
            <guid isPermaLink="false">https://medium.com/p/182a9903a118</guid>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[beginner]]></category>
            <dc:creator><![CDATA[Tom Gallacher]]></dc:creator>
            <pubDate>Tue, 18 Jun 2019 09:40:05 GMT</pubDate>
            <atom:updated>2019-06-18T09:40:05.462Z</atom:updated>
            <content:encoded><![CDATA[<p>Or knowing the minimum amount so that you can build something…</p><p>Just hearing “Machine Learning”, “Neural Networks”, etc can be exhausting and honestly incredibly confusing to understand, but does it have to be?</p><p>In some respects, it will have to be, as with learning any new subject there is core knowledge that is needed and with ML it is quite steep.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Nk63jNM_K11aeDvW" /><figcaption>Photo by <a href="https://unsplash.com/@chrisliverani?utm_source=medium&amp;utm_medium=referral">Chris Liverani</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Uber has recently released <a href="https://uber.github.io/ludwig/">Ludwig</a> which is “a toolbox built on top of TensorFlow that allows to train and test deep learning models without the need to write code.”</p><p>Fantastic! Now I don’t need to learn to code to produce initial models!</p><p>YLD has just released a new website (<a href="https://www.yld.io/">YLD.io</a> - check it out if you haven’t) which required some of our staff to have their photos taken. After looking at these pictures for the first time, I noticed that they all had the same background, I then thought it would be fun to perform a simple multi-label classification on these pictures! 👩‍🔬</p><h4>What is Multi-Label classification?</h4><p>In essence, it is multiple textual tags applied to an input, in our case we are using an image as an input.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*Lmkvmq3O4oOwmFVtmzFyqQ.jpeg" /><figcaption>Source: MIML Dataset</figcaption></figure><p>Because we are using “<a href="https://searchenterpriseai.techtarget.com/definition/supervised-learning">supervised learning</a>” we need to create our own tags from images, thus supervising the algorithm. If we managed to make something that could create the words and image associations without providing hints, then this will be called “<a href="https://whatis.techtarget.com/definition/unsupervised-learning">unsupervised learning</a>”.</p><p>What this means for me is that I had to manually perform a data entry task on manually adding all of the tags that I thought were correct from the image locations I had in a CSV.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ijUgWWfze5s3Oj4ol9mjdw.png" /></figure><p>These images looked all fairly similar to the picture of me, note that I was not actually in the training set.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/168/1*y0iwtSdTE6yrp8HhzWPszQ.jpeg" /><figcaption>Picture of me</figcaption></figure><p>Once this is sorted, the next step is to “build” a machine learning algorithm. Now I know, this may seem difficult, but with ludwig — it is configuration via a YAML file.</p><pre>input_features:<br>    - name: image_path<br>      type: image<br><br>output_features:<br>    - name: tags<br>      type: set<br>      threshold: 0.8 # Only accept predictions if the<br>                     # probilibility is higher than 80%<br><br>training:<br>  epochs: 500 # Number of times to run a training step<br>  learning_rate: 0.0000001</pre><p>As you can see the input_features key matches up 1–2–1 with our CSV file’s first columnimage_path, and the output_features matches up with our set of tagsin our CSV file.</p><p>The training key is used to tune the training of the dataset, here I have just increased the number of epochs (times to run) and the learning_rate, which is the step size of the <a href="https://en.wikipedia.org/wiki/Stochastic_gradient_descent">algorithm</a>.</p><p>So now we are ready to train, this can take some time, so grab a coffee.</p><pre>ludwig train -mdf model.yaml --data_csv yld.csv</pre><p>Once training has completed, ludwig would’ve created a new folder named “results”, this is where the generated model and parameters are stored. But how do we get values out of this?</p><pre>ludwig predict --model_path results/experiment_run_0/model --data_csv predict.csv</pre><p>This will then generate a new results_0 folder with some new CSV files, which holds the predicted values! For us we want to look at the tags_predictions.csv file.</p><p>Hurrah! After running my predictions we cancat that file and see the predicted tags:</p><pre>&lt;PAD&gt;,background,smile,shirt,glasses,beard<br>glasses,beard<br>longhair,shirt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/168/1*_LTTemNWbXBp_yqWruwJRw.jpeg" /><figcaption>Picture of me</figcaption></figure><p>Now if we wanted to use the input image and overlay the text we can write a small snippet of code to generate something combining the two, and you will get something like this picture of me!</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/17991135bc54347af0618213e512450e/href">https://medium.com/media/17991135bc54347af0618213e512450e/href</a></iframe><p>There are loads of other examples which can easily be used, and these can be found at <a href="https://uber.github.io/ludwig/examples/">https://uber.github.io/ludwig/examples/</a>. If you are struggling to figure out something to apply this to, or if you don’t have enough data you can use <a href="https://www.kaggle.com/c/titanic">https://www.kaggle.com/c/titanic</a> as a dataset and <a href="https://uber.github.io/ludwig/examples/#kaggles-titanic-predicting-survivors">https://uber.github.io/ludwig/examples/#kaggles-titanic-predicting-survivors</a> as the ludwig example.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=182a9903a118" width="1" height="1" alt=""><hr><p><a href="https://medium.com/yld-blog/machine-learning-for-developers-182a9903a118">Machine Learning for Developers</a> was originally published in <a href="https://medium.com/yld-blog">YLD Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Under the  with Kubernetes]]></title>
            <link>https://medium.com/yld-blog/under-the-with-kubernetes-c1ea1a82c61f?source=rss-57aa1d99b3ba------2</link>
            <guid isPermaLink="false">https://medium.com/p/c1ea1a82c61f</guid>
            <category><![CDATA[kubectl]]></category>
            <category><![CDATA[yaml]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[software]]></category>
            <dc:creator><![CDATA[Tom Gallacher]]></dc:creator>
            <pubDate>Mon, 11 Mar 2019 11:44:24 GMT</pubDate>
            <atom:updated>2019-03-11T11:44:24.615Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_KXf6_zBUdCH85tK" /><figcaption>Photo by <a href="https://unsplash.com/@f7photo?utm_source=medium&amp;utm_medium=referral">Michael Longmire</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Ever wanted to know a field in your <a href="https://www.yld.io/speciality/kubernetes/">Kubernetes</a> yaml definition, but found it ridiculously difficult to find out what it means or even how to use it 😥?</p><p>kubectl is to the rescue!</p><p>To get started we can familiarise ourselves with what API resources we have available to use. To do this we can run kubectl api-resources, looking at the output of this command we can start to paint a picture of what resources our cluster is composed of.</p><p>Let’s take the deployment resource as our first example. Interestingly we can see that multiple definitions exist for this resource, once for the API Group extensions and one for apps. We will find out why this is the case later on 🤯!</p><p>So how do we write a yaml definition for this deployment? It’s possible to get examples for the Kubernetes documentation — personally I always find this too difficult to navigate, instead, it is possible to interrogate the API server’s OpenAPI specification using kubectl.</p><p>The command in question is kubectl explain, so let’s give this a whirl 😜!</p><pre>$ kubectl explain deployment</pre><p>This will show us all of the keys that are available to use at the top level!</p><pre>KIND:     Deployment<br>VERSION:  extensions/v1beta1</pre><pre>DESCRIPTION:<br>     DEPRECATED - This group version of Deployment is deprecated by<br>     apps/v1beta2/Deployment. See the release notes for more information.<br>     Deployment enables declarative updates for Pods and ReplicaSets.</pre><pre>FIELDS:<br>   apiVersion   &lt;string&gt;<br>     APIVersion defines the versioned schema of this representation of an<br>     object. Servers should convert recognized schemas to the latest internal<br>     value, and may reject unrecognized values. More info:<br>     <a href="https://git.k8s.io/community/contributors/devel/api-conventions.md#resources">https://git.k8s.io/community/contributors/devel/api-conventions.md#resources</a></pre><pre>kind &lt;string&gt;<br>     Kind is a string value representing the REST resource this object<br>     represents. Servers may infer this from the endpoint the client submits<br>     requests to. Cannot be updated. In CamelCase. More info:<br>     <a href="https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds">https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds</a></pre><pre>metadata     &lt;Object&gt;<br>     Standard object metadata.</pre><pre>spec &lt;Object&gt;<br>     Specification of the desired behavior of the Deployment.</pre><pre>status       &lt;Object&gt;<br>     Most recently observed status of the Deployment.</pre><p>If you really want to dive deep you can add a “recursive” parameter!</p><pre>kubectl explain deployment --recursive</pre><p>But I will omit the output so you can check it out yourself! (Hint: the output is longer than this post 😈)</p><p>Written by <a href="https://twitter.com/tomgco">Tom Gallacher</a> — Staff Engineer at <a href="https://www.yld.io/">YLD.</a></p><h4>Interested in Kubernetes? Read more about it:</h4><ul><li><a href="https://medium.com/yld-engineering-blog/testing-kubernetes-rbac-5e00dc93af8e">Testing Kubernetes RBAC</a></li><li><a href="https://medium.com/yld-engineering-blog/kubernetes-core-concepts-324ea7028c29">Kubernetes: Core Concepts</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c1ea1a82c61f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/yld-blog/under-the-with-kubernetes-c1ea1a82c61f">Under the 🔬 with Kubernetes</a> was originally published in <a href="https://medium.com/yld-blog">YLD Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CPU and I/O performance diagnostics in Node.js]]></title>
            <link>https://medium.com/yld-blog/cpu-and-i-o-performance-diagnostics-in-node-js-c85ea71738eb?source=rss-57aa1d99b3ba------2</link>
            <guid isPermaLink="false">https://medium.com/p/c85ea71738eb</guid>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[engineering]]></category>
            <dc:creator><![CDATA[Tom Gallacher]]></dc:creator>
            <pubDate>Mon, 11 Feb 2019 12:32:58 GMT</pubDate>
            <atom:updated>2019-03-08T18:42:57.173Z</atom:updated>
            <content:encoded><![CDATA[<p>Understanding the performance profile of your <a href="https://www.yld.io/speciality/node-js/">Node.js</a> applications can be a difficult process, particularly while dealing with an ever-changing landscape in an evolving ecosystem.</p><p>In this post, I am going to explore looking at Node.js application performance using tools that are compatible with other programming languages, to provide a cross-language profiling toolset, that can be used on Linux systems with a recent Kernel.</p><p>We will be using a bunch of tools that are part of the Linux Kernel but don’t let that scare you, they are pretty simple once you understand the basics.</p><p>The first tool of the bunch is found in the “linux-tools” package and is suitably named perf, it can also be referred to as perf_events because poor SEO of perf and that the supporting documentation from <a href="http://www.brendangregg.com/perf.html">Brendan Gregg</a> and <a href="http://web.eece.maine.edu/~vweaver/projects/perf_events/">Vince Weaver</a> uses perf_events. In our caseperf_events <a href="https://en.wikipedia.org/wiki/Sample_(statistics)">samples</a> the Linux Kernel to provide a statistically relevant set of data of the runtime of your application without capturing all data points, that would either be too much or even more importantly slow down your application/machine.</p><h3>How to collect performance samples</h3><p>With perf_events available to use, we will now start to capture some data whilst our application is under load.</p><p>I am going to be using <a href="https://nextjs.org/learn/">next.js</a> to build a sample server-side rendered react application, which we will be using to show what these performance profiling tools will uncover.</p><pre>git clone <a href="/service/mailto:git@github.com">git@github.com</a>:tomgco/hello-next-performance.git<br>cd hello-next-performance<br>npm install<br>npm run build <br>NODE_OPTIONS=&quot;--perf-basic-prof --perf-prof-unwinding-info&quot; npm run start</pre><pre># Ready on <a href="http://localhost:3000/">http://localhost:3000</a></pre><p>(Note this might not work for you yet, as I have a PR in progress on the Node.js project to allow those parameters. <a href="https://github.com/nodejs/node/pull/25565">PR #25565</a>)</p><p>Once this application is up and running, you should be able to access it on <a href="http://localhost:3000.">http://localhost:3000</a>. To produce some load on this application we will use an application named <a href="https://artillery.io/">artillery</a> which is a fantastic tool writing user-journey based load tests.</p><pre>artillery quick -r 200 -d 0 <a href="http://localhost:3000/">http://localhost:3000</a></pre><p>So, we now have our application running, and a sustained amount of load (150 arrivals per second), so the next step on our performance journey is to use perf_events to get an understanding of what is happening to it.</p><pre>sudo perf record -F 99 -g -p $(pgrep -f next-start) -- sleep 60</pre><p>Let&#39;s deconstruct the perf command:</p><ul><li>sudo perf record — Record the perf events, ran as sudo as we need to interface with the Linux Kernel.</li><li>-F 99 — Sample the application at this frequency, 99 instead of 100 to minimise <a href="https://stackoverflow.com/a/45471031">lockstep sampling</a></li><li>-g — Enables call-graph sampling, we will use this to make it easier to parse and make pretty graphs!</li><li>-p $(pgrep -f next-start) — Find our node.js applications process id.</li><li>-- sleep 60 Run our record for 60 seconds</li></ul><p>After our command has ran for 60 seconds, we should see some output in our terminal telling us that the perf command has captured data.</p><pre>[ perf record: Woken up 1 times to write data ]<br>[ perf record: Captured and wrote 0.249 MB perf.data (742 samples) ]</pre><p>perf_events should have now created a perf.data file, and the node.js application should’ve created some logs files in the format of isolate-0x*-v8.log as well as some files /tmp/perf-*.map . To get a human readable version of the perf.data file, we can now run another command which will output to a file of our choice.</p><pre>sudo perf script -f --header &gt; stacks.test.$(date --iso-8601)</pre><p>Now we have our raw data, lets use some tools to inspect what we have!</p><h3>FlameScope</h3><p>The first tool which we are looking at is something developed by Netflix which “uses <a href="http://www.brendangregg.com/HeatMaps/subsecondoffset.html">subsecond offset heat maps</a> and <a href="http://www.brendangregg.com/flamegraphs.html">flame graphs</a> to analyze <strong>periodic</strong> activity, <strong>variance</strong>, and <strong>perturbations</strong>.” I found out about this tool on Brendan Gregg’s blog post titled “<a href="http://www.brendangregg.com/blog/2018-11-08/flamescope-pattern-recognition.html">FlameScope Pattern Recognition</a>”.</p><p>Flamescope can be installed by following the instructions found on the Github repository: <a href="https://github.com/Netflix/flamescope">https://github.com/Netflix/flamescope</a> once this is running, it will load any files found within the examples directory within the flamescope folder. We can view what we have been running by copying our stacks.test.xxxx files to the examples directory and investigate it at <a href="http://localhost:5000/">http://localhost:5000</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5AfI0HFXwVbvl9rCXHW6AQ.png" /><figcaption>Our example applications showing an interesting load pattern</figcaption></figure><p>What we can see in the image to our left, is that although the arrivals per second are constant, we still see some variability in load every 5 seconds.</p><p>What could cause this?</p><p>To further investigate, we can drill down into a flamegraph, which should show us what functions are taking up the most time. This is achieved by selecting a range within both the light coloured sections and the darker colour sections.</p><p>What becomes apparent is that in the darker sections we see that our applications is spending much longer in the “sha512_block_data_order_avx2” and the “node::crypto::PBKDF2Job::DoThreadPoolWork” sections. These functions are used by crypto.pbkdf2 to generate hashed passwords. <a href="https://github.com/tomgco/hello-next-performance/blob/master/pages/index.js#L20">https://github.com/tomgco/hello-next-performance/blob/master/pages/index.js#L20</a> Looking in deeper we can see that this application actually changes the strength of the password hash every 5 seconds (why, who knows! :D), explaining the pattern we see in the subsecond heatmap.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VJOleIr26RCfl-O004o-HA.png" /></figure><p>Finally, we can start to pin down some of our applications bottlenecks due to CPU utilisation. However, we all know that Node.js’ real strong point is the asynchronous I/O that it performs. This leads to the main performance impact on Node.js applications, functions that block the event loop.</p><h3>Off-CPU analysis</h3><p>Again I am going to refer back to another Brendan Gregg blog post “<a href="http://www.brendangregg.com/blog/2016-01-20/ebpf-offcpu-flame-graph.html">Linux eBPF Off-CPU Flame Graph</a>”. Off-CPU can be achieved using the same tooling as earlier, but due to having to monitor the scheduler (which scales with load) it can very quickly become a huge overhead (think around a million events a second).</p><p>eBPF overcomes this limitation, for more details why, I recommend you check out the linked post.</p><p>So follow me as we dive into some off-CPU analysis.</p><p>For this example, we are going to take a different application <a href="https://github.com/tomgco/hello-next-performance/tree/io-bottle-neck">https://github.com/tomgco/hello-next-performance/tree/io-bottle-neck</a>, but follow mostly the same procedure.</p><ol><li>Build and run the application with the correct node options — NODE_OPTIONS=&quot;--perf-prof --perf-prof-unwinding-info --perf-basic-prof&quot; npm run start</li><li>Simultaneously run a load test — artillery quick -r 5 -d 0 http://127.0.0.1:3000/</li></ol><p>The next step is now to install and use the <a href="https://github.com/iovisor/bcc/blob/master/INSTALL.md">bcctools from iovisor</a>, once installed you should have an application named offcputime in /usr/share/bcc/tools (Or wherever your distribution installs them). This tool will allow us to capture the frames to dive deeper into the performance issues of the application. We are also going to be using a tool to generate a flamegraph from the data, which is another amazing tool from, you guessed it, Brendan Gregg named <a href="https://github.com/brendangregg/FlameGraph">flamegraph.pl</a>.</p><p>Whilst running artillery I also took note of the latencies we had from our application, which was:</p><pre>    min: 24.7<br>    max: 72.4<br>    median: 38.6<br>    p95: 63.4<br>    p99: 72.4</pre><p>Shall we see if we can reduce these values?</p><pre>sudo python2 /usr/share/bcc/tools/offcputime -dfp$(pgrep -f next-start) 30 &gt; out.offcpu<br>cat out.offcpu | grep -v __pthread_cond_wait &gt; out.offcpu2<br>flamegraph.pl --color=io --title=&quot;Off-CPU flame&quot; -countname=us &lt; out.offcpu2 &gt; out.svg</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*61bAVqVxxTOs4pxAj8v2IA.png" /></figure><p>To make things easier for this blog post I have removed some lines from the outputted file, to make the SVG easier to read.</p><p>As you see in fig.1 the large towers contain the areas which contain the blocking I/O and the large fat lower towers are where a lot of time is spent.</p><p>A lot of the main time is caused by Garbage Collection and Memory Allocations, which is a good indication of the error at hand.</p><p>However, because this happens outside of the code routine of our application, it is very difficult to find out what is causing this.</p><p>So if we ignore this and drill into the large slim tower, hopefully, we will start to see lines of code in our application being referenced.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-iQYZlwiGRF7xto_n8-4VA.png" /></figure><p>Here we can see the generated code by next.js and see a reference to our pages/index.js on line 144. We can also see that next is transpiling our application to a .next/ folder, by inspecting that we can see it is referencing our <a href="https://github.com/tomgco/hello-next-performance/blob/io-bottle-neck/pages/index.js#L20-L22">large array</a> which we are populating for every request! Success!</p><p>With our new knowledge, I am going to optimise this code by caching the whole page, if the details haven’t changed! I followed the simple steps from this post <a href="https://medium.com/@az/i18n-next-js-app-with-server-side-rendering-and-user-language-aware-caching-part-1-ae1fce25a693">https://medium.com/@az/i18n-next-js-app-with-server-side-rendering-and-user-language-aware-caching-part-1-ae1fce25a693</a> to include our own express application, with the implementation of an LRU cache.</p><p>After running artillery again, I begin to see a reduced response time for the whole application:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3O45LXgyg3vFFLsZnPhh9Q.png" /></figure><pre>    min: 1.7<br>    max: 10<br>    median: 6.5<br>    p95: 8.3<br>    p99: 10</pre><p>These figures are so much smaller than what we had before!</p><p>It now simplifies our off-CPU flamegraph, almost totally removing our GarbageCollection block, eliminating our code block which was blocking our application. Check out the source here! <a href="https://github.com/tomgco/hello-next-performance/tree/cached-server">https://github.com/tomgco/hello-next-performance/tree/cached-server</a></p><p>As you have seen, using tools like the above in a load testing/production environment allows you to begin to understand the performance profile of your applications as well as gain a quick visual understanding of what your application is actually doing!</p><p>And the best thing with this tooling is that you don’t need to use it exclusively with Node.js, you can apply your knowledge here to other languages! Compiled or <a href="http://www.brendangregg.com/perf.html#JIT_Symbols">Jitted</a>!</p><p>Contact me on <a href="https://github.com/tomgco">GitHub</a> or <a href="https://twitter.com/tomgco">Twitter</a> with @tomgco or email me at <strong>tom at yld dot io</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c85ea71738eb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/yld-blog/cpu-and-i-o-performance-diagnostics-in-node-js-c85ea71738eb">CPU and I/O performance diagnostics in Node.js</a> was originally published in <a href="https://medium.com/yld-blog">YLD Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kubernetes: Authentication]]></title>
            <link>https://medium.com/yld-blog/kubernetes-auth-380e57d19da0?source=rss-57aa1d99b3ba------2</link>
            <guid isPermaLink="false">https://medium.com/p/380e57d19da0</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[oidc]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Tom Gallacher]]></dc:creator>
            <pubDate>Fri, 23 Nov 2018 15:48:53 GMT</pubDate>
            <atom:updated>2019-03-08T19:15:16.146Z</atom:updated>
            <content:encoded><![CDATA[<p>Providing access to <a href="https://www.yld.io/speciality/kubernetes/">Kubernetes</a> with multiple teams of developers, handling new joiners or people leaving means that the rotation of user access can be a daunting task. Kubernetes provides a few methods from X509 Client Certs, Static Token Files, Static Password File, Service Account Tokens, OpenID Connect Tokens and Anonymous Access.</p><p>But choosing the right authentication method is a difficult task, and it may have severe security implications if implemented incorrectly. This article will demystify the available options and provide an implementation that is Open-Source, in use by us at <a href="http://yld.io/">YLD</a> and our clients.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*R4osVbWZ2v2g0wf1" /></figure><p>Lets start with what should be avoided as much as possible, Static Token and Static Password Files, why? No method of token revocation exists, as well as any other changes require the kube-apiserver to be restarted. So the question is, do you trust the team handling user creation and deletion to have access to restart and modify the kube-apiserver? Even the docs mention “Note that basic authentication is currently supported for convenience while we finish making the more secure modes described above easier to use”. So if you must use these, please, proceed with caution!</p><p>Service Account Tokens should be a familiar concept to Kubernetes administrators, as these tokens are normally mounted into Pods for in-cluster access to the kube-apiserver, but did you know you can use these tokens outside of the cluster! The documentations suggest that this should be used for long running jobs that connect to the kube-apiserver. We use Service Account Tokens to allow our CD pipeline to communicate with our Kubernetes Clusters on a per-namespace basis. But be warned, these Service Account Tokens are stored as secrets, so be careful when granting permissions to other Service Accounts or Users. This could also be an easy method of granting a small amount of users access to your Cluster and provides the ability to revoke access by just deleting a Service Account Token from Kubernetes’ Secrets.</p><p>If you are having to manage a large number of users (say a whole engineering organisation) you might find yourself buried in administration work, and that if you are being told people are joining and leaving, if not then the possibility of having dormant active tokens lying around for team members that have left is an ever increasing problem.</p><p>X509 certificates mostly share the same pros and cons as Service Account Tokens. However revocation of certificates require to throw away the whole certificate chain and start a fresh — this is handled by the — client-ca-file=somefile parameter on the kube-api-server. However X509 certs have a feature which has the added benefit of being able to specify multiple groups that a certificate belongs to. This has the excellent side effect of providing a mechanism for building more specific RBAC roles that our bound to different groups (be ready for another post going into detail around RBAC)!</p><p>The only other alternative at the moment in time, which we have researched and experimented with is OpenID Connect Tokens. This is a flavour of Oauth2 but extended with a <a href="https://openid.net/specs/openid-connect-core-1_0.html#IDToken">ID Token</a>, which is basically a JWT Token that is signed by the server. This allows us to have Group memberships, ability to have short lived sessions or expiry on the JWT (so that user access can be rotated with 0 code changed) this is because the Identity management can be handled by an external service such as LDAP, Github or any other providers. Sadly this doesn’t come with a friendly user interface by default, so we implemented something.</p><h3>What did we implement?</h3><p><a href="https://github.com/yldio/kubernetes-auth">kubernetes-auth</a>. An authentication front-end to Kubernetes clusters, enabling users to log into a Kubernetes cluster through the configuration and use of <a href="https://github.com/coreos/dex">Dex</a>, <a href="https://github.com/coreos/dex/blob/5e34f0d1a6e22725b39f521178baac2cddd0a306/Documentation/openid-connect.md">OIDC</a> and <a href="https://kubernetes.io/docs/reference/access-authn-authz/authentication/#openid-connect-tokens">Kubernetes OIDC</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0TMYc6z7i98MlC69-4nu7Q.png" /><figcaption>kubernetes-auth</figcaption></figure><p>This has been developed for developers in large teams, with lots of new joiners to provide an easy way to switch between environments / regions in non-federated deployments.</p><p>It also provides an easy method to switch out Dex Connectors, so when your team ends up moving from Github to Okta, you have a minimal set of changes to implement.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1009/1*HWOBTIHBSmlY_odv9IRT-Q.png" /></figure><h3>Dex? Aka Kubernetes Authentication</h3><p>Dex acts as an intermediary between Github authentication and Kubernetes acting as an identity provider. This gives us the flexibility to move to another backed (LDAP, SAML, etc.) at some point in the future.</p><p>At the moment user logins are federated by github teams. Each team then belongs to a namespace with view on everything in that namespace. As time progresses we might want to restrict / expand on this.</p><p>To Login a user will use the following flow, with sandbox being replaced by their environment of choice (levels of access will be handled):</p><ul><li>Navigate to <a href="http://k8s-auth.sandbox.yld.io/">http://k8s-auth.sandbox.yld.io</a></li><li>Login to Github and authorise the YLD github application</li><li>Follow the instructions and Copy the commands, which will modify your ~/.kube/config</li><li>check access with kubectl get pods</li></ul><h3>How does kubernetes-auth work with Dex?</h3><p>We recommend reading the <a href="https://github.com/coreos/dex">Dex</a> <a href="https://github.com/coreos/dex/blob/master/Documentation/using-dex.md">Documentation</a> before continuing as it is required to be working correctly before kubernetes-auth can start.</p><p>In our example helm chart for kubernetes-auth and dex, we specifically use only the Github Connector and the PostgresSQL backend. This was the working combination at time of implementation, but we plan to extend the chart to make it configurable.</p><p>For a Github Organisation as such:</p><pre>.<br>└── yldio<br>    └── team<br>        ├── platform<br>        └── software-engineering</pre><p>It becomes possible to map the team platform with the Kubernetes RBAC ClusterRole cluster-admin to give anyone in the team platform cluster-wide access to the kubernetes cluster. As such if we gave the team software-engineering a Role to a specific namespace, any new members will have access to the Kubernetes cluster in that specific namespace.</p><p>Written by <a href="https://twitter.com/tomgco">Tom Gallacher</a> — Staff Engineer at <a href="https://www.yld.io/">YLD</a>.</p><h4>Interested in Kubernetes? Read more about it:</h4><ul><li><a href="https://medium.com/yld-engineering-blog/testing-kubernetes-rbac-5e00dc93af8e">Testing Kubernetes RBAC</a></li><li><a href="https://medium.com/yld-engineering-blog/kubernetes-core-concepts-324ea7028c29">Kubernetes: Core Concepts</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=380e57d19da0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/yld-blog/kubernetes-auth-380e57d19da0">Kubernetes: Authentication</a> was originally published in <a href="https://medium.com/yld-blog">YLD Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Testing Kubernetes RBAC]]></title>
            <link>https://medium.com/yld-blog/testing-kubernetes-rbac-5e00dc93af8e?source=rss-57aa1d99b3ba------2</link>
            <guid isPermaLink="false">https://medium.com/p/5e00dc93af8e</guid>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[rbac]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Tom Gallacher]]></dc:creator>
            <pubDate>Tue, 16 Oct 2018 10:14:22 GMT</pubDate>
            <atom:updated>2019-03-08T19:28:27.362Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Fk-j2d_gyfqNQgqJ" /><figcaption>“blue locked door” by <a href="https://unsplash.com/@cbarbalis?utm_source=medium&amp;utm_medium=referral">Chris Barbalis</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Securing your <a href="https://www.yld.io/speciality/kubernetes/">Kubernetes</a> cluster is one thing, keeping it secure is a continuous uphill struggle. However, with the introduction of new features to Kubernetes it is becoming much easier to do both.</p><p>Kubernetes (as of version 1.6) has introduced the concept of <strong>R</strong>ole-<strong>B</strong>ased <strong>A</strong>ccess <strong>C</strong>ontrol (<strong>RBAC</strong>), allows administrators to define policies to restrict the actions of users of your cluster. This means it is possible to create a user with limited access, allowing you to restrict access to resources such as Secrets, or by limiting access of that user to a specific Namespace.</p><p>This blog post will not look at how to implement RBAC, as there are many decent sources of information that cover it in vast detail:</p><ul><li><a href="https://medium.com/containerum/configuring-permissions-in-kubernetes-with-rbac-a456a9717d5d">https://medium.com/containerum/configuring-permissions-in-kubernetes-with-rbac-a456a9717d5d</a></li><li><a href="https://www.cncf.io/blog/2018/08/01/demystifying-rbac-in-kubernetes/">https://www.cncf.io/blog/2018/08/01/demystifying-rbac-in-kubernetes/</a></li><li><a href="https://docs.bitnami.com/kubernetes/how-to/configure-rbac-in-your-kubernetes-cluster/">https://docs.bitnami.com/kubernetes/how-to/configure-rbac-in-your-kubernetes-cluster/</a></li><li><a href="https://kubernetes.io/docs/reference/access-authn-authz/rbac/">https://kubernetes.io/docs/reference/access-authn-authz/rbac/</a></li></ul><p>Instead, this post will focus on how to ensure your business’s compliance and requirements are actually being adhered to and to ensure that we need to test our applied RBAC objects, to ensure they do what we intend them to do.</p><h4>Our Scenario</h4><p>An Organisation has just started on-boarding multiple teams onto their new Kubernetes cluster, a requirement for these teams to be on-boarded onto this cluster was that each team wouldn’t be allowed to modify another teams deployment causing unforeseen cross-team issues or downtime.</p><p>The Platform team who owns the Kubernetes deployment has recently deployed RBAC to the cluster, restricting access for team members to a specific namespace, on first inspection teams cannot view pods in any of the other team’s namespace.</p><p>Fast forwarding one week, the Platform team starts to notice that a user in a restricted namespace has been reading secrets from other namespaces. But How? Didn’t they Implement RBAC?</p><p>Well, they did, but as with code, we need to test our system’s against the desired outcome. Thankfully Kubernetes’ CLI tool kubectl provides us with tooling that allows us to test our RBAC configuration. kubectl auth can-i</p><h3>Can I?</h3><p>can-i simply checks that with the API to see if an action can be performed. It can take the following options kubectl auth can-i VERB [TYPE | TYPE/NAME | NONRESOURCEURL] . And now it is possible for the current user to check whether to not they can perform an action. Let&#39;s give this a go:</p><pre>kubectl auth can-i create pods</pre><p>This should return a “yes” or a “no” with a corresponding exit code.</p><p>But as soon as we try to test the authorisation for another user, we hit a stumbling block, with the command above we can only test using the currently loaded ./kube/config , it is quite unreasonable to have a file per user type! But thankfully Kubernetes once again comes to the rescue with the ability to impersonate users with the --as= and the --as-group= flags.</p><p>Let’s update our command to make use of impersonating a different user:</p><pre>kubectl auth can-i create pods --as=me</pre><p>We should see that we now get a “no” returned with an exit code of 1 being returned.</p><p>This is great news, we now have a set of commands that allow us to test if a specific set of users or an individual user has access to any number of Kubernetes resources from listing pods to deleting secrets.</p><h3>Automation</h3><p>We shouldn’t stop here though, we have now paved the way to implement a test suite that can describe the list of the requirements and have the ability to run this as part of our Continuous Delivery pipeline, so let us!</p><p>We have so many choices and languages to choose to implement this, from Ava and Mocha in JavaScript through to Rspec. In this case, I am going to be using a pure bash implementation of a testing framework named <a href="https://github.com/bats-core/bats-core">Bats</a>.</p><p>Below is an example testing that a user in a team namespace can scale deployments in their own namespace. It can be executed like any shell script if the executable bit has been set, or by using bats filename .</p><pre>#!/usr/bin/env bats</pre><pre>@test &quot;Team namespaces can scale deployments within their own namespace&quot; {<br>    run kubectl auth can-i update deployments.apps --subresource=&quot;scale&quot; --as-group=&quot;$group&quot; --as=&quot;$user&quot; -n $ns <br>    [ &quot;$status&quot; -eq 0 ]<br>    [ &quot;$output&quot; == &quot;yes&quot; ]<br>  done<br>}</pre><p>Sidebar; the --as and --as-group commands require the following RBAC rules to be used:</p><pre>rules:<br>- apiGroups:<br>  - authorization.k8s.io<br>  resources:<br>  - selfsubjectaccessreviews<br>  - selfsubjectrulesreviews<br>  verbs:<br>  - create</pre><p>And like that, you have an easy method of implementing testing for your RBAC rules in Kubernetes. With this as a part of your Kubernetes’ Continuous Delivery Pipeline we should now have a much more robust RBAC policy enforcement that has been verified to be working. Allowing changes that break policies to be caught much earlier!</p><p>Thanks for taking the time for reading!</p><p>Written by <a href="https://twitter.com/tomgco">Tom Gallacher</a> — Staff Engineer at <a href="https://www.yld.io/">YLD.</a></p><h4>Interested in Kubernetes? Read more about it:</h4><ul><li><a href="https://medium.com/yld-engineering-blog/kubernetes-core-concepts-324ea7028c29">Kubernetes: Core Concepts</a></li><li><a href="https://medium.com/yld-engineering-blog/kubernetes-auth-380e57d19da0">Kubernetes: Authentication</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5e00dc93af8e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/yld-blog/testing-kubernetes-rbac-5e00dc93af8e">Testing Kubernetes RBAC</a> was originally published in <a href="https://medium.com/yld-blog">YLD Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Heart Rate Dynamic Admission Controller]]></title>
            <link>https://medium.com/yld-blog/a-heart-rate-dynamic-admission-controller-5ebe6bafa169?source=rss-57aa1d99b3ba------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ebe6bafa169</guid>
            <category><![CDATA[containers]]></category>
            <category><![CDATA[api-server]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Tom Gallacher]]></dc:creator>
            <pubDate>Wed, 05 Sep 2018 12:30:02 GMT</pubDate>
            <atom:updated>2019-03-08T19:33:13.327Z</atom:updated>
            <cc:license>http://creativecommons.org/publicdomain/zero/1.0/</cc:license>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YZy7X0Swqj0Jr23M" /><figcaption>“no entry sign on metal rail in front of building during day” by <a href="https://unsplash.com/@fikrirasyid?utm_source=medium&amp;utm_medium=referral">Fikri Rasyid</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>This post will explore extending the Kubernetes API Admission Controllers by using Webhooks and my own heart rate.</p><p>The <a href="https://www.yld.io/speciality/kubernetes/">Kubernetes</a> API has a core concept of an “Admission Controller”, these controllers are compiled into the kube-apiserver binary and intercepts API requests before they are persisted to the Kubernetes storage back-end (etcd).</p><p>As these admission controllers are compiled into a binary, it restricts changes to a cluster administrator, which can enable the <a href="https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/#what-does-each-admission-controller-do">pre-compiled options</a> by using the --enable-admission-plugins or by modifying the kube-apiserver binary to patch in the functionality that is needed, a scary thought.</p><p>There are other ways though, as of Kubernetes 1.8, the concept of Dynamic Admission Controllers was introduced with the alpha API addition of Admission Controller Webhooks, these graduated to beta in 1.9</p><h3>Validating Admission Webhooks</h3><p>ValidatingAdmissionWebhook and the MutatingAdmissionWebhook have moved into beta and are enabled by default in Kubernetes 1.11.</p><p>The beauty of these webhooks is that they can be dynamically configured after the start of the api-server, this enables anyone with the correct <a href="https://kubernetes.io/docs/reference/access-authn-authz/rbac/">Role-based access control (RBAC)</a> to extend the concept of Admission Control, and I am going to show you how.</p><iframe src="https://cdn.embedly.com/widgets/media.html?type=text%2Fhtml&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;schema=instagram&amp;url=https%3A//www.instagram.com/p/BU8urUcBmj2/&amp;image=https%3A//i.embed.ly/1/image%3Furl%3Dhttps%253A%252F%252Fscontent-iad3-1.cdninstagram.com%252Fvp%252Fe7ec25357de41157b84f670822efe675%252F5C173322%252Ft51.2885-15%252Fsh0.08%252Fe35%252Fs640x640%252F18879045_1331165373646437_8645970119777845248_n.jpg%26key%3Da19fcc184b9711e1b4764040d3dc5c07" width="640" height="640" frameborder="0" scrolling="no"><a href="https://medium.com/media/d9f8e88e8edde3ee2b5cce86789ccd25/href">https://medium.com/media/d9f8e88e8edde3ee2b5cce86789ccd25/href</a></iframe><p>I have been using a heart rate monitor for the last few months whilst cycling to work and I have been enveloped with capturing the data and using it in as many ways as possible.</p><p>Which gave me the idea to use the data to gate when I can, and cannot create pods / deployments in my own personal Kubernetes cluster.</p><p>After reading about a specific type of Admission Webhook — “ValidatingAdmissionWebhook”, I decided to give the it a whirl and see if I could come up with an implementation.</p><p>I am going to be running this example in <a href="https://kubernetes.io/docs/setup/minikube/"><strong>minikube</strong></a> but any cluster should be suitable if you follow along. There are a number of pre-requisites that need to be fulfilled before continuing, and that is the following:</p><ul><li>Ensuring that you have a Kubernetes cluster version greater than 1.11 (for this blogpost)</li><li>Making sure that the kube-apiserver flag--enable-admission-plugins contains ValidatingAdmissionWebhook.</li><li>And that the admissionregistration.k8s.io/v1beta1 is enabled by: kubectl api-versions | grep admissionregistration.k8s.io/v1beta1</li></ul><p>Once the above are all in place we can begin.</p><p>To get familiar with the yaml configuration and to ensure that all Pod creation requests are blocked until we implement our Webhook server, we will apply the following ValidatingWebhookConfiguration:</p><pre>apiVersion: admissionregistration.k8s.io/v1beta1<br>kind: ValidatingWebhookConfiguration<br>metadata:<br>  name: deny-heartrate<br>webhooks:<br>  - name: deny-heartrate.yld.io<br>    rules:<br>      - apiGroups:<br>          - &quot;&quot;<br>        apiVersions:<br>          - &quot;v1&quot;<br>        operations:<br>          - &quot;CREATE&quot;<br>        resources:<br>          - &quot;pods&quot;<br>    failurePolicy: Fail<br>    clientConfig:<br>      url: &quot;https://192.168.99.1:8080&quot;<br>      caBundle: &quot;%%API_CERTIFICATE%%&quot;</pre><p>The documentation for this is a bit sparse and difficult to read, however, if you can wrap your head around the Kubernetes API documentation you can take a peek here: <a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.11/#validatingwebhookconfiguration-v1beta1-admissionregistration-k8s-io">https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.11/#validatingwebhookconfiguration-v1beta1-admissionregistration-k8s-io</a>, learn by <a href="https://github.com/stefanprodan/kubesec-webhook">example</a> with a fully functioning kubesec admission controller or have a look at the <a href="https://github.com/yldio/heart-rate-validating-admission-webhook">finished source for this article</a>.</p><p>Once we have applied this to our cluster using the magic of kubectl apply -f our.yaml we can create a pod and watch our pod fail to create due to the unavailability of our webhook service, now we are able to build our service.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FGB4EFL1wuq8%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DGB4EFL1wuq8&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FGB4EFL1wuq8%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/33df05329c3755979236752a218220cd/href">https://medium.com/media/33df05329c3755979236752a218220cd/href</a></iframe><p>I feel most comfortable programming using <a href="https://www.yld.io/speciality/node-js/">Node.js</a> and decided to implement the Bluetooth heart rate API’s using Node.js, sadly it only works on Node 8 and requires sudo due to it interfacing with the Bluetooth network stack. By using a Node.js module named noble and reading the <a href="// https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.characteristic.heart_rate_measurement.xml&amp;u=org.bluetooth.characteristic.heart_rate_measurement.xml">specification</a> and with a cheeky <a href="https://github.com/chbrown/BluetoothLE-HeartRate">MIT licensed copy pasta of the bit bashing</a> we had a working server which responds with the following on success:</p><pre>{ &quot;response&quot;: {<br>    &quot;allowed&quot;: true,<br>  }<br>}</pre><p>And on error responds with:</p><pre>{ &quot;response&quot;: {<br>    &quot;allowed&quot;: false,<br>    &quot;status&quot;: {<br>      &quot;status&quot;: &quot;Failure&quot;,<br>      &quot;message&quot;: &quot;heart rate: 120 is too low (Lower than 130)&quot;,<br>      &quot;reason&quot;: &quot;heart rate: 120 is too low (Lower than 130)&quot;,<br>      &quot;code&quot;: 402<br>    }<br>  }<br>}</pre><p>With this now working for requests our last step will be to run the server, and to ensure that the Kubernetes API can connect to it, as I am running the Webhook application on my local machine and Kubernetes in minikube, which is running in virtualbox they share a network adaptor and a network address, which allows minikube to connect to my local machine on 192.168.99.1 , checked by running ip addr and looking for the vboxnet adaptors IP address.</p><p>I then proceed to spin up the server with a heart rate limit set to 200 by running: node server.js 200</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FzYRJ8mj25X8%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DzYRJ8mj25X8&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FzYRJ8mj25X8%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/87a6996e995f0e1b216915faccf78c92/href">https://medium.com/media/87a6996e995f0e1b216915faccf78c92/href</a></iframe><p>As we can see, in the video, when looking at the events of the pod creation we see an error message of Error create: admission webhook &quot;deny-heartrate.yaml&quot; — Heart rate: 90 is too low (Lower than 200) .</p><p>Great, we see that a print out of allowed: false was also outputted from the server, proving that we denied a creation of a pod based on my heart rate!</p><p>The last step is to see if it admits the creation of pods when the bpm limit is set much lower.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FflecdfQQEr8%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DflecdfQQEr8&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FflecdfQQEr8%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/2e5406fe640d968386206f6f24345475/href">https://medium.com/media/2e5406fe640d968386206f6f24345475/href</a></iframe><p>Excellent!</p><p>You should now have enough information to start implementing a more useful Dynamic Kubernetes Admission controllers, such as <a href="https://github.com/stefanprodan/kubesec-webhook">https://github.com/stefanprodan/kubesec-webhook</a> and <a href="https://github.com/lukebond/grafeas-image-signing-webhook">https://github.com/lukebond/grafeas-image-signing-webhook</a> and include them in your production based workloads.</p><h3>Container Camp on Twitter</h3><p>Holy webhooks Batman! It&#39;s @tomgco of @YLD with his &#39;Heart Rate Validating Admission Webhook&#39; 💔💻</p><p>This post was presented and live demo’ed at the <a href="https://2018.container.camp/uk/">Container Camp</a> 2018 Super Meetup!</p><p>You can check out the slides <a href="https://docs.google.com/presentation/d/1mB4lT0b96kCu1-zhayLEfjdl070gVCyIn64EtecAfQo/edit?usp=sharing">here</a>. <a href="https://www.yld.io/">YLD</a> including me will be at Container.camp on the 7th of September in London, so if you are going (go grab a <a href="https://2018.container.camp/uk/register/">ticket</a>) feel free to come to the YLD stand and ask me a plethora of answers!</p><p>Written by <a href="https://twitter.com/tomgco">Tom Gallacher</a> — Staff Engineer at <a href="https://www.yld.io/">YLD</a>.</p><h4>Interested in Kubernetes? Read more about it:</h4><ul><li><a href="https://medium.com/yld-engineering-blog/kubernetes-core-concepts-324ea7028c29">Kubernetes: Core Concepts</a></li><li><a href="https://medium.com/yld-engineering-blog/kubernetes-auth-380e57d19da0">Kubernetes: Authentication</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ebe6bafa169" width="1" height="1" alt=""><hr><p><a href="https://medium.com/yld-blog/a-heart-rate-dynamic-admission-controller-5ebe6bafa169">A Heart Rate Dynamic Admission Controller</a> was originally published in <a href="https://medium.com/yld-blog">YLD Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kubernetes: Core Concepts]]></title>
            <link>https://medium.com/yld-blog/kubernetes-core-concepts-324ea7028c29?source=rss-57aa1d99b3ba------2</link>
            <guid isPermaLink="false">https://medium.com/p/324ea7028c29</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[learning-to-code]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Tom Gallacher]]></dc:creator>
            <pubDate>Thu, 26 Jul 2018 09:59:50 GMT</pubDate>
            <atom:updated>2019-03-08T20:01:40.269Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nPhc9OvdjXeghLtx" /><figcaption>Candy Machine — Photo by <a href="https://unsplash.com/@rawpixel?utm_source=medium&amp;utm_medium=referral">rawpixel</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>It doesn’t need to be hard</h3><p>Getting to grips with <a href="https://www.yld.io/speciality/kubernetes/">Kubernetes</a> can be extremely difficult, with so much information floating around on the seas of the internet, it is sometimes very difficult to find the “core” pieces of information to understand Kubernetes, especially when seeing how dense the information is on <a href="https://kubernetes.io/docs/concepts/">kubernetes.io</a>’s concepts pages and documentation. In part one of this “Kubernetes” blog series, we will explore the core concepts of Kubernetes to gain a base level of knowledge, so that we can together demystify Kubernetes.</p><h4>What is Kubernetes?</h4><p>Kubernetes provides the fundamentals and building blocks to construct a usable platform for your team to develop and release to.<br>Users can administer their Kubernetes clusters through a graphical user interface as well as an imperative and declarative command line interface, designed to manage the entire life-cycle of your containerised applications and services.</p><p>It is possible to scale your applications up and down, perform rolling deployments and manage which services should respond to certain requests. It also provides an extensible framework to develop on to allow your team to extend the core kubernetes primitives to their hearts’ delight! As well as the option to create their own concepts.</p><p>As with most frameworks, One of the downsides though is that it is missing a lot of specific pieces of functionality out of the box to be classified as a turn-key solution. In the standard distribution, It doesn’t include a method on how services speak to each other (it doesn’t include a networking component even!) still other distributions exists and it is also possible to build your own.</p><h4>Containers</h4><p>A container is a stand-alone, executable piece of software which includes everything that is required to run it. Such as code, libraries and any external dependencies. It ensures that what is running is identical, even when running in a different environment. This is achieved by isolating the running code from its execution context.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/248/1*DgXee_54MxUCGZn21QeIWA.png" /><figcaption>Diagram of three Containers running on a Guest Operating System</figcaption></figure><p>This is achieved in Linux by carving a subset of the Linux Kernel using an API called <a href="https://www.kernel.org/doc/Documentation/cgroup-v2.txt">cgroups</a>. This provides a high amount of isolation from the operating system, but without the runtime performance hit of virtualised environments such as VMWare, KVM, etc.</p><h4>Pods</h4><p>The pod is the most basic of objects that can be found in Kubernetes.</p><p>A <a href="https://kubernetes.io/docs/concepts/workloads/pods/pod/">pod</a> is a collection of containers, with shared storage and network, and a specification on how to run them. Each pod is allocated its own IP address. Containers within a pod share this IP address, port space and can find each other via localhost.</p><p>A pod should be seen as an ephemeral primitive.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/181/1*JirQ17tNtjRLVQ8_kCGTvw.png" /><figcaption>Diagram showing multiple containers sitting inside of a Pod</figcaption></figure><h4>Replicaset</h4><p>A <a href="https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/">replicaset</a> runs n number of pods, based on the provided template.</p><p>Replicasets are not used directly, however the resource needs to be understood as it is the based building block for building applications on Kubernetes.</p><p>Replicasets can (when instructed to) scale up or down the number of pods which are desired.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/321/1*ij06-2ZeoRfhDQxFCIjU6Q.png" /><figcaption>Diagram showing that a Replicaset consists of many instances of the same Pod.</figcaption></figure><h4>Service</h4><p>As pods are ephemeral (replicasets enforce this by scaling the number of pods up and down), a problem presents itself; it now becomes almost impossible to reference an individual pod without complex logic to track topology changes.</p><p><a href="https://kubernetes.io/docs/concepts/services-networking/service/">Services</a> fix this problem by providing an abstraction over Pods and provide an addressable method of communicating with pods.</p><p>Services operate on “layer 4” (TCP/UDP over IP) in the OSI model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/341/1*Pnc8I8lj0f8bYsLHmdAf4A.png" /><figcaption>Diagram showing that a Service spans over a Replicaset</figcaption></figure><h4>Deployment</h4><p><a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/">Deployments</a> manage replicasets and can be used to run rolling upgrades between versions of your applications.</p><p>This is the most common resource type that is used and provides an abstraction over replicasets and pods through a single interface.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/321/1*QhG-Rs5uZzcbUPfr87McjQ.png" /><figcaption>Diagram showing that a Deployment wraps a Replicaset</figcaption></figure><p>In the case of updating this Deployment, to say, deploy a new version of an application, the deployment controller will create a new replicaset and manage the rolling upgrade from the old to the new.</p><p>As of the Kubernetes 1.11 release, deployments do not currently handle rollback automatically.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/701/1*CUs0WM2GanyHxDweCmQsHg.png" /><figcaption>Diagram showing that a Service overlays all replicasets that match a specific label.</figcaption></figure><h4>ConfigMap</h4><p>Well designed applications should try to follow the <a href="https://12factor.net/">12-factor app manifesto</a>, for configuration of your applications, this should store configuration in the “environment”. Although common security practices now state that storing config in the environment can cause accidental leakage of secrets as some applications spew their environment on failure, nevertheless configuration should be stored separately from the built application as configuration changes per environment. (development, staging, production).</p><p>ConfigMaps solve the problem by allowing to mount configuration files into a Pod as an Environment variable or as a file system mount.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/335/1*mzGArj07F8qI2cKdpyVB2A.png" /><figcaption>Diagram showing that a ConfigMap can be mounted as a file, or injected into the environment of a Container inside a Pod.</figcaption></figure><h4>Secrets</h4><p>Secrets are very similar to ConfigMaps, they are, by their name, “secret” [3][4].</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/335/1*RRTPMPvfh7OK1UqTVriESg.png" /><figcaption>Diagram showing that a Secret can be mounted as a file, or injected into the environment of a Container inside a Pod.</figcaption></figure><h4>Daemonset</h4><p>A <a href="https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/">Daemonset</a> ensures that all Nodes run a specific Pod. This is useful for running something such as a logging agent like fluentd on all Nodes.</p><p>It is also possible to ignore certain Nodes by using <a href="https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/">Taints</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/761/1*kbIMIqsRh6QYkvqcfVyYpQ.png" /><figcaption>Diagram showing nodes with the same pod running only once across all nodes.</figcaption></figure><h4>Ingress</h4><p>In most circumstances, services and pods have IP addresses which are only accessible from within the Kubernetes cluster. With the services being isolated from internet traffic.</p><p>“An Ingress is a collection of rules that allow inbound connections to reach the cluster services.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/121/1*BEXPWAfzclJOo6adeeQGLg.png" /><figcaption>Diagram showing the network flow, from the internet, through the Ingress and into multiple services.</figcaption></figure><p>It can be used for load balancing, to terminate TLS, provides external routable URLs and much more. An ingress is just another Kubernetes resource, however, in most cases, it is required to have an <a href="https://kubernetes.io/docs/concepts/services-networking/ingress/#ingress-controller://kubernetes.io/docs/concepts/services-networking/ingress/#ingress-controllers"><strong>Ingress Controller</strong></a> Such as <a href="https://kubernetes.github.io/ingress-nginx/">Nginx</a> or <a href="https://docs.traefik.io/user-guide/kubernetes/">Træfik</a>.</p><p>Kubernetes is a platform for automating the orchestration of containers, enabling applications to run at scale on a myriad of platforms, that could contain a mix of processor architectures and operating systems at the discretion of the implementor.</p><p>Using these core concepts, Kubernetes can schedule pods onto appropriate Nodes to ensure the greatest possible density of pods, controlled by Kubernetes implementing multiple algorithms such as <a href="https://en.wikipedia.org/wiki/Bin_packing_problem">Bin Packing</a> allowing you to achieve higher hardware capacity utilisation.</p><blockquote><em>[1] </em><a href="https://medium.com/google-cloud/kubernetes-configmaps-and-secrets-68d061f7ab5b"><em>https://medium.com/google-cloud/kubernetes-configmaps-and-secrets-68d061f7ab5b</em></a><em> <br>[2] </em><a href="https://medium.com/google-cloud/kubernetes-configmaps-and-secrets-part-2-3dc37111f0dc"><em>https://medium.com/google-cloud/kubernetes-configmaps-and-secrets-part-2-3dc37111f0dc</em></a><em> <br>[3] </em><a href="https://kubernetes.io/docs/concepts/configuration/secret/"><em>https://kubernetes.io/docs/concepts/configuration/secret/</em></a><em> <br>[4] </em><a href="https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/"><em>https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/</em></a></blockquote><p>Written by <a href="https://twitter.com/tomgco">Tom Gallacher</a> — Staff Engineer at <a href="https://www.yld.io/">YLD.</a></p><h4>Interested in Kubernetes? Read more about it:</h4><ul><li><a href="https://medium.com/yld-engineering-blog/kubernetes-auth-380e57d19da0">Kubernetes: Authentication</a></li><li><a href="https://medium.com/yld-engineering-blog/testing-kubernetes-rbac-5e00dc93af8e">Testing Kubernetes RBAC</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=324ea7028c29" width="1" height="1" alt=""><hr><p><a href="https://medium.com/yld-blog/kubernetes-core-concepts-324ea7028c29">Kubernetes: Core Concepts</a> was originally published in <a href="https://medium.com/yld-blog">YLD Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[When should I use Docker?]]></title>
            <link>https://medium.com/yld-blog/when-should-i-use-docker-77ae2736a487?source=rss-57aa1d99b3ba------2</link>
            <guid isPermaLink="false">https://medium.com/p/77ae2736a487</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[open-source]]></category>
            <dc:creator><![CDATA[Tom Gallacher]]></dc:creator>
            <pubDate>Mon, 25 Jun 2018 10:56:55 GMT</pubDate>
            <atom:updated>2019-01-24T16:27:20.229Z</atom:updated>
            <content:encoded><![CDATA[<p>A fictional dialog.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o0AIoi9XlJh0tifUbA1APA.png" /></figure><p><strong>The Uninformed:</strong> You must use Docker, I know we are only a team of 5, but everyone else is using it!</p><p><strong>Developer</strong>: But we are building a simple service, which will bring us excellent value, we need to ship now.</p><p><strong>The Uninformed: </strong>Sorry, we build everything using Docker, however as we haven’t got any infrastructure in place, you will have to wait a few months.</p><p><strong>The Informed: </strong>Don’t use Docker! We need to provide value before we even need to consider using something complex like Docker.</p><p><strong>The Informed: </strong>We are going to make the operational decision that all new services in our business, which will be deployed to our new infrastructure, will be required to use Docker. Our platform is ready to go; the added benefit of security and consistent environments allow us to ensure what is tested in our continuous delivery pipeline is the same as what is deployed.</p><p><strong>Developer: </strong>That makes sense, however I seem to find my development workflow has been impacted, and I am less productive than I used to be.</p><p><strong>The Informed:</strong> This is a downside of using tooling at this stage. You do not need to use Docker at all points of development, it really depends on what guarantees you want to have. Do you want to be able to rapidly iterate, with the possibility that what you deploy is not the same as what you have tested? If so, you might spend days debugging a minor patch version change in a module you are using. Or do you want to be able to have a slightly slower iteration, run everything through a continuous delivery pipeline and be ensured that what you are testing is guaranteed to be the same in production?</p><p>As you can see from the above, using Docker can be as much a business decision as a technical one. We need to make informed decisions on when to use certain technologies, and Docker is definitely one of these.</p><p>As developers, from front-end to back-end, from SREs to infrastructure the choices we make impact, more than the immediate problem. We need to ensure that the due diligence has been carried out and it is up to us to be as informed as we can.</p><h4>But really, when should I not use Docker?</h4><p>If your company already has a deployment pipeline, with immutable hashed assets being passed through, deployed to infrastructure that isolates binaries from each other and the host, then the cost to migrate to using Docker would likely not be justified. This thinking also applied on the other-side of the operational spectrum; if deploying a single application to production is needed quickly and your company has limited operational knowledge.</p><p>But please, ignore me if you must. Just make the right choice for you and your business.</p><p>Written by <a href="https://twitter.com/tomgco">Tom Gallacher</a> — Staff Engineer at <a href="https://www.yld.io/">YLD</a>.</p><h4>Interested in Docker? Read more about it:</h4><ul><li><a href="https://medium.com/yld-engineering-blog/deploy-your-create-react-app-with-docker-and-ngnix-653e94ffb537">Deploy your Create React App with Docker and Nginx</a></li><li><a href="https://medium.com/yld-engineering-blog/node-js-deployments-with-docker-dokku-digital-ocean-731f3de96421">Node.js Deployments with Docker, Dokku, &amp; Digital Ocean</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=77ae2736a487" width="1" height="1" alt=""><hr><p><a href="https://medium.com/yld-blog/when-should-i-use-docker-77ae2736a487">When should I use Docker?</a> was originally published in <a href="https://medium.com/yld-blog">YLD Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>