Table of contents
The smallest deployable compute units that Kubernetes allows you to construct and control are called pods.
A collection of one or more containers, with common storage and network resources, and a specification for how to execute the containers, is referred to as a "pod" (as in a pod of whales or peas). The components of a pod are always co-located, co-scheduled, and executed in a same environment. A pod includes one or more closely connected application containers and serves as a representation of an application-specific "logical host". apps running on the same physical or virtual system are comparable to cloud apps running on the same logical host in non-cloud scenarios.
Writing pod.yml
apiVersion: v1
kind: Pod
metadata:
name: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
#To create the Pod shown above, run the following command:
kubectl apply -f https://k8s.io/examples/pods/simple-pod.yaml
Container probes
A probe is a routine diagnostic that the kubelet runs on a container. The kubelet either runs code within the container or sends a network request to carry out a diagnostic.
Types of probe
Three different types of probes on active containers may be executed and responded to by the kubelet as an option:
livenessProbe: Whether the container is operating is indicated. The container is killed by the kubelet and is subject to its restart policy if the liveness probe fails. The default state is Success in the absence of a liveness probe from a container.
readinessProbe: Whether the container is prepared to react to queries is indicated. The endpoints controller removes the IP address of the Pod from the endpoints of all Services that match the Pod if the readiness probe fails. Failure is the default condition of preparedness prior to the initial delay. Success is the default state in the absence of a readiness probe from a container.
startupProbe: if the application within the container has begun is indicated. If a starting probe is supplied, all other probes are blocked until it is successful. If the startup probe is unsuccessful, the kubelet terminates the container and applies its restart policy. A container's default state is Success if it doesn't offer a startup probe.