Kubernetes with hybrid containers on one VM?

3/7/2019

I have played around a little bit with docker and kubernetes. Need some advice here on - Is it a good idea to have one POD on a VM with all these deployed in multiple (hybrid) containers?

This is our POC plan:

  1. Customers to access (nginx reverse proxy) with a public API endpoint. eg., abc.xyz.com or def.xyz.com
  2. List of containers that we need
    • Identity server Connected to SQL server
    • Our API server with Hangfire. Connected to SQL server
    • The API server that connects to Redis Server
    • The Redis in turn has 3 agents with Hangfire load-balanced (future scalable)

  1. Setup 1 or 2 VMs?
  2. Combination of Windows and Linux Containers, is that advisable?
  3. How many Pods per VM? How many containers per Pod?
  4. Should we attach volumes for DB?

Thank you for your help

-- user3400044
kubernetes

1 Answer

3/15/2019

Cluster size can be different depending on the Kubernetes platform you want to use. For managed solutions like GKE/EKS/AKS you don't need to create a master node but you have less control over our cluster and you can't use latest Kubernetes version.

  1. It is safer to have at least 2 worker nodes. (More is better). In case of node failure, pods will be rescheduled on another healthy node.
  2. I'd say linux containers are more lightweight and have less overhead, but it's up to you to decide what to use.
  3. Number of pods per VM is defined during scheduling process by the kube-scheduler and depends on the pods' requested resources and amount of resources available on cluster nodes.
  4. All data inside running containers in a Pod are lost after pod restart/deletion. You can import/restore DB content during pod startup using Init Containers(or DB replication) or configure volumes to save data between pod restarts.

You can easily decide which container you need to put in the same Pod if you look at your application set from the perspective of scaling, updating and availability.

If you can benefit from scaling, updating application parts independently and having several replicas of some crucial parts of your application, it's better to put them in the separate Deployments. If it's required for the application parts to run always on the same node and if it's fine to restart them all at once, you can put them in one Pod.

-- VAS
Source: StackOverflow