Self-Heal from a Pod Failure
Learn how Kubernetes self-heals from a Pod failure.
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 use
Playground
We use the terms Pod, instance, and replica to mean the same ...