Nodes

Nodes serve as working machine in a k8s cluster. A node can be a physical computer or virtual machine.

Node Requirements

  • Kubelet running
  • Container tooling like docker
  • a kube-proxy process running
  • supervisord

Pods

  • They are simplest unit that you can interact with.
  • Smallest deployable unit
  • You can create, deploy and delete pods, and it represents one running process on your cluster.
  • It is one single unit of deployment.
  • They never self heal and not restarted by scheduler. Do not interact with Pods directly.
  • They contain the following:
    • Docker application container
    • storage resources
    • unique network IP
    • options how container should run

Pods states

  • Pending: container not created yet
  • Running
  • Succeeded: All containers in the pod exited with status 0
  • Failed: At least one container exited with non zero status
  • CrashLoopBackOff: Container fails to start and Kubernetes tries to start it again and again.

Need for pods

  • Pods are abstraction for containers.
  • Each pods has unique IP accessible via other pods.
  • When a container starts we need to bind the application port to the host port, since keeping track of available ports becomes difficult, pods solve this problem.
  • A single pod can have more than one container running on it but one of them must be main container.
  • At max you can have 6 containers (verify it!). Generally we keep single container
  • we can have one main and other helper container for eg. scheduler, authentication etc.
  • There is “pause” (aka “sandbox”) container for each pod which reserves and holds network namespace and helps in communication between containers

Service and Pod

  • Since a pod is ephemeral and can die easily, hence its IP address can change easily. Service attaches a permanent IP to the pod.