KubeCon 2015 has ended
Back To Schedule
Tuesday, November 10 • 2:00pm - 2:20pm
Kubernetes Is For Monoliths Too

Sign up or log in to save this to your schedule, view media, leave feedback and see who's attending!

If faced with the task of migrating a monolithic application to a microservice architecture, Kubernetes might be a counter-intuitive first step. However, operating an application from within a Kubernetes cluster can enable some very low-risk / high-reward refactorings without rewriting much application code, if any.

Many will encourage one to start refactoring a monolithic application at business boundaries. Instead, focus on the parameterization and configuration of your application. Many of the contents of configuration files are orthogonal to the business logic of the application: server names, credentials, locations of certificates, hashing algorithms, etc. Strive to reduce the configurability of your application as much as possible. This exercise will point you at the first and easiest places to utilize some of the best features of Kubernetes.

Services provide the ideal abstraction for external systems which require only a simple network connection. In many cases, the services required by a monolithic application are treated as ubiquitous and guaranteed. Their names can be used as hard-coded defaults. Services that cannot be deployed in the cluster, such are large databases, or those provide by 3rd parties, can make use of “services without selectors”.

Pods, and the shared network namespace they provide, allow your application to assume that everything is running locally, even when they are not.

Ambassador containers are helpful in cases where a service requires any amount of additional logic to use correctly, such as custom headers, service location, or authentication. Examples: An open smtp-relay which deals with SASL authentication to an upstream mail server, or twemproxy in front of shards of redis or memcached servers.

Use the adapter pattern to convert incoming https requests into http, and eliminate the need for your application to properly set up server-side TLS.

Secrets can be used in cases where configuration files are still required. Kubernetes allows the mount path of secrets to match the default location required by your application.

Deploy your monolith to a Kubernetes cluster, where it will provide the freedom to change many of its moving pieces. Each externalized dependency adds to a virtuous cycle of increased modularity. Refactored code often produces reusable functions, utilities, and libraries. A refactored Kubernetes application often produces reusable pods and services.

avatar for Steve Reed

Steve Reed

Principal Engineer, Core Engineering, Individual
I'm a Principal Software Engineer and chronic Early Adopter who is passionate about lowering the barriers that exist between developers and their production environments. I'm a proponent of open source whose preferred method of contribution to public projects is to use them before... Read More →

Tuesday November 10, 2015 2:00pm - 2:20pm PST
Palace Hotel - Ralston Ballroom 2 New Montgomery St, San Francisco, CA 94105

Attendees (0)