Skip to content

Instantly share code, notes, and snippets.

@rektide
Last active August 29, 2015 14:03
Show Gist options
  • Save rektide/e5a3fba1e1f6ac917357 to your computer and use it in GitHub Desktop.
Save rektide/e5a3fba1e1f6ac917357 to your computer and use it in GitHub Desktop.
Linking applications together in Kubernetes
Wednesday June 10, 2014:
19:26 < rektide> how should/could a webapp container get info about the database container it needs?
Thursday June 11, 2014:
10:32 < rektide> is there any means in kubernetes where coordination can happen? how ought my webapp node get the information about where the db node lies?
12:51 < vmarmol> rektide: bburns' demo showcased that. You point it at the generic "DB service" backend and it will discover and send requests to it
12:55 < jbeda> rektide: It works like this. You specify a ‘service’ that has a name and a ‘label query’. This then sets up configuration for a small proxy that runs on every worker node. That proxy will listen on a port per service and forward (simple round robin for now) to one of the backends specified by the ‘label query’. A set of env variables are set before jobs are started that gives the port for each service based on the name.
Brendan Burns talking about service availability:
https://www.youtube.com/watch?v=tsk0pWf4ipw#t=1620
Thursday July 10, 2014:
19:59 < rektide> i'm sorry i asked this before a month ago, i'm looking to try it now though and not sure how:
19:59 < rektide> if i have a webapp server taht i need to connect to a db server, how do i do that?
20:00 < rektide> say i have labels: role:{webapp,db} and stage:{production,development,staging}
20:00 < rektide> i'd like for the webapp:production to be able to open a connection to db:production
20:04 < briangrant> rektide: Your db is a single instance or replicated (master/slave, active-active, …)? If a single instance or active-active, you could create a service with selector role=db, stage=production.
20:06 < briangrant> Your webapp server will then connect to the service proxy at the port specified for the service, similar to the guestbook example: https://github.com/GoogleCloudPlatform/kubernetes/blob/master/examples/guestbook/guestbook.md
API:
20:26 < rektide> where can i find information on the available HTTP api?
20:26 < briangrant> https://github.com/GoogleCloudPlatform/kubernetes/tree/master/api
20:28 < briangrant> The actual types are in https://github.com/GoogleCloudPlatform/kubernetes/blob/master/pkg/api/types.go, and the json parsing is based on that, so it's closer to "truth"
Coordination endpoints:
20:28 < rektide> in
https://github.com/GoogleCloudPlatform/kubernetes/blob/c4b07b16dfeeccd3c8febc6a94369dfc527160df/examples/guestbook/guestbook.md#step-three-turn-up-the-replicated-slave-tasks, there's two environmental variables:
20:28 < rektide> $SERVICE_HOST $REDISMASTER_SERVICE_PORT
20:28 < briangrant> $SERVICE_HOST is the name/address of the service proxy
20:28 < rektide> the second has a pretty explicit label that explicitly couples with the name.... ah [ed: was going to ask about the first]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment