<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.9.2">Jekyll</generator><link href="pipejakob.com/feed.xml" rel="self" type="application/atom+xml" /><link href="pipejakob.com/" rel="alternate" type="text/html" /><updated>2023-01-30T19:25:58-08:00</updated><id>pipejakob.com/feed.xml</id><title type="html">| jakob</title><entry><title type="html">Applying DSSS to Kubernetes Development</title><link href="pipejakob.com/kubernetes-dsss" rel="alternate" type="text/html" title="Applying DSSS to Kubernetes Development" /><published>2017-07-22T00:00:00-07:00</published><updated>2017-07-22T00:00:00-07:00</updated><id>pipejakob.com/kubernetes-dsss</id><content type="html" xml:base="pipejakob.com/kubernetes-dsss">&lt;link rel=&quot;stylesheet&quot; href=&quot;/css/kubernetes-dsss.css&quot; /&gt;

&lt;p&gt;There are plenty of resources available if you’re looking to learn Kubernetes
as either a user or cluster administrator, but if you’re getting into
development of Kubernetes &lt;em&gt;itself&lt;/em&gt;, like I did recently, there are scandalously
few resources to take advantage of and so much more to learn.&lt;/p&gt;

&lt;p style=&quot;text-align: center&quot;&gt;&lt;em&gt;Just looking for the v2 DSSS map? Skip down &lt;a href=&quot;#map&quot;&gt;here&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I started diving into Kubernetes about nine months ago as a new developer at
Google, where I work on both Kubernetes and our hosted version, &lt;a href=&quot;https://cloud.google.com/container-engine/&quot;&gt;Google
Container Engine&lt;/a&gt; (GKE). Even with
a history of containers and cluster environments, the ecosystem around and
within Kubernetes was pretty intimidating. Add to that my need to learn
Google’s internal tools and codebase in addition to the open source stack used
for Kubernetes externally, and I knew I needed to be deliberate in my ramp-up.&lt;/p&gt;

&lt;p&gt;Feeling overwhelmed, I turned to a systematic framework for accelerated
learning called &lt;strong&gt;DSSS&lt;/strong&gt;, from one of my favorite authors, &lt;a href=&quot;http://tim.blog&quot;&gt;Tim
Ferriss&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you’re unfamiliar with DSSS, &lt;a href=&quot;https://youtu.be/DSq9uGs_z0E?t=578&quot;&gt;one of Tim’s talks
&lt;/a&gt; gives a good introduction, as does his
book, &lt;a href=&quot;https://www.amazon.com/dp/B005NJU8PA/&quot;&gt;The 4-Hour Chef&lt;/a&gt;. The short
version of the acronym is this, though:&lt;/p&gt;

&lt;table id=&quot;dsss-definition&quot;&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;Deconstruction&lt;/td&gt;
      &lt;td&gt;break the domain down into its smallest constituent parts you can learn.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Selection&lt;/td&gt;
      &lt;td&gt;apply the 80/20 rule to filter these down to the 20% parts that yield 80% of the benefit.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Sequencing&lt;/td&gt;
      &lt;td&gt;order the steps intelligently to maximize your learning efficiency.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Stakes&lt;/td&gt;
      &lt;td&gt;make sure you have a good reason not to abandon your learning goal.&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;I started with an extremely thorough deconstruction of Kubernetes, trying to
capture every meaningful concept and component I could find. This was the
easiest step, since you can crawl the entire known world on the &lt;a href=&quot;https://kubernetes.io/docs/home/&quot;&gt;kubernetes.io
docs&lt;/a&gt; website and keep a running list. It’s
the selection/sequencing steps that require more guidance if you’re not already
an expert, so I had to get more creative.&lt;/p&gt;

&lt;p&gt;With a combination of shell scripting and manual oversight, I used the
frequency of terms in the documentation as the metric for selection, and the
implicit dependency of concepts for sequencing (i.e. if &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;A&lt;/code&gt; depends on &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;B&lt;/code&gt;,
then I need to learn &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;B&lt;/code&gt; first).&lt;/p&gt;

&lt;p&gt;Google pays me to work on Kubernetes, so my job performance and reputation were
already on the line before applying DSSS, so my stakes were covered. No extra
pressure required there. If you’re reading this, it’s likely that you’re also
part of the growing trend to be paid to develop or evaluate Kubernetes for your
company’s needs, so you probably already have built-in stakes. If you’re
actually an altruistic hobbyist – then first of all, good on you, and welcome
aboard. It’s an exciting place to be. But set some stakes for yourself to make
sure you don’t burn out before getting over the hump.&lt;/p&gt;

&lt;h2 id=&quot;the-map&quot;&gt;The Map&lt;/h2&gt;

&lt;p&gt;All in all, the DSSS exercise (or in my case,
DSS-&lt;em&gt;oh-my-god-I-hope-I-don’t-get-fired&lt;/em&gt;) was beyond useful, and I felt
immensely much more fluent in the overall architecture after using this
systematic approach in short order. Of course, since I cobbled together my
original DSSS map with scripts and statistics, it was far from optimal. Now
that I have much more experience and the gift of hindsight, I’ve gone back and
refined it in hopes to make the path a little easier to tread for the next
generation of Kubernetes developers.&lt;/p&gt;

&lt;p&gt;This map is aimed at ramping up beginners to the project. I may follow up with
an intermediate map later, but as the 80/20 rule of selection implies, this
should get you quite far.&lt;/p&gt;

&lt;h3 id=&quot;map&quot; style=&quot;text-align: center&quot;&gt;Kubernetes Architecture DSSS Map (beginner) v2.0&lt;/h3&gt;

&lt;ul id=&quot;map-list&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.docker.com/what-container&quot;&gt;containers&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://kubernetes.io/docs/concepts/workloads/pods/pod/&quot;&gt;pods&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;podspec&lt;/li&gt;
      &lt;li&gt;health probes&lt;/li&gt;
      &lt;li&gt;init containers&lt;/li&gt;
      &lt;li&gt;volumes&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://kubernetes.io/docs/admin/kubelet/&quot;&gt;kubelet&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;static manifests&lt;/li&gt;
      &lt;li&gt;http static manifests&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://kubernetes.io/docs/user-guide/kubectl-overview/&quot;&gt;kubectl&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;create / apply / delete&lt;/li&gt;
      &lt;li&gt;get nodes / pods / events&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://kubernetes.io/docs/admin/kube-apiserver/&quot;&gt;kube-apiserver&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;api verbs (CRUD + LIST/PATCH)&lt;/li&gt;
      &lt;li&gt;api objects&lt;/li&gt;
      &lt;li&gt;api groups and versioning&lt;/li&gt;
      &lt;li&gt;runtime-config&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://kubernetes.io/docs/admin/kube-controller-manager/&quot;&gt;kube-controller-manager&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;controller philosophy&lt;/li&gt;
      &lt;li&gt;replication controller&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;but-how-do-i-even&quot;&gt;But how do I even?&lt;/h2&gt;

&lt;p&gt;So now you have a map. A DSSS map. Cool, right?&lt;/p&gt;

&lt;p&gt;What do you even do with it?&lt;/p&gt;

&lt;p&gt;I’m hoping to find the time to write articles for each entry on the map, so
everything on this list just becomes a link to a friendly, easy-to-digest
guided tour of our learning adventure together. For now, though, Google is your
friend, and I’ve added some friendly-ish links to get jumpstarted. The official
Kubernetes documentation can be pretty dry and excessively self-referential,
but it’s still a great start. Download Kubernetes, or sign up for a free-tier
account with GKE or any of the other 7,000* hosted Kubernetes solutions, and
play around.&lt;/p&gt;

&lt;p class=&quot;ast&quot;&gt;&lt;em&gt;* slight exaggeration&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Make sure that you learn each concept from the map as thoroughly as you can
before moving onto the next one. That means that in order to strike &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;kubelet&lt;/code&gt;
off the list, you should have a good understanding of what it is, why it
exists, where and how it gets deployed, its command-line flags, tinker with it
manually, etc.&lt;/p&gt;

&lt;p&gt;After completing this map, nearly every other Kubernetes concept is easy to
grok in terms of these basics. What’s a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DaemonSet&lt;/code&gt;? A &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pod&lt;/code&gt; that runs via
every &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;kubelet&lt;/code&gt; in the cluster. What’s a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Job&lt;/code&gt;? A &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pod&lt;/code&gt; that’s meant to run to
successful completion (one or more times), so it doesn’t just keep restarting
forever. How can I set up ingress rules? Create an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;API object&lt;/code&gt; to declare your
policies, and run a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;controller&lt;/code&gt; to enforce them.&lt;/p&gt;

&lt;h2 id=&quot;omissions&quot;&gt;Omissions&lt;/h2&gt;

&lt;p&gt;There were some items that I originally sunk a good deal of time into while
exploring my v1 map that proved useless for this stage of learning. Here are
some things that didn’t make the v2 cut:&lt;/p&gt;

&lt;h3 id=&quot;etcd&quot;&gt;etcd&lt;/h3&gt;

&lt;p&gt;All of the Kubernetes infrastructure state is stored in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;etcd&lt;/code&gt;. Done. Cross
that one off your list.&lt;/p&gt;

&lt;p&gt;Unless you’re a developer on the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;kube-apiserver&lt;/code&gt;, or are trying to understand
the nuances of setting up a Highly Available (HA) cluster with redundant
storage, that’s really all you need to know. Basically everything else in the
cluster is stateless, and all cluster state is housed in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;etcd&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The rest is certainly &lt;em&gt;interesting&lt;/em&gt;, of course. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;etcd&lt;/code&gt; uses the Raft algorithm
for distributed consensus, which is a conceptual simplification of Paxos that
is functionally equivalent. I found reading about Raft, or how to secure
communications between the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;kube-apiserver&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;etcd&lt;/code&gt;, or how &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;etcd&lt;/code&gt; stores
object version records under the covers all fascinating, but this is all easy
to cull from our map because in reality, only &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;kube-apiserver&lt;/code&gt; talks to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;etcd&lt;/code&gt;,
and everything else just uses the Kubernetes APIs. Focus your energy there
instead.&lt;/p&gt;

&lt;h3 id=&quot;kubernetes-the-hard-way&quot;&gt;kubernetes the hard way&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/kelseyhightower&quot;&gt;Kelsey Hightower&lt;/a&gt;, who is a coworker,
scholar, and a gentleman, has this great repository of instructions for
manually installing and configuring a Kubernetes cluster called
&lt;a href=&quot;https://github.com/kelseyhightower/kubernetes-the-hard-way&quot;&gt;kubernetes-the-hard-way&lt;/a&gt;
(KTHR). It came well recommended to me by teammates and the Internet at large
when I first joined Kubernetes. I think KTHR is a fantastic tool, I really do.
It accomplishes a few things really well:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;It helps build empathy for the complexity of Kubernetes and the critical
need for tooling to automate cluster management.&lt;/li&gt;
  &lt;li&gt;Following his instructions, you will actually create a functional cluster
from scratch, which makes it a great guide for codifying this process in a
way that the official documentation never attempts. Anyone looking to
build a cluster management tool should consider it the de facto baseline
for specification.&lt;/li&gt;
  &lt;li&gt;As an intermediate developer, it can help you understand where processes
live, how they get configured, what &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;kubeconfig&lt;/code&gt; is needed to be placed
where, etc. It’s also a useful map of the “known universe” of components
that can seed the deconstruction step of your own DSSS map and further
your understanding of the cluster architecture.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;KTHR does all of these things really well, but it completely failed as the
purported teaching tool for me as a beginner. I don’t think that’s how Kelsey
meant for it to be used.&lt;/p&gt;</content><author><name></name></author><summary type="html"></summary></entry></feed>