# Note - Kubernetes in Action

I took notes during reading “Kubernetes in Action”.

It can be found on Amazon.

# Part 2: Core concepts

## Chapter 3:

• Po/pods/pod is similar. For example: It’s the same with service/services.

### Introducing pods

A pod is a Kubernetes abstraction that represents a group of one or more application containers (such as Docker or rkt), and some shared resources for those containers. You can have several related docker containers run on a pod.

A Pod always runs on a Node. A Node is a worker machine in Kubernetes and may be either a virtual or a physical machine, depending on the cluster.

#### Create pod with yaml/json

• Create pod from yaml file
• Get a list of pods
• Get describes of pods
• Get log of container (-c is optional, when you want to view the log of a specific container)
• Forward port 80 from pod to port 8888 local (effective way to test pod)

### Organizing resources with labels

• Label is an arbitrary key-value attached to a resources. It can be defined under metadata.labels tag.
• Each pod is recommended to be labeled with 2 labels: app (which microservice it belong to), env (which environment: staging, dev,..)
• Get the list of pods with label
• Get the pods with specific label by column (in this case is app & rel)
• Get the pods with label selector
• Change label of pods

#### Constrain pod scheduling with labels and selectors

All the pods is scheduled randomly across the worker nodes by default.

• Add the label to specific nodes
• Schedule pods to specific nodes which have gpu label is true by editing in yaml/json file. Should do like this instead of scheduling to a specific node because the node can be offline.

### Annotation

Mostly the same with label. But annotation is used for large blobs of data (256KB in total); mostly use of annotations is adding descriptions for each pod.