Self-Heal from a Pod Failure
Explore Kubernetes self-healing by deploying multiple pod replicas and manually deleting one to see how Kubernetes automatically restores the desired state. Understand the role of Deployment controllers in maintaining application availability and resilience through automated pod recovery.
We'll cover the following...
We'll cover the following...
In this lesson, we’ll use a Kubernetes Deployment to deploy five replicas of a Pod. After that, we’ll manually delete a Pod and see how Kubernetes self-heals.
We’ll use the deploy.yml file in the /usercode directory. It defines five replicas of the app we containerized in previous chapters.
kind: Deployment # <<== Type of object being defined
apiVersion: apps/v1 # <<== Version of object to deploy
metadata:
name: qsk-deploy
spec:
replicas: 5 # <<== How many Pod replicas
selector:
matchLabels: # <<== Tells the Deployment controller
project: qsk-book # <<== to manage Pods with this label
template:
metadata:
labels:
project: qsk-book # <<== Give all replicas this label
spec:
containers:
- name: qsk-pod
imagePullPolicy: Always # <<== Never use images from local machine
ports:
- containerPort: 8080 # <<== Network port
image: nigelpoulton/qsk-book:1.0 # <<== Container image to usePlayground
We use the terms Pod, instance, and replica to mean the same ...