Kubernetes Deployments, Pod and Container concepts

3/30/2017

I have started recently getting familiar with Kubernetes, however while I do get the concept I have some questions I am unable to answer clearly through Kubernete's Concept and Documentation, and some understandings that I'd wish to confirm.

  • A Deployment is a group of one or more container images (Docker ..etc) that is deployed within a Pod, and through Kubernetes Deployment Controller such deployments are monitored and created, updated, or deleted.

  • A Pod is a group of one or more containers, are those containers from the same Deployment, or can they be from multiple deployments?

  • "A pod models contains one or more application containers which are relatively tightly coupled". Is there any clear criteria on when to deploy containers within the same pod, rather than separate pods?

  • "Pods are the smallest deployable units of computing that can be created and managed in Kubernetes" - Pods, Kuberenets Documentation. Is that to mean that Kubernetes API is unable to monitor, and manage containers (at least directly)?

Appreciate your input.

-- Khaled
deployment
docker
kubernetes
kubernetes-pod

2 Answers

10/18/2019

Pod is an abstraction provided by Kubernetes and it corresponds to a group of containers which share a subset of namespaces, most importantly the network namespace. For instances the applications running in these containers can interact like the way applications in the same vm would interact, except for the fact that they don't share the same filesystem hierarchy.

The workloads are run in the form of pods, but POD is a lower level abstraction. The workloads are typically scheduled in terms of Kubernetes Deployments/ Jobs / CronJobs / Daemonsets etc which in turn create the Pods.

-- pr-pal
Source: StackOverflow

3/30/2017

your question is actually too broad for StackOverflow but I'll quickly answer before this one is closed.

Maybe it get's clearer when you look at the API documentation. Which you could read like this:

A Deployment describes a specification of the desired behavior for the contained objects. This is done within the spec field which is of type DeploymentSpec.

A DeploymentSpec defines how the related Pods should look like with a templatethrough the PodTemplateSpec

The PodTemplateSpec then holds the PodSpec for all the require parameters and that defines how containers within this Pod should look like through a Container definition.

This is not a punchy oneline statement, but maybe makes it easier to see how things relate to each other.

Related to the criteria on what's a good size and what's too big for a Pod or a Container. This is very opinion loaded and the best way to figure that out is to read through the opinions on the size of Microservices.

To cover your last point - Kubernetes is able to monitor and manage containers, but the "user" is not able to schedule single containers. They have to be embedded in a Pod definion. You can of course access Container status and details per container (e.g. through kubeget logs <pod> -c <container> (details) or through the metrics API.

I hope this helps a bit and doesn't add to the confusion.

-- pagid
Source: StackOverflow