Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Support for Kubernetes #1118

Open
krisnova opened this issue Jun 18, 2018 · 8 comments
Open

Support for Kubernetes #1118

krisnova opened this issue Jun 18, 2018 · 8 comments
Labels
help wanted Feel free to contribute! proposal A suggestion for a change, feature, enhancement, etc
Milestone

Comments

@krisnova
Copy link

krisnova commented Jun 18, 2018

Right now Go buffalo creates a Dockerfile in a user's application. I think we could take that a step further and add support for deploying a Buffalo application to Kubernetes.

I presented a keynote at VelocityConf this year, and did a live demo of deploying a buffalo app to Kubernetes. The application can be found here and the manifests I used to deploy in Kubernetes can be found here.

The way Kubernetes works is that you need to define various resources to create in your cluster (usually in YAML). When those resources are all deployed correctly you should have a working (publicly available) application. A list of the resources I created when I ran my Buffalo application in Kubernetes:

Example Kubernetes Resources

Buffalo Application

  • Deployment
  • Ingress
  • Service

Postgres Database

  • Deployment
  • Service
  • Persistent Volume
  • Persistent Volume Claim

Ingress controller

  • Contour

Dynamic Configuration Problem

As we know Buffalo lets users pick various options while building there application. In some cases, these options will need to trickle down into the Kubernetes resources that would be defined. An example would be changing a database from Postgres to something else.

Ksonnet

There are tools like ksonnet that abstract the Kubernetes resources needed to define an application. We could leverage ksonnet's ability to have multiple flavors of an application to handle the dynamic configuration problem

Helm

Most Kubernetes users are familiar with Helm. We could write a Chart that helm could then read and deploy. Helm would also allow us to define various dynamic configuration and logic to include/exclude various resources. The main difference between Helm and Ksonnet is Ksonnet uses an abstraction, where Helm is just a templating language (text/template).

Success

As a user I can create an arbitrary Buffalo application, and in less than 3 commands I can easily have my application running in a properly configured Kubernetes cluster.

As a user who deployed their application to Kubernetes I can easily find a resolvable address where my Buffalo application can be found at.

@krisnova
Copy link
Author

Also relevant to the party here: https://github.com/tentsk8s/buffanetes

@arschles
Copy link
Contributor

arschles commented Jun 18, 2018

I'll x-post some stuff I wrote in slack about buffanetes a few mins ago. I also cleaned up some of my foul language 😄

  • it tries to use the helm Go client but I am trying to keep it simple and expose very few config options in a toml file
  • then I got tired of config files and my latest thing is super small toml file and you can extend stuff with lua
  • I feel like implementation wise, helm was just easiest to get something working but maybe it doesn't need to use helm for real

Oh and one thing to add - I didn't write this as a plugin, I wrote it as a separate binary because I was trying to make myself feel special (I don't need no stinkin plugins!) That was not the right decision - I think it should absolutely be a plugin 😄

@bscott
Copy link

bscott commented Jun 20, 2018

There are a couple of Buffalo plugins that deploy to Kubernetes, is the goal here to have something builtin to the buffalo binary, instead of a plugin?

@arschles
Copy link
Contributor

@bscott I'd love to check them out, can you link it? I don't think the goal is to build directly into the binary - just a plugin. Wasn't aware that there were already plugins for that.

@bscott
Copy link

bscott commented Jun 29, 2018

I started mine right before I found yours @arschles ;)

https://github.com/bscott/buffalo-kubernetes

@stanislas-m stanislas-m added the proposal A suggestion for a change, feature, enhancement, etc label Jul 3, 2018
@arschles
Copy link
Contributor

arschles commented Jul 5, 2018

That's awesome @bscott! Feel free to copy whatever code you want from buffanetes if it's useful, I have like no time right now to do anything with the project

soon I hope!

@arschles
Copy link
Contributor

arschles commented Jul 5, 2018

Also, I love the Kube + Buffalo party that's going on here!

@ghost
Copy link

ghost commented Jul 11, 2018

@bscott any links to show how to use the k8 plugin ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted Feel free to contribute! proposal A suggestion for a change, feature, enhancement, etc
Projects
None yet
Development

No branches or pull requests

5 participants