A Pod is a group of one or more containers (consider docker containers) with shared storage and network resources.
- Network: Pods get unique IP address automatically and all the containers in the Pod communicate each other using localhost and Port
- Storage: Pods can be attached to Volumes that can be shared among the containers
A Pod is
designed to run a single instance of an application inside node of Kubernetes
cluster.
Types of Pod:
- Single container Pod: The “one-container-per-pod” is the most common use case and Kubernetes manage Pod rather than container directly.
- Multi container Pod: A Pod can group multiple containers with shared storage volumes and network resources. Generally, we name it as Primary container and Sidecar container.
Pod lifecycle:
Pods are ephemeral
and not designed to run forever, when Pod is terminated it cannot be repair themselves
rather it gets deleted and recreated based on Pod policy.
Pod lifecycle
starts from “Pending” phase, moving through “Running” if at least
one container starts and then will move to “Succeeded” or “Failed” phase
depending on the container exit status.
Pod phases are continuing to update when,
- Kubelet constantly monitor container states and send info back to KubeAPI Server for updating Pod phase.
- Kubelet stops reporting to the KubeAPI Server.
Pod phases:
Pending
|
Pod has been created by the cluster, but one or more
of its containers are not yet running. This phase includes time spent being scheduled
on a node and downloading images |
Running
|
The Pod has been allotted to a node; all the
containers have been created. At least one container is still running, or is
in the process of starting or restarting |
Succeeded |
All containers in the Pod have terminated
successfully |
Failed
|
One or more containers terminated with non-zero
status |
Unknown
|
The state of the Pod cannot be determined. This
occurs due to error while communicating with the node |
Container States:
Once the scheduler assigns a Pod to a Node, the kubelet starts creating containers for that Pod using a container runtime. There are 3 possible states for the container.
Waiting
|
When the
container still pulling image, applying Secret data etc. |
Running
|
When the
container executing without any issues |
Terminated
|
When the
container exited with non-zero status |
- Kubernetes for Developers #25: PersistentVolume and PersistentVolumeClaim in-detail
- Kubernetes for Developers #24: Kubernetes Volume hostPath in-detail
- Kubernetes for Developers #23: Kubernetes Volume emptyDir in-detail
- Kubernetes for Developers #22: Access to Multiple Clusters or Namespaces using kubectl and kubeconfig
- Kubernetes for Developers #21: Kubernetes Namespace in-detail
- Kubernetes for Developers #20: Create Automated Tasks using Jobs and CronJobs
- Kubernetes for Developers #19: Manage app credentials using Kubernetes Secrets
- Kubernetes for Developers #18: Manage app settings using Kubernetes ConfigMap
- Kubernetes for Developers #17: Expose service using Kubernetes Ingress
- Kubernetes for Developers #16: Kubernetes Service Types - ClusterIP, NodePort, LoadBalancer and ExternalName
- Kubernetes for Developers #15: Kubernetes Service YAML manifest in-detail
- Kubernetes for Developers #14: Kubernetes Deployment YAML manifest in-detail
- Kubernetes for Developers #13: Effective way of using K8 Readiness Probe
- Kubernetes for Developers #12: Effective way of using K8 Liveness Probe
- Kubernetes for Developers #11: Pod Organization using Labels
- Kubernetes for Developers #10: Kubernetes Pod YAML manifest in-detail
- Kubernetes for Developers #9: Kubernetes Pod Lifecycle
- Kubernetes for Developers #8: Kubernetes Object Name, Labels, Selectors and Namespace
- Kubernetes for Developers #7: Imperative vs. Declarative Kubernetes Objects
- Kubernetes for Developers #6: Kubernetes Objects
- Kubernetes for Developers #5: Kubernetes Web UI Dashboard
- Kubernetes for Developers #4: Enable kubectl bash autocompletion
- Kubernetes for Developers #3: kubectl CLI
- Kubernetes for Developers #2: Kubernetes for Local Development
- Kubernetes for Developers #1: Kubernetes Architecture and Features
No comments:
Post a Comment