3
votes

This question pertains to the Kubernetes tutorial on Google's CodeLabs found here: https://codelabs.developers.google.com/codelabs/cloud-compute-kubernetes/index.html?index=..%2F..%2Fgcp-next#15

I'm new to both Docker and Kubernetes and am confused over their use of the term "pods" which seems to contradict itself.

From that tutorial:

A Kubernetes pod is a group of containers, tied together for the purposes of administration and networking. It can contain one or more containers. All containers within a single pod will share the same networking interface, IP address, disk, etc. All containers within the same pod instance will live and die together. It's especially useful when you have, for example, a container that runs the application, and another container that periodically polls logs/metrics from the application container.

That is in-line with my understanding of how Kubernetes pods relate to containers, however they then go on to say:

Optional interlude: Look at your pod running in a Docker container on the VM

If you ssh to that machine (find the node the pod is running on by using kubectl describe pod | grep Node), you can then ssh into the machine with gcloud compute ssh . Finally, run sudo docker ps to see the actual pod

My problems with the above quote:

  1. . "Look at your pod running in a Docker container" appears to be backwards. Shouldn't it say "Look at your Docker container running on the VM"?
  2. "...run sudo docker ps to see the actual pod" doesn't make sense, since "docker ps" lists docker containers, not pods.

So am I way off base here or is the tutorial incorrect?

3
A pod can run multiple containers even though most if the time they will only contain one. So you have your kubernetes node running multiple pods which in turn can contain multiple containers. Does that clear things up for you or have I misunderstood your question?Will Munn
@WillMunn that's the way I understood it too, but the tutorial refers to seeing "the actual pod" when running "docker ps" and mentions the pod "running in a Docker container". I believe they're using "pod" where they should be using "image", do you agree?TheOx
Well since pod is a bit of an abstract concept wrt docker, I think they mean docker ps will display the group of containers that make up the pod. Image is different as an image is more the blueprint to build a container. Think of a container as an instance of an image.Will Munn

3 Answers

8
votes

As mentioned above pod can run more than one container, but in fact to make it simple running more than one container in a pod is an exception and definitely not the common use. you may look at a pod as a container++ that's the easy way to look at it.

If you starting with kubernetes I have wrote the blog below that explain the main 3 entities you need to be familiar with to get started with kubernetes, which are pods, deployments and services.

here it is http://codefresh.io/blog/kubernetes-snowboarding-everything-intro-kubernetes/

feedback welcome!

0
votes

One nuance that most people don't know about docker running Kubenretes is that it is running a outdated version. I found that if I went to Google's cloud based solution for Kubernetes everything was quite easy to setup. Here is my sample code of how I set up Kubernetes with Docker.

I had to use the command line utility for Docker though to properly get everything to work. I think this should point you in the right direction.

Image for Project Click here

0
votes

(I've started learning Kubernetes and have some experience with Docker).

I think the important side of pods is that it may have container(s) which are not from Docker, but from some other implementation.

In this aspect the phrase in problem 1. is fully valid: output confirms that pod is in Docker, not anywhere else.

And reg. problem 2 - the phrase means that further details about the pod you should inspect from docker command. Theoretically different command may be needed in other cases.