Friends of Pythian Referral Program - Earn up to $5000!

Lessons Learned with Kubernetes

Posted in: Cloud, DevOps, Technical Track

Kubernetes Logo

Trend Towards Kubernetes

Three trends in computing have come together to make container orchestration the next obvious evolution of internet service delivery.  The first is the trend to pack an increasing number of segregated services into larger and larger servers for efficiency gains.  The second trend is the rapid build->test->release cycle of modern microservices that can see hundreds or thousands of updates each day.  And, the third trend is infrastructure-as-code which abstracts the actual hardware of servers and networking equipment away into text files that describe the desired infrastructure.  These files can be tested and version controlled in exactly the same way as code, and deployed just as quickly.  At the convergence point sits Kubernetes from Google which uses flat files to describe the infrastructure and containers needed to deliver a service, which can be built, tested, and deployed incredibly quickly.

Pythian has been working with container orchestration using Kubernetes since it was announced to the public in June of 2014.  We have used it to deploy microservices faster while also speeding up the development cycle.  With the advent of V1.0, we decided to revisit some of what we learned implementing internally and with clients on Kubernetes.

Develop Locally

Google, and others provide hosted Kubernetes solutions that are fast and easy to use.  In fact, you can use them for your whole build->test->deploy workflow.  Keep in mind, that with hosted Kubernetes, the containers are exposed to the internet from very early in your development cycle.  If that’s not desirable, or if local development is important, go faster with a local cluster.  Kubernetes can run on as few as three VMs and the vagrant install is well supported.  Our workflow involves sharing the yaml files among the team and developing everything locally before pushing blessed containers for deployment on a production cluster.

Pay Attention to API Versions in Examples

Since the kubernetes team has been developing their api in public for the last year, there have been a number of fairly large breaking changes to the API.  Now that v1 of the API is stable, we can depend on it. However, many of the tutorials and examples online use earlier versions.  Be sure to check which version the example uses before trying to experiment with it.

Get to know Volumes at Cluster Scale

In Kubernetes, volumes are an outgrowth of the Docker concept of a volume, or a filesystem that can be mounted and isn’t tied to the lifecycle of specific container.  Kubernetes re-imagines them at cluster scale and through plugins, allows containers to mount all kinds of things as file systems.  One plugin adds a git repository as a mountable filesystem, which opens the door to some particularly interesting use cases.

Leverage Etcd

At the heart of the Kubernetes cluster is a distributed, shared-state system called etcd.  Built on the RAFT protocol, it stores key->value pairs in a tiered structure and supports an easy REST api.  Etcd also provides a level of access control sufficient to securely store shared secrets for use throughout the cluster, but not available to all etcd consumers.  This feature underpins the concept of a Secret in Kubernetes.  But, your application can also talk directly to the etcd cluster in Kubernetes.  Using confd, your application can use the Kubernetes etcd instance as a data storage layer.  For example, here’s a simple url shortener gist using just nginx, confd, and etcd.
Happy experimentation!

Schedule a free assessment with a Pythian Kubernetes expert.

Learn more about Pythian’s Cloud expertise.

If this sounds like the kind of thing you’d like to work on, we’re hiring too!

email

Interested in working with Alex? Schedule a tech call.

No comments

Leave a Reply

Your email address will not be published. Required fields are marked *