0

Currently I have an app (myapp) that deploys as a Java web app running on top of a "raw" (Ubuntu) VM. In production there are essentially 5 - 10 VMs running at any given time, all load balanced behind an nginx load balancer. Each VM is managed by Chef, which injects the correct env vars and provides the app with runtime arguments that make sense for production. So again: load balancing via nginx and configuration via Chef.

I am now interested in containerizing my future workloads, and porting this app over to Docker/Kubernetes. I'm trying to see what features Kubernetes offers that could replace my app's dependency on nginx and Chef.

So my concerns:

  • Does Kube-Proxy (or any other Kubernetes tools) provide subdomains or otherwise-loadbalanced URLs that could load balance to any number of pod replicas. In other words, if I "push" my newly-containerized app/image to Kubernetes API, is there a way for Kubernetes to make image available as, say, 10 pod replicas all load balanced behind myapp.example.com? If not what integration between Kubernetes and networking software (DNS/DHCP) is available?
  • Does Kubernetes (say, perhas via etc?) offer any sort of key-value basec configuration? It would be nice to send a command to Kubernetes API and give it labels like myapp:nonprod or myapp:prod and have Kubernetes "inject" the correct KV pairs into the running containers. For instance perhaps in the "nonprod" environment, the app connects to a MySQL database named mydb-nonprod.example.com, but in prod it connects to an RDS cluster. Or something.
  • Does Kubernetes offer service registry like features that could replace Consul/ZooKeeper?
smeeb
  • 27,777
  • 57
  • 250
  • 447

1 Answers1

1

Answers:

1) DNS subdomains in Kubernetes:

https://github.com/kubernetes/kubernetes/tree/master/cluster/addons/dns

Additionally, each Service loadbalancer gets a static IP address, so you can also program other DNS names if you want to target that IP address.

2) Key/Value pairs

At creation time you can inject arbitrary key/value environment variables and then use those in your scripts/config. e.g. you could connect to ${DB_HOST}

Though for your concrete example, we suggest using Namespaces (http://kubernetes.io/v1.0/docs/admin/namespaces/README.html) you can have a "prod" namespace and a "dev" namespace, and the DNS names of services resolve within those namespaces (e.g. mysql.prod.cluster.internal and mysql.dev.cluster.internal)

3) Yes, this is what the DNS and Service object provide (http://kubernetes.io/v1.0/docs/user-guide/walkthrough/k8s201.html#services)

brendan
  • 4,116
  • 3
  • 15
  • 7
  • Thanks @brendan (+1) I appreciate the solid feedback. One quick followup if you don't mind: regarding KV pairs you mention "*At **creation time** you can...*", does this mean that once a pod/service is created, its KV pairs are immutable? This would become a problem as the app evolves and needs new environment-specific configs...thoughts? Thanks again! – smeeb Sep 28 '15 at 05:09
  • Also in general it seems that Services obviate the need for tools like [Registrator](https://github.com/gliderlabs/registrator). Can you think of any reason why someone would need Registrator running inside (or with somehow) a Kubernetes cluster? – smeeb Sep 28 '15 at 05:13