<?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 Alex T. on Medium]]></title>
        <description><![CDATA[Stories by Alex T. on Medium]]></description>
        <link>https://medium.com/@a0x8o?source=rss-f624ae609dd4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*o2X6ygnwgZTQUmEytixZAg.jpeg</url>
            <title>Stories by Alex T. on Medium</title>
            <link>https://medium.com/@a0x8o?source=rss-f624ae609dd4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 09:13:42 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@a0x8o/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[Real-time Performance Profiling & Analytics for Microservices using Apache Spark]]></title>
            <link>https://medium.com/@a0x8o/real-time-performance-profiling-analytics-for-microservices-using-apache-spark-96d026083021?source=rss-f624ae609dd4------2</link>
            <guid isPermaLink="false">https://medium.com/p/96d026083021</guid>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[spark]]></category>
            <category><![CDATA[realtime]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Alex T.]]></dc:creator>
            <pubDate>Mon, 08 May 2017 16:10:30 GMT</pubDate>
            <atom:updated>2017-05-08T16:10:30.441Z</atom:updated>
            <content:encoded><![CDATA[<p>Microservices are gaining popularity as an architecture style to achieve extreme agility. The application is functionally decomposed into a set of loosely coupled collaborating services that interact through well-defined (REST) APIs. Adopting these design principles allow teams of developers to continuously evolve individual microservices independently, in an extremely fast-paced fashion. Organizations using this development model are known to update their deployments from 50 to <a href="http://product.hubspot.com/blog/how-we-deploy-300-times-a-day">300 times a day</a>….</p><p>One of the biggest challenges in adopting microservices is that while we gain agility for individual microservices, gaining insight about the entire operation of the system (consisting of tens of interacting microservices) becomes more difficult. As shown in Figure 1, multiple networked services work in coalition to generate a response to the user’s request; an end-to-end view of the application execution is vital to quickly diagnose and address performance degradation issues in production deployments. In applications with tens of microservices (and hundreds of instances of each), it becomes increasingly hard to understand how information is flowing across various services, where the choke points are and whether the delay experienced by a user is an artifact of the network or a microservice in the call chain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6GJXjEUtqCNgSxrL." /></figure><p>Figure 1. Application is a loosely coupled collection of microservices that evolve independent of other services.</p><p>Given the rising need for performance profiling tools for microservice-based applications running in a cloud environment, we are experimenting with the idea of baking a real-time, performance profiler in to the platform substrate itself, akin to services like auto scaling, load balancing, etc. The service would work in a non-intrusive fashion by capturing and analyzing network communication between microservices in the application. Operating at cloud scale, the analytics aspect of the service needs to process vast amounts of communication traces from tenant applications in real-time, discover the application topologies, track individual requests as they flow across microservices over the network, and so on. Since we needed to run both batch and real-time analytics applications, we decided to use Apache Spark as our big-data analytics platform.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*NH7bWRjKjVnUfDUH." /></figure><p>Figure 2. A simplified performance profiling system using Spark</p><p>Figure 2 illustrates a simple experiment that we setup to understand how we can leverage Spark for operational analytics. Our setup consists of a Openstack cloud, a set of microservice-based applications operating in different tenant networks, and a small Spark cluster. Software network taps are installed on every Nova compute host to capture network packets transiting inside tenant networks. Wire-data captured from the tenant network is pushed into a Kafka bus. We wrote connectors in our Spark applications to pull packets out of Kafka and analyze them in real-time.</p><p>We wrote Spark applications to attempt to answer the following questions:</p><ol><li>How does information flow across services while generating the response to a particular end user’s request? In the IT Operational Analytics world, this specific type of analytical operation is commonly known as “transaction tracing”.</li><li>Given a time window, what is the caller/callee relationship between various microservices in the application?</li><li>Given a time window, what were the response times for various microservices in the application?</li></ol><p>We developed two Spark applications to answer these questions: a near real-time transaction tracing application and a batch analytics application to generate the application’s communication graph and latency statistics. The former was built on top of Spark’s streaming abstractions, while the latter was a set of batch processing jobs managed by the <a href="https://github.com/spark-jobserver/spark-jobserver">Spark job server</a>.</p><p>Tracing transactions (or request flows) across microservices requires establishing causality between request-response pairs across microservices in the application. In order to be completely agnostic to the application, we decided to treat the application as a black box. We designed our system under the assumption that the application did not use any globally unique request identifiers to track a user’s request across various microservices.</p><p>To track causality, we took a slightly modified version of the approach taken by <a href="http://dl.acm.org/citation.cfm?id=945454">Aguilera et al</a> in their 2003 SOSP paper on performance profiling a distributed system of black boxes. For synchronous web services, the paper proposes a nesting algorithm that represents the distributed application as a graph of nodes (services), with edges representing interactions between nodes. The nesting algorithm examines the timestamps of calls between services to deduce causal relationships. Simply put, if service A calls service B, and service B talks to service C before returning a response to A, then the call B to C is said to be <em>caused by</em> the call A to B. By analyzing a large set of messages, we can derive call chains across services with statistical confidence measures and eliminate less likely alternatives. The original algorithm published in the paper is meant to operate in offline fashion on large trace sets. We modified the algorithm to operate on a moving window of packet streams and progressively refine the topology inference over time.</p><p>Figure 3 shows a partial workflow of jobs in the transaction tracing application. Figure 4 shows the transaction trace in a tenant application, deduced by the Spark application. Packet streams arrive in chunks, encapsulated in the PCAP format. Individual flows are extracted from packet streams and grouped into sliding windows, i.e., DStreams. Within a given time window, HTTP requests and corresponding responses are extracted by comparing the standard five tuple (src<em>ip, src</em>port, dest<em>ip, dest</em>port, protocol), forming the next DStream, which is then shipped off to the rest of the processing chain that implements the nesting algorithm (not shown in figure). We stored the output of the transaction tracing application into a time series data store (InfluxDB).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/0*HHQy2R-X2YESL0OS." /></figure><p>Figure 3. A subset of processing stages in the real-time transaction tracing application</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5q1AWqN91ANvxjub." /></figure><p>Figure 4. A single instance of a transaction trace across microservices, discovered by the transaction tracing application</p><p>The second Spark application is a standard batch analytics application that generates a service call graphs as well as call latency statistics during a given time window. The application is submitted as a standard batch job to the Spark job server. As illustrated in Figure 5, the batch analytics application pulls individual transaction traces out of InfluxDB and transforms them into a list of pairs, per transaction trace. The lists are then aggregated to form two RDDs, one containing a list of vertices and another, a list of edges. The vertices list is further de-duplicated based on the vertex name. Finally, the application’s call graph is computed in the form of a directed graph, along with statistics about the latencies on each edge in the graph. This graph is an instance of the application’s time-evolving graph, representing its state for a given time period. Figures 6 and 7 show the call graph and latency statistics of a tenant application, as output by the batch analytics job.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lb5Vcf7SLs3pGiS7." /></figure><p>Figure 5. Processing stages in the batch analytics application</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TFRmXTi4ZAxp0w4v." /></figure><p>Figure 6. Call graph discovered by the batch analytics application</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JhwTYyXDXguxzEge." /></figure><p>Figure 7. Mean inter-service call latencies computed by the batch analytics application</p><p>The Spark platform has enabled us to build different types of analytics applications such as batch processing, streaming and graph processing using a single unified big data platform.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=96d026083021" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Autoscaling in Kubernetes]]></title>
            <link>https://medium.com/@a0x8o/autoscaling-in-kubernetes-368ce36febee?source=rss-f624ae609dd4------2</link>
            <guid isPermaLink="false">https://medium.com/p/368ce36febee</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[large-scale-structure]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Alex T.]]></dc:creator>
            <pubDate>Mon, 08 May 2017 15:55:49 GMT</pubDate>
            <atom:updated>2017-05-08T16:04:18.702Z</atom:updated>
            <content:encoded><![CDATA[<p>Deployers of Kubernetes can respond to end user requests quickly and ship software faster than ever before. But what happens when you build a service that is even more popular than you planned for, and run out of compute? As of <a href="http://blog.kubernetes.io/2016/07/kubernetes-1.3-bridging-cloud-native-and-enterprise-workloads.html">Kubernetes 1.3</a>, we have a solution: autoscaling. On Google Cloud Platform and AWS, Kubernetes will automatically scale up your cluster as soon as you need it, and scale it back down to save you money when you don’t.</p><h3>Benefits of Autoscaling</h3><p>To understand better where autoscaling would provide the most value, let’s start with an example. Imagine you have a 24/7 production service with a load that is variable in time, where it is very busy during the day in the US, and relatively low at night. Ideally, we would want the number of nodes in the cluster and the number of pods in deployment to dynamically adjust to the load to meet end user demand. The new Cluster Autoscaling feature together with Horizontal Pod Autoscaler can handle this for you automatically.</p><h3>Setting Up Autoscaling on GCE</h3><p>The following instructions apply to GCE. For GKE please check the autoscaling section in cluster operations manual available <a href="https://cloud.google.com/container-engine/docs/clusters/operations#create_a_cluster_with_autoscaling">here</a>.</p><p>Before we begin, we need to have an active GCE project with Google Cloud Monitoring, Google Cloud Logging and Stackdriver enabled. For more information on project creation, please read our<a href="https://github.com/kubernetes/kubernetes/blob/master/docs/getting-started-guides/gce.md#prerequisites">Getting Started Guide</a>. We also need to download a recent version of Kubernetes project (version<a href="http://v1.3.0/">v1.3.0</a> or later).</p><p>First, we set up a cluster with Cluster Autoscaler turned on. The number of nodes in the cluster will start at 2, and autoscale up to a maximum of 5. To implement this, we’ll export the following environment variables:</p><p>export NUM_NODES=2<br>export KUBE_AUTOSCALER_MIN_NODES=2<br>export KUBE_AUTOSCALER_MAX_NODES=5<br>export KUBE_ENABLE_CLUSTER_AUTOSCALER=true</p><p>and start the cluster by running:</p><p>./cluster/kube-up.sh</p><p>The kube-up.sh script creates a cluster together with Cluster Autoscaler add-on. The autoscaler will try to add new nodes to the cluster if there are pending pods which could schedule on a new node.</p><p>Let’s see our cluster, it should have two nodes:</p><p>$ kubectl get nodes</p><p>NAME STATUS AGE<br>kubernetes-master Ready,SchedulingDisabled 2m<br>kubernetes-minion-group-de5q Ready 2m<br>kubernetes-minion-group-yhdx Ready 1m</p><h4>Run &amp; Expose PHP-Apache Server</h4><p>To demonstrate autoscaling we will use a custom docker image based on php-apache server. The image can be found <a href="https://github.com/kubernetes/kubernetes/blob/8caeec429ee1d2a9df7b7a41b21c626346b456fb/docs/user-guide/horizontal-pod-autoscaling/image">here</a>. It defines <a href="https://github.com/kubernetes/kubernetes/blob/8caeec429ee1d2a9df7b7a41b21c626346b456fb/docs/user-guide/horizontal-pod-autoscaling/image/index.php">index.php</a> page which performs some CPU intensive computations.</p><p>First, we’ll start a deployment running the image and expose it as a service:</p><p>$ kubectl run php-apache \<br>— image=gcr.io/google_containers/hpa-example \<br>— requests=cpu=500m,memory=500M — expose — port=80<br>service “php-apache” createddeployment “php-apache” created</p><p>Now, we will wait some time and verify that both the deployment and the service were correctly created and are running:</p><p>$ kubectl get deployment</p><p>NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE</p><p>php-apache 1 1 1 1 49s</p><p>$ kubectl get pods<br>NAME READY STATUS RESTARTS AGE<br>php-apache-2046965998-z65jn 1/1 Running 0 30s</p><p>We may now check that php-apache server works correctly by calling wget with the service’s address:</p><p>$ kubectl run -i — tty service-test — image=busybox /bin/sh<br>Hit enter for command prompt</p><p>$ wget -q -O- <a href="http://php-apache.default.svc.cluster.local/">http://php-apache.default.svc.cluster.local</a></p><p>OK!</p><h4>Starting Horizontal Pod Autoscaler</h4><p>Now that the deployment is running, we will create a Horizontal Pod Autoscaler for it. To create it, we will use kubectl autoscale command, which looks like this:</p><p>$ kubectl autoscale deployment php-apache — cpu-percent=50 — min=1 — max=10</p><p>This defines a Horizontal Ppod Autoscaler that maintains between 1 and 10 replicas of the Pods controlled by the php-apache deployment we created in the first step of these instructions. Roughly speaking, the horizontal autoscaler will increase and decrease the number of replicas (via the deployment) so as to maintain an average CPU utilization across all Pods of 50% (since each pod requests 500 milli-cores by <a href="https://github.com/kubernetes/kubernetes/blob/8caeec429ee1d2a9df7b7a41b21c626346b456fb/docs/user-guide/horizontal-pod-autoscaling/README.md#kubectl-run">kubectl run</a>, this means average CPU usage of 250 milli-cores). See<a href="https://github.com/kubernetes/kubernetes/blob/8caeec429ee1d2a9df7b7a41b21c626346b456fb/docs/design/horizontal-pod-autoscaler.md#autoscaling-algorithm">here</a> for more details on the algorithm.</p><p>We may check the current status of autoscaler by running:</p><p>$ kubectl get hpa</p><p>NAME REFERENCE TARGET CURRENT MINPODS MAXPODS AGE</p><p>php-apache Deployment/php-apache/scale 50% 0% 1 20 14s</p><p>Please note that the current CPU consumption is 0% as we are not sending any requests to the server (the CURRENT column shows the average across all the pods controlled by the corresponding replication controller).</p><h4>Raising the Load</h4><p>Now, we will see how our autoscalers (Cluster Autoscaler and Horizontal Pod Autoscaler) react on the increased load of the server. We will start two infinite loops of queries to our server (please run them in different terminals):</p><p>$ kubectl run -i — tty load-generator — image=busybox /bin/sh<br>Hit enter for command prompt<br>$ while true; do wget -q -O- <a href="http://php-apache.default.svc.cluster.local;/">http://php-apache.default.svc.cluster.local;</a> done</p><p>We need to wait a moment (about one minute) for stats to propagate. Afterwards, we will examine status of Horizontal Pod Autoscaler:</p><p>$ kubectl get hpa<br>NAME REFERENCE TARGET CURRENT MINPODS MAXPODS AGE<br>php-apache Deployment/php-apache/scale 50% 310% 1 20 2m</p><p>$ kubectl get deployment php-apache<br>NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE<br>php-apache 7 7 7 3 4m</p><p>Horizontal Pod Autoscaler has increased the number of pods in our deployment to 7. Let’s now check, if all the pods are running:</p><p>shakamunyi@mpk-barra204-m:~/k8s-src$ kubectl get pods<br>php-apache-2046965998–3ewo6 0/1 Pending 0 1m<br>php-apache-2046965998–8m03k 1/1 Running 0 1m<br>php-apache-2046965998-ddpgp 1/1 Running 0 5m<br>php-apache-2046965998-lrik6 1/1 Running 0 1m<br>php-apache-2046965998-nj465 0/1 Pending 0 1m<br>php-apache-2046965998-tmwg1 1/1 Running 0 1m<br>php-apache-2046965998-xkbw1 0/1 Pending 0 1m</p><p>As we can see, some pods are pending. Let’s describe one of pending pods to get the reason of the pending state:</p><p>$ kubectl describe pod php-apache-2046965998–3ewo6<br>Name: php-apache-2046965998–3ewo6<br>Namespace: default<br>…</p><p>Events:</p><p>FirstSeen From SubobjectPath Type Reason Message<br>1m {default-scheduler } Warning FailedScheduling pod (php-apache-2046965998–3ewo6) failed to fit in any node<br>fit failure on node (kubernetes-minion-group-yhdx): Insufficient CPU<br>fit failure on node (kubernetes-minion-group-de5q): Insufficient CPU<br>1m {cluster-autoscaler } Normal TriggeredScaleUp pod triggered scale-up, mig: kubernetes-minion-group, sizes (current/new): 2/3</p><p>The pod is pending as there was no CPU in the system for it. We see there’s a TriggeredScaleUp event connected with the pod. It means that the pod triggered reaction of Cluster Autoscaler and a new node will be added to the cluster. Now we’ll wait for the reaction (about 3 minutes) and list all nodes:</p><p>$ kubectl get nodes<br>NAME STATUS AGE<br>kubernetes-master Ready,SchedulingDisabled 9m<br>kubernetes-minion-group-6z5i Ready 43s<br>kubernetes-minion-group-de5q Ready 9m<br>kubernetes-minion-group-yhdx Ready 9m</p><p>As we see a new node kubernetes-minion-group-6z5i was added by Cluster Autoscaler. Let’s verify that all pods are now running:</p><p>$ kubectl get pods<br>NAME READY STATUS RESTARTS AGE<br>php-apache-2046965998–3ewo6 1/1 Running 0 3m<br>php-apache-2046965998–8m03k 1/1 Running 0 3m<br>php-apache-2046965998-ddpgp 1/1 Running 0 7m<br>php-apache-2046965998-lrik6 1/1 Running 0 3m<br>php-apache-2046965998-nj465 1/1 Running 0 3m<br>php-apache-2046965998-tmwg1 1/1 Running 0 3m<br>php-apache-2046965998-xkbw1 1/1 Running 0 3m</p><p>After the node addition all php-apache pods are running!</p><h4>Stop Load</h4><p>We will finish our example by stopping the user load. We’ll terminate both infinite while loops sending requests to the server and verify the result state:</p><p>$ kubectl get hpa<br>NAME REFERENCE TARGET CURRENT MINPODS MAXPODS AGE<br>php-apache Deployment/php-apache/scale 50% 0% 1 10 16m</p><p>$ kubectl get deployment php-apache<br>NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE<br>php-apache 1 1 1 1 14m</p><p>As we see, in the presented case CPU utilization dropped to 0, and the number of replicas dropped to 1.</p><p>After deleting pods most of the cluster resources are unused. Scaling the cluster down may take more time than scaling up because Cluster Autoscaler makes sure that the node is really not needed so that short periods of inactivity (due to pod upgrade etc) won’t trigger node deletion (see cluster autoscaler doc). After approximately 10–12 minutes you can verify that the number of nodes in the cluster dropped:</p><p>$ kubectl get nodes<br>NAME STATUS AGE<br>kubernetes-master Ready,SchedulingDisabled 37m<br>kubernetes-minion-group-de5q Ready 36m<br>kubernetes-minion-group-yhdx Ready 36m</p><p>The number of nodes in our cluster is now two again as node kubernetes-minion-group-6z5iwas removed by Cluster Autoscaler.</p><h3>Other use cases</h3><p>As we have shown, it is very easy to dynamically adjust the number of pods to the load using a combination of Horizontal Pod Autoscaler and Cluster Autoscaler.</p><p>However Cluster Autoscaler alone can also be quite helpful whenever there are irregularities in the cluster load. For example, clusters related to development or continuous integration tests can be less needed on weekends or at night. Batch processing clusters may have periods when all jobs are over and the new will only start in couple hours. Having machines that do nothing is a waste of money.</p><p>In all of these cases Cluster Autoscaler can reduce the number of unused nodes and give quite significant savings because you will only pay for these nodes that you actually need to run your pods. It also makes sure that you always have enough compute power to run your tasks.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=368ce36febee" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction To InfraKit]]></title>
            <link>https://medium.com/@a0x8o/introduction-to-infrakit-f84d6cec42e0?source=rss-f624ae609dd4------2</link>
            <guid isPermaLink="false">https://medium.com/p/f84d6cec42e0</guid>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[containers]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Alex T.]]></dc:creator>
            <pubDate>Sat, 12 Nov 2016 21:57:39 GMT</pubDate>
            <atom:updated>2016-11-12T21:57:39.272Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Introduction To InfraKit</strong></p><p>In case you missed it, Solomon Hykes (Docker Founder and CTO) open sourced InfraKit during his keynote address at LinuxCon Europe in Berlin last month. InfraKit is a declarative management toolkit for orchestrating infrastructure built by two Docker core team engineers, David Chung and Bill Farner. Read this blog post to learn more about InfraKit origins, internals and plugins including groups, instances and flavors.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*xio9ejIjQLEediujMjIoeA.png" /></figure><p>During this online meetup, David and Bill explained what InfraKit is, what problems it solves, some use cases, how you can contribute and what’s coming next.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FXrnosQIFGCg%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DXrnosQIFGCg&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FXrnosQIFGCg%2Fhqdefault.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b06966c80210240e8f0390478ec03eda/href">https://medium.com/media/b06966c80210240e8f0390478ec03eda/href</a></iframe><p></p><p>There are many ways you can participate in the development of the project and influence the roadmap:</p><p>Star the project on GitHub to follow issues and development</p><p>Help define and implement new and interesting plugins</p><p>Instance plugins to support different infrastructure providers</p><p>Flavor plugins to support a variety of systems like etcd or mysql clusters</p><p>Group controller plugins like metrics-driven auto scaling and more</p><p>Help define interfaces and implement new infrastructure resource types for things like load balancers, networks and storage volume provisioners</p><p>Check out the InfraKit repository README for more info, a quick tutorial and to start experimenting – from plain files to Terraform integration to building a Zookeeper ensemble. Have a look, explore and send us a PR or open an issue with your ideas!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f84d6cec42e0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kubernetes Federation — Achieving Higher Availability for your Applications]]></title>
            <link>https://medium.com/@a0x8o/kubernetes-federation-achieving-higher-availability-for-your-applications-1d527e5e4b3?source=rss-f624ae609dd4------2</link>
            <guid isPermaLink="false">https://medium.com/p/1d527e5e4b3</guid>
            <dc:creator><![CDATA[Alex T.]]></dc:creator>
            <pubDate>Wed, 09 Nov 2016 20:11:50 GMT</pubDate>
            <atom:updated>2016-11-09T20:11:50.784Z</atom:updated>
            <content:encoded><![CDATA[<p>As Kubernetes users scale their production deployments we’ve heard a clear desire to deploy services across zone, region, cluster and cloud boundaries. Services that span clusters provide geographic distribution, enable hybrid and multi-cloud scenarios and improve the level of high availability beyond single cluster multi-zone deployments. Customers who want their services to span one or more (possibly remote) clusters, need them to be reachable in a consistent manner from both within and outside their clusters.</p><p>Note: Though the examples used here leverage Google Container Engine (<a href="https://cloud.google.com/container-engine/">GKE</a>) to provision Kubernetes clusters, they work anywhere you want to deploy Kubernetes.</p><p>Let’s get started. The first step is to create is to create Kubernetes clusters into 4 Google Cloud Platform (GCP) regions using GKE.</p><ul><li>asia-east1-b</li><li>europe-west1-b</li><li>us-east1-b</li><li>us-central1-b</li></ul><p>Let’s run the following commands to build the clusters:</p><p>gcloud container clusters create gce-asia-east1 \</p><p>— scopes cloud-platform \</p><p>— zone asia-east1-b</p><p>gcloud container clusters create gce-europe-west1 \</p><p>— scopes cloud-platform \</p><p>— zone=europe-west1-b</p><p>gcloud container clusters create gce-us-east1 \</p><p>— scopes cloud-platform \</p><p>— zone=us-east1-b</p><p>gcloud container clusters create gce-us-central1 \</p><p>— scopes cloud-platform \</p><p>— zone=us-central1-b</p><p>Let’s verify the clusters are created:</p><p>gcloud container clusters list</p><p>NAME ZONE MASTER_VERSION MASTER_IP NUM_NODES STATUS<br>gce-asia-east1 asia-east1-b 1.2.4 104.XXX.XXX.XXX 3 RUNNING<br>gce-europe-west1 europe-west1-b 1.2.4 130.XXX.XX.XX 3 RUNNING<br>gce-us-central1 us-central1-b 1.2.4 104.XXX.XXX.XX 3 RUNNING<br>gce-us-east1 us-east1-b 1.2.4 104.XXX.XX.XXX 3 RUNNING</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/769/0*Vzr989G2V7ywGqtO." /></figure><p>The next step is to bootstrap the clusters and deploy the federation control plane on one of the clusters that has been provisioned. If you’d like to follow along, refer to Kelsey Hightower’s <a href="https://github.com/kelseyhightower/kubernetes-cluster-federation">tutorial</a> which walks through the steps involved.</p><p><strong>Federated Services</strong></p><p><a href="https://github.com/kubernetes/kubernetes/blob/release-1.3/docs/design/federated-services.md">Federated Services</a> are directed to the Federation API endpoint and specify the desired properties of your service.</p><p>Once created, the Federated Service automatically:</p><ol><li>creates matching Kubernetes Services in every cluster underlying your cluster federation,</li><li>monitors the health of those service “shards” (and the clusters in which they reside), and</li><li>manages a set of DNS records in a public DNS provider (like Google Cloud DNS, or AWS Route 53), thus ensuring that clients of your federated service can seamlessly locate an appropriate healthy service endpoint at all times, even in the event of cluster, availability zone or regional outages.</li></ol><p>Clients inside your federated Kubernetes clusters (i.e. Pods) will automatically find the local shard of the federated service in their cluster if it exists and is healthy, or the closest healthy shard in a different cluster if it does not.</p><p>Federations of Kubernetes Clusters can include clusters running in different cloud providers (e.g. GCP, AWS), and on-premise (e.g. on OpenStack). All you need to do is create your clusters in the appropriate cloud providers and/or locations, and register each cluster’s API endpoint and credentials with your Federation API Server.</p><p>In our example, we have clusters created in 4 regions along with a federated control plane API deployed in one of our clusters, that we’ll be using to provision our service. See diagram below for visual representation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*HA9QZfP0waadE2Bh." /></figure><p><strong>Creating a Federated Service</strong></p><p>Let’s list out all the clusters in our federation:</p><p>kubectl — context=federation-cluster get clusters</p><p>NAME STATUS VERSION AGE<br>gce-asia-east1 Ready 1m<br>gce-europe-west1 Ready 57s<br>gce-us-central1 Ready 47s<br>gce-us-east1 Ready 34s</p><p>Let’s create a federated service object:</p><p>kubectl — context=federation-cluster create -f services/nginx.yaml</p><p>The ‘ — context=federation-cluster’ flag tells kubectl to submit the request to the Federation API endpoint, with the appropriate credentials. The federated service will automatically create and maintain matching Kubernetes services in all of the clusters underlying your federation.</p><p>You can verify this by checking in each of the underlying clusters, for example:</p><p>kubectl — context=gce-asia-east1a get svc nginx<br>NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE<br>nginx 10.63.250.98 104.199.136.89 80/TCP 9m</p><p>The above assumes that you have a context named ‘gce-asia-east1a’ configured in your client for your cluster in that zone. The name and namespace of the underlying services will automatically match those of the federated service that you created above.</p><p>The status of your Federated Service will automatically reflect the real-time status of the underlying Kubernetes services, for example:</p><p>kubectl — context=federation-cluster describe services nginx</p><p>Name: nginx<br>Namespace: default<br>Labels: run=nginx<br>Selector: run=nginx<br>Type: LoadBalancer<br>IP: <br>LoadBalancer Ingress: 104.XXX.XX.XXX, 104.XXX.XX.XXX, 104.XXX.XX.XXX, 104.XXX.XXX.XX<br>Port: http 80/TCP<br>Endpoints: &lt;none&gt;<br>Session Affinity: None<br>No events.</p><p>The ‘LoadBalancer Ingress’ addresses of your federated service corresponds with the ‘LoadBalancer Ingress’ addresses of all of the underlying Kubernetes services. For inter-cluster and inter-cloud-provider networking between service shards to work correctly, your services need to have an externally visible IP address. Service Type: Loadbalancer is typically used here.</p><p>Note also what we have not yet provisioned any backend Pods to receive the network traffic directed to these addresses (i.e. ‘Service Endpoints’), so the federated service does not yet consider these to be healthy service shards, and has accordingly not yet added their addresses to the DNS records for this federated service.</p><p><strong>Adding Backend Pods</strong></p><p>To render the underlying service shards healthy, we need to add backend Pods behind them. This is currently done directly against the API endpoints of the underlying clusters (although in future the Federation server will be able to do all this for you with a single command, to save you the trouble). For example, to create backend Pods in our underlying clusters:</p><p>for CLUSTER in asia-east1-a europe-west1-a us-east1-a us-central1-a<br>do<br>kubectl — context=$CLUSTER run nginx — image=nginx:1.11.1-alpine — port=80<br>done</p><p><strong>Verifying Public DNS Records</strong></p><p>Once the Pods have successfully started and begun listening for connections, Kubernetes in each cluster (via automatic health checks) will report them as healthy endpoints of the service in that cluster. The cluster federation will in turn consider each of these service ‘shards’ to be healthy, and place them in serving by automatically configuring corresponding public DNS records. You can use your preferred interface to your configured DNS provider to verify this. For example, if your Federation is configured to use Google Cloud DNS, and a managed DNS domain ‘example.com’:</p><p>$ gcloud dns managed-zones describe example-dot-com</p><p>creationTime: ‘2016–06–26T18:18:39.229Z’<br>description: Example domain for Kubernetes Cluster Federation<br>dnsName: example.com.<br>id: ‘3229332181334243121’<br>kind: dns#managedZone<br>name: example-dot-com<br>nameServers:<br>- ns-cloud-a1.googledomains.com.<br>- ns-cloud-a2.googledomains.com.<br>- ns-cloud-a3.googledomains.com.<br>- ns-cloud-a4.googledomains.com.</p><p>$ gcloud dns record-sets list — zone example-dot-com</p><p>NAME TYPE TTL DATA<br>example.com. NS 21600 ns-cloud-e1.googledomains.com., ns-cloud-e2.googledomains.com.<br>example.com. SOA 21600 ns-cloud-e1.googledomains.com. cloud-dns-hostmaster.google.com. 1 21600 3600 1209600 300<br>nginx.mynamespace.myfederation.svc.example.com. A 180 104.XXX.XXX.XXX, 130.XXX.XX.XXX, 104.XXX.XX.XXX, 104.XXX.XXX.XX<br>nginx.mynamespace.myfederation.svc.us-central1-a.example.com. A 180 104.XXX.XXX.XXX<br>nginx.mynamespace.myfederation.svc.us-central1.example.com.<br>nginx.mynamespace.myfederation.svc.us-central1.example.com. A 180 104.XXX.XXX.XXX, 104.XXX.XXX.XXX, 104.XXX.XXX.XXX<br>nginx.mynamespace.myfederation.svc.asia-east1-a.example.com. A 180 130.XXX.XX.XXX<br>nginx.mynamespace.myfederation.svc.asia-east1.example.com.<br>nginx.mynamespace.myfederation.svc.asia-east1.example.com. A 180 130.XXX.XX.XXX, 130.XXX.XX.XXX<br>nginx.mynamespace.myfederation.svc.europe-west1.example.com. CNAME 180 nginx.mynamespace.myfederation.svc.example.com.<br>… etc.</p><p>Note: If your Federation is configured to use AWS Route53, you can use one of the equivalent AWS tools, for example:</p><p>$aws route53 list-hosted-zones</p><p>and</p><p>$aws route53 list-resource-record-sets — hosted-zone-id Z3ECL0L9QLOVBX</p><p>Whatever DNS provider you use, any DNS query tool (for example ‘dig’ or ‘nslookup’) will of course also allow you to see the records created by the Federation for you.</p><p><strong>Discovering a Federated Service from pods Inside your Federated Clusters</strong></p><p>By default, Kubernetes clusters come preconfigured with a cluster-local DNS server (‘KubeDNS’), as well as an intelligently constructed DNS search path which together ensure that DNS queries like “myservice”, “myservice.mynamespace”, “bobsservice.othernamespace” etc issued by your software running inside Pods are automatically expanded and resolved correctly to the appropriate service IP of services running in the local cluster.</p><p>With the introduction of Federated Services and Cross-Cluster Service Discovery, this concept is extended to cover Kubernetes services running in any other cluster across your Cluster Federation, globally. To take advantage of this extended range, you use a slightly different DNS name (e.g. myservice.mynamespace.myfederation) to resolve federated services. Using a different DNS name also avoids having your existing applications accidentally traversing cross-zone or cross-region networks and you incurring perhaps unwanted network charges or latency, without you explicitly opting in to this behavior.</p><p>So, using our NGINX example service above, and the federated service DNS name form just described, let’s consider an example: A Pod in a cluster in the us-central1-a availability zone needs to contact our NGINX service. Rather than use the service’s traditional cluster-local DNS name (“nginx.mynamespace”, which is automatically expanded to”nginx.mynamespace.svc.cluster.local”) it can now use the service’s Federated DNS name, which is”nginx.mynamespace.myfederation”. This will be automatically expanded and resolved to the closest healthy shard of my NGINX service, wherever in the world that may be. If a healthy shard exists in the local cluster, that service’s cluster-local (typically 10.x.y.z) IP address will be returned (by the cluster-local KubeDNS). This is exactly equivalent to non-federated service resolution.</p><p>If the service does not exist in the local cluster (or it exists but has no healthy backend pods), the DNS query is automatically expanded to `”nginx.mynamespace.myfederation.svc.us-central1-a.example.com”. Behind the scenes, this is finding the external IP of one of the shards closest to my availability zone. This expansion is performed automatically by KubeDNS, which returns the associated CNAME record. This results in a traversal of the hierarchy of DNS records in the above example, and ends up at one of the external IP’s of the Federated Service in the local us-central1 region.</p><p>It is also possible to target service shards in availability zones and regions other than the ones local to a Pod by specifying the appropriate DNS names explicitly, and not relying on automatic DNS expansion. For example, “nginx.mynamespace.myfederation.svc.europe-west1.example.com” will resolve to all of the currently healthy service shards in Europe, even if the Pod issuing the lookup is located in the U.S., and irrespective of whether or not there are healthy shards of the service in the U.S. This is useful for remote monitoring and other similar applications.</p><p><strong>Discovering a Federated Service from Other Clients Outside your Federated Clusters</strong></p><p>For external clients, automatic DNS expansion described is no longer possible. External clients need to specify one of the fully qualified DNS names of the federated service, be that a zonal, regional or global name. For convenience reasons, it is often a good idea to manually configure additional static CNAME records in your service, for example:</p><p>eu.nginx.acme.com CNAME nginx.mynamespace.myfederation.svc.europe-west1.example.com.<br>us.nginx.acme.com CNAME nginx.mynamespace.myfederation.svc.us-central1.example.com.<br>nginx.acme.com CNAME nginx.mynamespace.myfederation.svc.example.com.</p><p>That way your clients can always use the short form on the left, and always be automatically routed to the closest healthy shard on their home continent. All of the required failover is handled for you automatically by Kubernetes Cluster Federation.</p><p><strong>Handling Failures of Backend Pods and Whole Clusters</strong></p><p>Standard Kubernetes service cluster-IP’s already ensure that non-responsive individual Pod endpoints are automatically taken out of service with low latency. The Kubernetes cluster federation system automatically monitors the health of clusters and the endpoints behind all of the shards of your federated service, taking shards in and out of service as required. Due to the latency inherent in DNS caching (the cache timeout, or TTL for federated service DNS records is configured to 3 minutes, by default, but can be adjusted), it may take up to that long for all clients to completely fail over to an alternative cluster in in the case of catastrophic failure. However, given the number of discrete IP addresses which can be returned for each regional service endpoint (see e.g. us-central1 above, which has three alternatives) many clients will fail over automatically to one of the alternative IP’s in less time than that given appropriate configuration.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1d527e5e4b3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Docker Security: What You Need to Know]]></title>
            <link>https://medium.com/@a0x8o/docker-security-what-you-need-to-know-388d5f701ea?source=rss-f624ae609dd4------2</link>
            <guid isPermaLink="false">https://medium.com/p/388d5f701ea</guid>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Alex T.]]></dc:creator>
            <pubDate>Thu, 27 Oct 2016 01:29:38 GMT</pubDate>
            <atom:updated>2016-10-27T01:29:38.766Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Docker Security: What You Need to Know</strong></p><p>How secure is Docker? In the early days, the answer to that question from many Ops professionals would have been “not very.” To be fair, when Docker was first launched in 2013, it lacked some of the the robust security features and tools to make containers secure enough for enterprise adoption.</p><p>Much has changed since 2013. Docker now benefits from a range of security enhancements that are built into the platform. And depending on how exactly an organisation intends to use Docker containers, there are additional tools and design approaches available to make Docker even more secure.</p><p>Below, we take a look at the current state of Docker security, and what users can do to make sure Docker is as secure as possible in production environments.</p><p><strong>Purpose-built security tools for Docke</strong>r</p><p>As Docker has grown in popularity, so has the suite of tools available to help secure containers.</p><p>One important set of tools are image scanners. Tools like Clair by CoreOS and Docker Security Scanning integrated into the Docker Hub can check for vulnerabilities in images automatically, saving a lot of time. They can also send notifications over email when a vulnerability is detected and look for fixes.</p><p>Twistlock is a security suite for containers that provides a multi-faceted approach, which covers many areas of security. It not only hardens container applications, but also provides monitoring, analysis and response to threats. This addresses the visibility problems that companies face when using containers, as well as a host of other security vulnerabilities. It also solves the issue of unfamiliarity that many users have with containers in comparison to VMs, making containers harder to secure in some cases. Twistlock is one of the few commercially available solutions that focuses exclusively on securing Docker.</p><p><strong>Docker’s own efforts to secure containers</strong></p><p>Docker has introduced a number of security updates and features over the past several years, which have fixed a lot of the security issues that left people hesitant to adopt Docker when it first launched in 2013. These developments have made Docker easier to use in the enterprise, and help to explain the growth of Docker in production environments.</p><p>Some of the more basic security solutions that harken back to Docker’s early days are Namespaces and CGroups. Namespaces provide the first and most straightforward form of isolation between containers, preventing them from interacting with each other. User Namespaces allow for different privileges, which can be assigned on a granular level to different users.</p><p>CGroups can restrict the amount of resources that a container is allowed to use. For example, they can limit the availability of resources like memory and processing power on a per-container basis. Hard limits can be applied to containers to make sure that processes are killed if they start taking too many resources, providing a safeguard against exploitation by an external source..</p><p>Docker has also developed Docker Bench, a script that can test containers and their hosts’ security configurations against a set of best practices provided by the Center for Internet Security.</p><p>Docker Swarm, which as of Docker version 1.12 is built into Docker, also provides some security features. It secures nodes with Transport Layer Security (TLS) certificates and encrypts communication between nodes.</p><p>Finally, Docker content trust is a very elegant solution to ensuring that containers aren’t compromised and that provenance and traceability is maintained.</p><p><strong>Docker in a hosted environment</strong></p><p>Another way to help add security to a Docker deployment, especially for organisations without a high level of experience working with Docker, is to use managed hosting platforms for running Docker. This approach offers the convenience of simplified management and some built-in security features.</p><p>One example is Amazon’s EC2 container service (abbreviated as ECS), which can run Docker containers while enveloping them in additional security features, such as Identity and Access Management (IAM) roles and permissions. Azure and Google Cloud also offer their own managed Docker services, with security best practices built in.</p><p>Beyond this, Docker&#39;s commercial Docker Datacenter product or Docker cloud product is the best way to run enterprise containers securely behind the firewall or in the cloud.</p><p><strong>Summary</strong></p><p>On the whole, taking a look at how Docker has improved over the years, it can be safely said that Docker is significantly more secure today compared to when it was first released. While security fears about Docker early on were reasonable, Docker now benefits from a number of security enhancements that make it ready for any type of enterprise production environment</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=388d5f701ea" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Spark and Zeppelin to process big data on Kubernetes 1.2]]></title>
            <link>https://medium.com/apache-zeppelin-stories/using-spark-and-zeppelin-to-process-big-data-on-kubernetes-1-2-c5623331773?source=rss-f624ae609dd4------2</link>
            <guid isPermaLink="false">https://medium.com/p/c5623331773</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[apache-spark]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[apache-zeppelin]]></category>
            <dc:creator><![CDATA[Alex T.]]></dc:creator>
            <pubDate>Tue, 27 Sep 2016 18:41:46 GMT</pubDate>
            <atom:updated>2016-09-28T02:00:27.077Z</atom:updated>
            <content:encoded><![CDATA[<p>With big data usage growing exponentially, many Kubernetes customers have expressed interest in running <a href="http://spark.apache.org/">Apache Spark</a> on their Kubernetes clusters to take advantage of the portability and flexibility of containers. Fortunately, with Kubernetes 1.2, you can now have a platform that runs Spark and Zeppelin, and your other applications side-by-side.</p><h3>Why Zeppelin?</h3><p><a href="https://zeppelin.incubator.apache.org/">Apache Zeppelin</a> is a web-based notebook that enables interactive data analytics. As one of its backends, Zeppelin connects to Spark. Zeppelin allows the user to interact with the Spark cluster in a simple way, without having to deal with a command-line interpreter or a Scala compiler.</p><h3>Why Kubernetes?</h3><p>There are many ways to run Spark outside of Kubernetes:</p><ul><li>You can run it using dedicated resources, in Standalone mode</li><li>You can run it on a <a href="https://hadoop.apache.org/docs/current/hadoop-yarn/hadoop-yarn-site/YARN.html">YARN</a> cluster, co-resident with Hadoop and HDFS</li><li>You can run it on a <a href="http://mesos.apache.org/">Mesos</a> cluster alongside other Mesos applications</li></ul><p>So why would you run Spark on Kubernetes?</p><ul><li>A single, unified interface to your cluster: Kubernetes can manage a broad range of workloads; no need to deal with YARN/HDFS for data processing and a separate container orchestrator for your other applications.</li><li>Increased server utilization: share nodes between Spark and cloud-native applications. For example, you may have a streaming application running to feed a streaming Spark pipeline, or a nginx pod to serve web traffic — no need to statically partition nodes.</li><li>Isolation between workloads: Kubernetes’ <a href="https://github.com/kubernetes/kubernetes/blob/release-1.2/docs/proposals/resource-qos.md">Quality of Service</a> mechanism allows you to safely co-schedule batch workloads like Spark on the same nodes as latency-sensitive servers.</li></ul><h3>Launch Spark</h3><p>For this demo, we’ll be using <a href="https://cloud.google.com/container-engine/">Google Container Engine</a> (GKE), but this should work anywhere you have installed a Kubernetes cluster. First, create a Container Engine cluster with storage-full scopes. These Google Cloud Platform scopes will allow the cluster to write to a private Google Cloud Storage Bucket (we’ll get to why you need that later):</p><pre>$ gcloud container clusters create spark --scopes storage-full <br>--machine-type n1-standard-4</pre><p><em>Note</em>: We’re using n1-standard-4 (which are larger than the default node size) to demonstrate some features of Horizontal Pod Autoscaling. However, Spark works just fine on the default node size of n1-standard-1.</p><p>After the cluster’s created, you’re ready to launch Spark on Kubernetes using the config files in the Kubernetes GitHub repo:</p><pre>$ git clone <a href="https://github.com/kubernetes/kubernetes.git">https://github.com/kubernetes/kubernetes.git</a><br>$ kubectl create -f kubernetes/examples/spark</pre><p>‘kubernetes/examples/spark’ is a directory, so this command tells kubectl to create all of the Kubernetes objects defined in all of the YAML files in that directory. You don’t have to clone the entire repository, but it makes the steps of this demo just a little easier.</p><p>The pods (especially Apache Zeppelin) are somewhat large, so may take some time for Docker to pull the images. Once everything is running, you should see something similar to the following:</p><pre>$ kubectl get pods<br>NAME                            READY     STATUS    RESTARTS   AGE<br>spark-master-controller-v4v4y   1/1       Running   0          21h<br>spark-worker-controller-7phix   1/1       Running   0          21h<br>spark-worker-controller-hq9l9   1/1       Running   0          21h<br>spark-worker-controller-vwei5   1/1       Running   0          21h<br>zeppelin-controller-t1njl       1/1       Running   0          21h</pre><p>You can see that Kubernetes is running one instance of Zeppelin, one Spark master and three Spark workers.</p><h3>Set up the Secure Proxy to Zeppelin</h3><p>Next you’ll set up a secure proxy from your local machine to Zeppelin, so you can access the Zeppelin instance running in the cluster from your machine. (Note: You’ll need to change this command to the actual Zeppelin pod that was created on your cluster.)</p><pre>$ kubectl port-forward zeppelin-controller-t1njl 8080:8080</pre><p>This establishes a secure link to the Kubernetes cluster and pod (zeppelin-controller-t1njl) and then forwards the port in question (8080) to local port 8080, which will allow you to use Zeppelin safely.</p><h3>Now that I have Zeppelin up and running, what do I do with it?</h3><p>For our example, we’re going to show you how to build a simple movie recommendation model. This is based on the code <a href="http://spark.apache.org/docs/1.5.2/mllib-collaborative-filtering.html">on the Spark website</a>, modified slightly to make it interesting for Kubernetes.</p><p>Now that the secure proxy is up, visit <a href="http://localhost:8080/">http://localhost:8080/</a>. You should see an intro page like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*l4k1IklZ8uet0oo4.png" /></figure><p>Click “Import note,” give it an arbitrary name (e.g. “Movies”), and click “Add from URL.” For a URL, enter:</p><pre><a href="https://gist.githubusercontent.com/zmerlynn/875fed0f587d12b08ec9/raw/6">https://gist.githubusercontent.com/zmerlynn/875fed0f587d12b08ec9/raw/6</a><br>eac83e99caf712482a4937800b17bbd2e7b33c4/movies.json</pre><p>Then click “Import Note.” This will give you a ready-made Zeppelin note for this demo. You should now have a “Movies” notebook (or whatever you named it). If you click that note, you should see a screen similar to this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*A-LkPvweJn5_bjaw.png" /></figure><p>You can now click the Play button, near the top-right of the PySpark code block, and you’ll create a new, in-memory movie recommendation model! In the Spark application model, Zeppelin acts as a<a href="https://spark.apache.org/docs/1.5.2/cluster-overview.html">Spark Driver Program</a>, interacting with the Spark cluster master to get its work done. In this case, the driver program that’s running in the Zeppelin pod fetches the data and sends it to the Spark master, which farms it out to the workers, which crunch out a movie recommendation model using the code from the driver. With a larger data set in Google Cloud Storage (GCS), it would be easy to pull the data from GCS as well. In the next section, we’ll talk about how to save your data to GCS.</p><h3>Working with Google Cloud Storage (Optional)</h3><p>For this demo, we’ll be using Google Cloud Storage, which will let us store our model data beyond the life of a single pod. Spark for Kubernetes is built with the <a href="https://cloud.google.com/storage/">Google Cloud Storage</a> connector built-in. As long as you can access your data from a virtual machine in the Google Container Engine project where your Kubernetes nodes are running, you can access your data with the GCS connector on the Spark image.</p><p>If you want, you can change the variables at the top of the note so that the example will actually save and restore a model for the movie recommendation engine — just point those variables at a GCS bucket that you have access to. If you want to create a GCS bucket, you can do something like this on the command line:</p><pre>$ gsutil mb gs://my-spark-models</pre><p>You’ll need to change this URI to something that is unique for you. This will create a bucket that you can use in the example above.</p><p><strong>Note</strong>: Computing the model and saving it is much slower than computing the model and throwing it away. This is expected. However, if you plan to reuse a model, it’s faster to compute the model and save it and then restore it each time you want to use it, rather than throw away and recompute the model each time.</p><h3>Using Horizontal Pod Autoscaling with Spark (Optional)</h3><p>Spark is somewhat elastic to workers coming and going, which means we have an opportunity: we can use use <a href="http://kubernetes.io/docs/user-guide/horizontal-pod-autoscaling/">Kubernetes Horizontal Pod Autoscaling</a> to scale-out the Spark worker pool automatically, setting a target CPU threshold for the workers and a minimum/maximum pool size. This obviates the need for having to configure the number of worker replicas manually.</p><p>Create the Autoscaler like this (note: if you didn’t change the machine type for the cluster, you probably want to limit the — max to something smaller):</p><pre>$ kubectl autoscale --min=1 --cpu-percent=80 --max=10 \<br>  rc/spark-worker-controller</pre><p>To see the full effect of autoscaling, wait for the replication controller to settle back to one replica. Use ‘kubectl get rc’ and wait for the “replicas” column on spark-worker-controller to fall back to 1.</p><p>The workload we ran before ran too quickly to be terribly interesting for HPA. To change the workload to actually run long enough to see autoscaling become active, change the “rank = 100” line in the code to “rank = 200.” After you hit play, the Spark worker pool should rapidly increase to 20 pods. It will take up to 5 minutes after the job completes before the worker pool falls back down to one replica.</p><h3>Conclusion</h3><p>In this article, we showed you how to run Spark and Zeppelin on Kubernetes, as well as how to use Google Cloud Storage to store your Spark model and how to use Horizontal Pod Autoscaling to dynamically size your Spark worker pool.</p><p>This is the first in a series of articles we’ll be publishing on how to run big data frameworks on Kubernetes — so stay tuned!</p><p>Please join our community and help us build the future of Kubernetes! There are many ways to participate. If you’re particularly interested in Kubernetes and big data, you’ll be interested in:</p><ul><li>Our <a href="https://kubernetes.slack.com/messages/sig-big-data/">Big Data slack channel</a></li><li>Our <a href="https://groups.google.com/forum/#!forum/kubernetes-sig-big-data">Kubernetes Big Data Special Interest Group email list</a></li><li>The Big Data “Special Interest Group,” which meets every Monday at 1pm (13h00) Pacific Time at <a href="https://plus.google.com/hangouts/_/google.com/big-data">SIG-Big-Data hangout</a></li></ul><p>And of course for more information about the project in general, go to <a href="http://www.kubernetes.io/">www.kubernetes.io</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c5623331773" width="1" height="1" alt=""><hr><p><a href="https://medium.com/apache-zeppelin-stories/using-spark-and-zeppelin-to-process-big-data-on-kubernetes-1-2-c5623331773">Using Spark and Zeppelin to process big data on Kubernetes 1.2</a> was originally published in <a href="https://medium.com/apache-zeppelin-stories">Apache Zeppelin Stories</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Enterprise Data Lakes for Modern Analytics and Business Intelligence]]></title>
            <link>https://medium.com/@a0x8o/using-enterprise-data-lakes-for-modern-analytics-and-business-intelligence-e51da95e74f4?source=rss-f624ae609dd4------2</link>
            <guid isPermaLink="false">https://medium.com/p/e51da95e74f4</guid>
            <dc:creator><![CDATA[Alex T.]]></dc:creator>
            <pubDate>Sun, 10 Apr 2016 04:06:50 GMT</pubDate>
            <atom:updated>2016-04-10T04:15:03.315Z</atom:updated>
            <content:encoded><![CDATA[<p>“Big data” and “data lake” only have meaning to an organisation’s vision when they solve business problems by enabling data democratization, re-use, exploration, and analytics. Big data architectures, leveraging the data lake concept, are being used to improve search and analytics in highly innovative ways.</p><p><strong>What Is a Data Lake?</strong></p><p>A data lake is a large storage repository that holds a vast amount of raw data in its native format until it is needed. An “enterprise data lake” (EDL) is simply a data lake for enterprise-wide information storage and sharing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3evZXsOevewg8s64PxGt6Q.jpeg" /></figure><p><strong>What Are the Benefits of a Data Lake?</strong></p><p>The main benefit of a data lake is the centralization of disparate content sources. Once gathered together (from their “information silos”), these sources can be combined and processed using big data, search and analytics techniques which would have otherwise been impossible. The disparate content sources will often contain proprietary and sensitive information which will require implementation of the appropriate security measures in the data lake.</p><p>The security measures in the data lake may be assigned in a way that grants access to certain information to users of the data lake that do not have access to the original content source. These users are entitled to the information, yet unable to access it in its source for some reason.</p><p>Some users may not need to work with the data in the original content source but consume the data resulting from processes built into those sources. There may be a licensing limit to the original content source that prevents some users from getting their own credentials. In some cases, the original content source has been locked down, is obsolete or will be decommissioned soon; yet its content is still valuable to users of the data lake.</p><p>Once the content is in the data lake, it can be normalized and enriched. This can include metadata extraction, format conversion, augmentation, entity extraction, cross-linking, aggregation, de-normalization, or indexing. Read more about data preparation best practices. Data is prepared “as needed,” reducing preparation costs over up-front processing (such as would be required by data warehouses). A big data compute fabric makes it possible to scale this processing to include the largest possible enterprise-wide data sets.</p><p>Users, from different departments, potentially scattered around the globe, can have flexible access to the data lake and its content from anywhere. This increases re-use of the content and helps the organization to more easily collect the data required to drive business decisions.</p><p>Information is power, and a data lake puts enterprise-wide information into the hands of many more employees to make the organization as a whole smarter, more agile, and more innovative.</p><p><strong>Searching the Data Lake</strong></p><p>Data lakes will have tens of thousands of tables/files and billions of records. Even worse, this data is unstructured and widely varying.</p><p>In this environment, search is a necessary tool:</p><ul><li>To find tables that you need – based on table schema and table content</li><li>To extract sub-sets of records for further processing</li><li>To work with unstructured (or unknown-structured) data sets</li><li>And most importantly, to handle analytics at scale</li></ul><p>Only search engines can perform real-time analytics at billion-record scale with reasonable cost.</p><p>Search engines are the ideal tool for managing the enterprise data lake because:</p><ul><li>Search engines are easy to use – Everyone knows how to use a search engine.</li><li>Search engines are schema-free – Schemas do not need to be pre-defined. Search engines can handle records with varying schemas in the same index.</li><li>Search engines naturally scale to billions of records.</li><li>Search can sift through wholly unstructured content.</li></ul><p><strong>The State of Data Lake Adoption</strong></p><p>Radiant Advisors and Unisphere Research recently released “The Definitive Guide to the Data Lake,” a joint research project with the goal of clarifying the emerging data lake concept.</p><p>Two of the high-level findings from the research were:</p><ul><li>Data lakes are increasingly recognizable as both a viable and compelling component within a data strategy, with small and large companies continuing to adopt.</li><li>Governance and security are still top-of-mind as key challenges and success factors for the data lake.</li></ul><p>More and more research on data lakes is becoming available as companies are taking the leap to incorporate data lakes into their overall data management strategy. It is expected that, within the next few years, data lakes will be common and will continue to mature and evolve.</p><p><strong>Using Data Lakes in Biotech and Health Research – Two Enterprise Data Lake Examples</strong></p><p>We are currently working with two world-wide biotechnology / health research firms. There are many different departments within these organizations and employees have access to many different content sources from different business systems stored all over the world. The data includes:</p><ul><li>Manufacturing data (batch tests, batch yields, manufacturing line sensor data, HVAC and building systems data);</li><li>Research data (electronic notebooks, research runs, test results, equipment data);</li><li>Customer support data (tickets, responses); and</li><li>Public data sets (chemical structures, drug databases, MESH headings, proteins).</li></ul><p>Our projects focus on making structured and unstructured data searchable from a central data lake. The goal is to provide data access to business users in near real-time and improve visibility into the manufacturing and research processes. These enterprise data lake and big data architectures are built on Cloudera, which collects and processes all the raw data in one place, and then indexes that data into a Cloudera Search, Impala, and HBase for a unified search and analytics experience for end-users.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e51da95e74f4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Caring doesn’t scale]]></title>
            <link>https://medium.com/@a0x8o/caring-doesn-t-scale-ce0d7b24e2fa?source=rss-f624ae609dd4------2</link>
            <guid isPermaLink="false">https://medium.com/p/ce0d7b24e2fa</guid>
            <category><![CDATA[html5]]></category>
            <category><![CDATA[rest]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[Alex T.]]></dc:creator>
            <pubDate>Sat, 14 Nov 2015 20:25:56 GMT</pubDate>
            <atom:updated>2015-11-14T20:25:56.021Z</atom:updated>
            <content:encoded><![CDATA[<p>We are social creatures. We align ourselves in groups made of family, friends, co-workers, neighbors, etc. When we have similar interests in activities, beliefs, political leanings and shared experiences, these bonds are strong. When we occasionally bump into the same people on our way to work, we might smile and say hello, but these are much shallower interactions.</p><p>The sad reality is, we cannot care equally deeply about everyone. This doesn’t mean we are necessarily antagonistic to others, it is just that deep connections are time and energy consuming. There are even specific theories about <a href="https://en.wikipedia.org/wiki/Dunbar%27s_number">why this is so</a>. Caring simply doesn’t scale.</p><p>The same is true in distributed systems. Our software can establish highly intimate, shared relationships with other schemas, services and software, but they cannot do so with many other systems. It takes time to establish close relationships whether it is between friends or distributed sources of information. Anything that makes us care prevents us from scaling in terms of diversity of participants. We have to decide what systems are worth the coupling. What information is worth the cost of integration.</p><p>When we speak about Resource-Oriented systems, we are referring to a specific design orientation. We are thinking in terms of resources, an abstraction that covers documents, data, services, or concepts. We name them with resource identifiers and we interact with them (potentially) with specific protocols such as the Hypertext Transfer Protocol (HTTP). This is an idea anyone familiar with the Web has been exposed to, but it is easy to lose the thread when we get caught up in implementation details.</p><p>One of the central notions of the Web is that we separate the identity of a resource from its representation and implementation. The representation can take different forms for different clients but the identity of the document doesn’t change. The 3rd quarter sales report is still the third quarter sales report. A resume is still a resume.</p><p>Separating identity from representation allows clients to evolve independently from each other. Servers can support new uses without breaking existing consumers. It does not require separate endpoints to do so.</p><p>A client is coupled to the representation, not the server. This frees the server to evolve on its own terms as well. Browsers aren’t affected by shifts from one web server or container to another. They are impacted, however, by new features in the representation which is why HTML5 support took so long.</p><p>When you point a browser to a website it has never visited before, it doesn’t stop and ask for directions or documentation. It treats the resource you gave it like any other resource in the world and asks for it with an HTTP GET request. When a browser finds a link in a representation provided by the server, it doesn’t have to know how to build it up. It is told what to do, it doesn’t have to care about what is different about this URL compared to any other.</p><p>These ideas have produced our definition of scale. We freely exchange information with the world all day, every day because nobody has to care about the details. Everything just works so we share resource identifiers via SMS messages, Tweets, email messages, on web pages, blogs, advertisements, movie trailers, television shows, and even napkins.</p><p>As we try to apply these ideas more generally via the REpresentational State Transfer (REST), we often make poor choices that eliminate these properties. This isn’t going to be a RESTafarian Orthodoxy rant. You are free to build your systems the way you want. No one else really minds what you do other than you have to deal with the consequences. It is just perplexing that developers fail to understand that they are making their clients care more than they need to.</p><p>It is easy to mess this situation up unintentionally. We frequently see resource identifiers that involve the means of production (.php, FooServlet, .do), a specific serialization (.html, .xml) or a specific point in time (/v1). The problem here is you are either leaking details or conflating representation and identity. This increases the coupling between systems and the burden to interact. You are requiring the clients to know more beforehand and that is a form of caring. There is nothing intrinsically wrong with any of these choices, but they do have consequences and those accumulate.</p><p>Full-blown REST as an architectural style induces some fantastic properties that solve all kinds of problems in distributed systems. It certainly isn’t the only solution and is not universally applicable. However, it works in enough ways for enough systems that you probably need to prove why you can’t use it rather than require someone to convince you why you should.</p><p>It doesn’t solve all of the problems though. Even if you do fully support cleanly-defined URLs, hypermedia formats, and the semantics and intention of the HTTP methods, we are still left exchanging media types that describe specific domains. As the consumer of your API we need to know what you mean by the use of the term “title.” (name for a published work or a rank in English royalty?) You are projecting a collection of terms and domains via resources, but we still have to care.</p><p>And so, even if we exchange information in loosely-coupled ways, we end up creating integration tables in our relational systems, export, transform and load (ETL) processes, data warehouses, custom code libraries, and a bunch of other time and energy-consuming technologies. This is all a level of intimacy that also cannot scale, so we are limited in number to whom we can actually maintain these systemic relationships with.</p><p>Supporting a new data source becomes kind of like asking, “Can I really handle a new best friend?” Certainly we always like to meet compatible people and share our lives with them, but we often don’t let new folks in because we already have so many people making demands on our time.</p><p>Here’s the thing though, it needn’t be time consuming to make friends to play tennis, grab a beer, watch a play, or discuss a shared health issue. Not every acquaintance has to be a best friend and we could miss a lot in life if we don’t open ourselves to casual friendships.</p><p>A data integration doesn’t have to be a huge initiative either. The information in a spreadsheet might add insight to what is stored in a database. Content gleaned from a web site might enforce or discourage some other action we are motivated to pursue via our own world views and information systems.</p><p>Building upon the loose coupling of REST, we can envision larger webs of data that transcend where information is stored. If we adopt a consistent, extensible data model that uses standard identifiers and standard serialization formats, we can produce almost purely portable data. In the W3C standards surrounding the Semantic Web, we see exactly these capabilities in RDF, Turtle, Linked Data, etc.</p><p>If the cost of integration falls to almost nothing it becomes easier to support casual interactions. They may turn into more formal, long-lived integrations down the road, but for now we can exchange information with anyone at any time about any subject for way less effort than you probably can imagine given the pains you have seen elsewhere.</p><p>Our ability to do anything with this information isn’t immediately guaranteed, but freeing it from silos is the first step. Beyond that, having standard query languages and the ability to connect and reason over arbitrary domains builds upon our resource abstractions and Web interactions.</p><p>Even where there are impedance mismatches between the data models of Linked Data and the tools of the average developers, we now have solutions in bridge technologies like <a href="http://json-ld.org/">JSON-LD</a>. Those who want to think about the Big Picture can. Those who don’t want to do, don’t have to. You aren’t required to care.</p><p>If this all seems like fantasy, perhaps you are not paying close enough attention. We are on a trend as an industry and it scales remarkably well, and we have 26 years of proof under our belt. We see this trend playing out in the following diagram by <a href="http://twitter.com/aldonline">Aldo Bucci</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/0*b86KtA1Rnq1sPWQN.jpg" /></figure><p>We used to have disconnected computers that were time-consuming to connect. They had to care an awful lot about each other to communicate. As an industry, we adopted some standards (TCP/IP and DNS) that gave us a remarkable platform of interconnected computers. Nobody would have believed it before experiencing it, but we experience it every day on planes, buses, boats, trains and home, work, and school.</p><p>Once the computers could talk, exchanging documents was a painful process. Proprietary and brittle formats were time and energy-consuming to share. As an industry, we adopted a few more standards (HTTP and HTML) and we received a platform of interconnected documents. Again, it would have been inconceivable to anyone before they experienced it but here we are.</p><p>So, now, when we point out that the information stored in our silos can be connected with ease by the adoption of a few new standards, it should be a more tolerable statement to accept, but people still fight the idea. Even so, we are seeing these technologies being indexed by search engines and adopted by organizations in retail, publishing, life sciences, entertainment, government, military, and intelligence communities.</p><p>There is a lot to process here, but it starts with thinking in terms of resources. Resource-oriented architectures give us the Web, REST, and a means to exchange information freely. On that, we can build to support easily-integrated systems. The languages and technologies you use to implement these systems are independent choices based upon your needs, client requirements, staff, legacies, and projected future.</p><p>Don’t make us care about any of that and we’ll get along just fine.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ce0d7b24e2fa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting onboard with Docker]]></title>
            <link>https://medium.com/@a0x8o/getting-onboard-with-docker-1b49695a6b0a?source=rss-f624ae609dd4------2</link>
            <guid isPermaLink="false">https://medium.com/p/1b49695a6b0a</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[microservices]]></category>
            <dc:creator><![CDATA[Alex T.]]></dc:creator>
            <pubDate>Tue, 27 Oct 2015 14:09:39 GMT</pubDate>
            <atom:updated>2015-10-27T14:09:39.223Z</atom:updated>
            <content:encoded><![CDATA[<p>Are you interested in using <a href="http://opensource.com/resources/what-docker">Docker</a> to change the way you develop and package Linux applications? You’re not alone.</p><p>Docker, in a nutshell, is a low-overhead alternative to traditional virtualization. Rather than providing a truly virtualized environment all the way down to the hardware level, it provides a sandboxed environment for your application to run it with only the necessary libraries and operating system components needed to make it run.</p><p>From a developer’s perspective, this is great for a few reasons.</p><p>First, whatever development you do locally can be a good approximation of the actual live environment where your application will be deployed. Some might remember the “write once, run anywhere” motto once heralded by Java — while “run anywhere” isn’t precisely true, Docker definitely can remove some headaches created by difference in environments.</p><p>Second, it means that you can create this custom environment much faster than would be the case with a locally-run virtual machine. A Docker container can often be spun up in seconds, making immediate testing much easier.</p><p>Third, Docker creates a software defined environment for your code to run in. Your environment can be version controlled, modified, forked, and rolled back as needed.</p><p>Does all of this sound good? Great, let’s get started.</p><h3>Set up your development environment for Docker</h3><p>I’ll skip the obligatory installation instructions and getting started tutorial, because there are plenty of good resources for that already. For more on getting started, check out <a href="http://opensource.com/business/14/7/guide-docker">getting started with Docker</a> guide.</p><p>As you learn Docker, you’ll undoubtedly spent a good amount of time writing and editing Dockerfiles. Personally, I do pretty much everything in plain old fashioned text editors. At the command line, I’m a VIM fan. If you’re using VIM for your editing needs, be sure to find and install a syntax file for your Dockerfiles to make editing easier. I like <a href="https://github.com/ekalinin/Dockerfile.vim">this one</a> by Eugene Kalinin, but there are others out there. Similar syntax and autocomplete files are available for other text editors as well, so spend the time to find something that works for you.</p><p>What if you use a more full-featured integrated development environment? There are options for you, too. Eclipse has <a href="https://www.eclipse.org/community/eclipse_newsletter/2015/june/article3.php">integrated Docker tooling</a> to make development on that platform easier, and it integrates nicely with other tools, for example, if you are doing <a href="http://www.mastertheboss.com/soa-cloud/docker/manage-docker-images-from-eclipse">JBOSS development</a>.</p><p>I also find some of the default Docker commands to be a little unwieldy, so I alias some of them to make things easier at the command line. For example, I have this set in my .bashrc file to make container IDs a little easier to find and work with:</p><p>alias dl=”docker ps -l -q”</p><p>For some other great alias suggestions, check out <a href="https://github.com/tcnksm/docker-alias/blob/master/zshrc">this list</a>.</p><h3>Find the right base images to work with</h3><p>Docker containers are like their own little operating systems — and, in fact, they are!</p><p>If you’re using Docker in production, it’s important that you trust the underlying images upon which you base your containers. If you can’t trust each entity who modified your container and verify that chain of trust, you can’t be sure that your container is free from malicious code.</p><p>That said, for learning and doing simple development, there are a ton of base images out there to help you get started. Work with Java? Here’s a whole collection of <a href="https://deis.com/blog/2015/ready-made-java-containers-1">ready-made Java-based</a> images. How about Flask with <a href="https://github.com/OrangeTux/minimal-docker-python-setup">Python</a>, or <a href="https://www.packet.net/blog/how-to-run-your-rails-app-on-docker/">Ruby</a> on Rails? You name a stack, and there’s probably already a ready-to-go container out there for you to work with.</p><p>But wait a minute. Trace any container back to its original base image, and you’re probably going to find a familiar operating system, whether Fedora or Ubuntu or something else. Make sure the base image you’re selecting has the features and packages you require, and that you’re comfortable configuring it.</p><p>Of course, the <a href="https://hub.docker.com/">Docker Hub</a> is one place to find images that fit your needs, but it’s far from the only place.</p><h3>Find the right learning resources</h3><p>Docker has a great <a href="https://docs.docker.com/">documentation</a> section, but sooner or later, you’re going to have a question that is easier to figure out elsewhere or you might need a little help with.</p><p>The #docker channel on Freenode IRC is a great place to turn for help, but it’s not the only place. <a href="http://stackoverflow.com/questions/tagged/docker">Stack Overflow</a> also has a sizable Docker community, and there are a ton of great community-authored tutorials out there.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1b49695a6b0a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Microservices with Containers]]></title>
            <link>https://medium.com/@a0x8o/microservices-with-containers-5ad647451a57?source=rss-f624ae609dd4------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ad647451a57</guid>
            <category><![CDATA[mesos]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Alex T.]]></dc:creator>
            <pubDate>Fri, 23 Oct 2015 18:11:55 GMT</pubDate>
            <atom:updated>2015-10-23T18:11:55.607Z</atom:updated>
            <content:encoded><![CDATA[<p>The <a href="http://opensource.com/resources/what-are-microservices">microservices</a> architecture is far from a new trend; it’s generally accepted as a better way to build apps these days. The common way to build apps was, until a few years ago, the monolithic approach — which was, if you look at it from a functional perspective, basically one deployment unit that does everything. Monolithic apps are good for small scale teams and projects, but when you need something that has a larger scale and involves many teams, it starts to become problematic. It’s much harder to make changes, as the code base becomes bigger and more people make changes to it.</p><p>This is basically the exact opposite of all things continuous delivery, because it’s more tightly coupled and requires an exponentially growing amount of coordination to make continuous updates. Therefore updates become more painful and less frequent, contributing further to fragility of the application.</p><h3>So, what are microservices really and how does this architecture improve delivery cycles?</h3><p>Microservices were developed as a way to divide and conquer.</p><p>Basically, the microservices approach in a nutshell dictates that instead of having one giant code base that all developers touch, that often times becomes perilous to manage, that there are numerous smaller code bases managed by small and agile teams. The only dependency these code bases have on one another is their APIs. This means that as long as you maintain backwards and forward compatibility (which albeit is not that trivial), each team can work in release cycles that are decoupled from other teams. There are some scenarios where these release cycles are coupled, where one service depends on another or depends on a new feature in another service, but this is not the usual case.</p><p>Leading the pack on this at the time were companies like <a href="http://www.slideshare.net/adrianco/netflix-nosql-search">Netflix</a> or Amazon for example. They decided that instead of building one monolithic application to handle all aspects of their service, they would build small services that handle discrete business functions. The boundaries between these units are functional APIs that expose the core capabilities of each service. For Amazon.com, this would be the different aspects of their website — recommendations, shopping cart, invoicing, inventory management, and so forth. Instead of all of them being part of one ginormous deployment unit, Amazon implemented each function as a self-contained service with a well-defined interface. The advantage of this is that you can have disparate teams, each responsible for all aspects of their service from A to Z. So if there’s a team responsible for billing, they are responsible for everything from writing the code, testing it, pushing to production, handling failures and anything else that may happen with that service.</p><p>Needless to say, this is better for continuous delivery as small units are easier to manage, test and deploy.</p><h3>Ok, so what’s the open source connection?</h3><p>One example is Netflix. As leaders of this architectural trend, Netflix also built their many tools that facilitate their distributed and complex architecture as <a href="http://netflix.github.io/#repo">open source projects</a> that anyone can fork and customize, and this in a way influenced a long line of technologies that came in their wake as well. One such technology is Kubernetes that was specifically designed for microservices by extending Docker’s capabilities. This enables companies to choose the right tooling for the job, and quickly adopt them without complex licensing cycles, as well as adapt them and extend them for their specific architectural and business needs.</p><h3>Sounds too good to be true?</h3><p>Of course, with the good, there is always the bad. This creates a whole ‘nother set of problems like understanding system as a whole, what’s dependent on what, and when one service fails, there is much higher possibility that it will cause a cascading failure which is far harder to trace. For more information on the tradeoffs that come with a microservices architecture, read <a href="http://martinfowler.com/articles/microservices.html">this excellent piece</a> from ThoughtWorks.</p><blockquote><em>“Using services like this does have downsides. Remote calls are more expensive than in-process calls, and thus remote APIs need to be coarser-grained, which is often more awkward to use. If you need to change the allocation of responsibilities between components, such movements of behavior are harder to do when you’re crossing process boundaries.”</em></blockquote><h3>Why Docker is such a good fit for microservices?</h3><p>If we dive into technology, Docker is excellent for microservices, as it isolates containers to one process or service. This intentional containerization of single services or processes makes it very simple to manage and update these services. Therefore, it’s not surprising that the next wave on top of Docker has led to the emergence of frameworks for the sole purpose of managing more complex scenarios, such as: how to manage single services in a cluster, or multiple instances in a service across hosts, or how to coordinate between multiple services on a deployment and management level.</p><p>To this end, we’ve seen open source projects like <a href="https://github.com/googlecloudplatform/kubernetes">Kubernetes</a>, <a href="https://github.com/signalfuse/maestro-ng">Maestro-ng</a>, <a href="http://mesos.apache.org/">Mesos</a>and <a href="https://coreos.com/docs/launching-containers/launching/launching-containers-fleet/">Fleet</a><a href="https://coreos.com/docs/launching-containers/launching/launching-containers-fleet/"> </a>spring up to answer this growing need. If we take a look at Kubernetes for instance, which is really gaining traction right now, it is backed by Google and is now seeing leading players like Microsoft and Red Hat join in; this project was built for microservices, by providing a few key functionalities.</p><p>With Kubernetes you can easily deploy and manage multiple Docker containers of the same type through an intelligent tagging system. You basically describe the characteristics of the image you’d like to deploy — e.g. number of instances, CPU, RAM — and Kubernetes will allocate it for you based on what is physically available on the set of hosts you’re deploying too. You don’t need to care where these are located physically, since the tagging system enables you to uniquely identify your images. On top of the tagging, you can create another level of grouping called “pods” that are essentially a continuous query for containers that have one or more tags. Kubernetes constantly updates the set of containers that satisfy the query and implements load balancing across these containers so that there’s a single endpoint for anyone accessing them from the outside.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/520/0*WmPs5BmcP09Zqzv_.png" /></figure><p><em>Courtesy of </em><a href="http://slidesha.re/12lEhb9"><em>Codemotion</em></a><em>.</em></p><p>This format works very well with microservices and Docker, as it caters for the exact traits that are so important for the microservices architecture — easily deploy new services (that’s where Docker packaging comes into the picture), scale each microservice independently, make the failure of a single mircoservice instance transparent to clients that access it, and enable simple, ad-hoc name-based discovery of service endpoints.</p><h3>What’s missing?</h3><p>This is all very useful when it comes to simple, stateless services that you can load balance across, and where all instances are completely identical. A good example for such a service would be web service of some sort or a stateless web application.</p><p>Things get a bit more complicated when you have stateful services, or when the microservice itself is composed of multiple pieces — such as a database or a messaging queue. Kubernetes has an implicit assumption that all the state that is shared between service instances (e.g. a Mongo cluster that stores user profiles) is managed outside of Kubernetes.</p><p>However, in many cases, what you want to manage is composed of multiple tiers (web, database, messaging, etc) that are dependent on one another. And as such, often times, this will be tough if not impossible to do with Kubernetes. Kubernetes is designed for a situation where each container is literally self-contained, and replicable; many times this isn’t necessarily the case. This is also true if you want to automate the deployment and management of application tiers that are not microservices — like a central data repository, e.g. a Hadoop or Cassandra. The latter two cannot be deployed on top of Kunernetes (although something simpler such a <a href="https://github.com/GoogleCloudPlatform/kubernetes/tree/master/examples/guestbook">Redis</a><a href="https://github.com/GoogleCloudPlatform/kubernetes/tree/master/examples/guestbook"> </a>can be).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/520/0*9taEw1Y-AeCl3xge.png" /></figure><p><em>Courtesy of </em><a href="http://martinfowler.com/articles/microservices.html"><em>Martin Fowler</em></a><em>.</em></p><p>In such a case you’d need an orchestrator capable of describing more complex topologies and deployments — this is where Mesos comes in.</p><p>Apache Mesos provides a solution to easily create one big single pool of resources, whether these are running across 10,000s of machines, or on a small cluster. Mesos handles resource allocation, DNS resolution, automatic configuration and load balancing .A framework that runs upon Mesos is the Marathon scheduler, which takes care about how many instances of a job should run on which machines, and reschedules running jobs if machines in your cluster die.</p><p>Mesos has a concept of service and a separate concept of task. Marathon is considered a service and marathon manages the tasks on the worker nodes. Our microservices would be marathon tasks. Other Mesos services that can be launched include Chronos, Cassandra, HDFS, Kafka, Spark. One can even deploy Kubernetes as a Mesos service.</p><p>Mesos in this architecture enables:</p><ul><li>Testability: By representing the application as a framework, it becomes possible to test the system as a whole. Previously it has been difficult to test clustered systems because of lack of standards and requirement for a cluster.</li><li>Scalability: Many applications can benefit from accessing more detailed information about the state of a task. Horizontal and vertical scaling is now possible on a cluster of machines.</li><li>Resiliency: If a task is lost due to a failure or a crash, Mesos is able to reliably inform the framework of the inconsistent state and the framework can take action as necessary. Details about the taks allow the optimal placement of tasks.</li><li>Democracy: By using Mesos authorisation and roles, it is possible to reserve and control how resources are used. Priorities could be attached to allow important jobs priority access to limited resources. The cluster would be under developer control and the infrastructure can be left to IT or removed entirely.</li></ul><p>Following posts will dive deeper in how these components fit together.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ad647451a57" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>