Kubernetes Pod/Service Architecture

4/4/2018

I am working on a project using Django on Google Kubernetes Engine and have a few questions on the best architecture format might be. Right now I have several containers in one pod because they are all dependent on each other and communicate frequently. Here is my setup:

Pod: webapp

Containers:

  • NGINX (serves static content, sends traffic to django website)
  • website (Django, serves http responses)
  • DB Proxy (MySQL server for website and websocket server)
  • websocket (Django worker to manage websockets)
  • redis (asynchronous functionality)

My plan is to create a deployment that runs several replicas and scales, but is it better to break this pod into multiple pods or a leave it as a single pod?

If I were to break it down, what might that architecture look like after adding in the necessary services? I'm new if this doesn't show it lol

-- ThatCampbellKid
google-kubernetes-engine
kubernetes
scalability
web-deployment

1 Answer

4/4/2018

It would be better for you to break these containers into multiple pods in order to scale without wasting resources. If you were to scale to for example two instances, a second instance of each container would be started. Your containers will most likely not have identical load and therefore it makes sense to only scale on the containers that are under load, hence it makes sense breaking your 1 pod into several pods. It also makes replacing individual components easier.

The following is an example of several pods, each running a single container. The example shows how you can scale the number of pods based on the component that is under load.

Kubernetes example

-- TheBeardedOne
Source: StackOverflow