An image pull policy tells Kubernetes when to retrieve a container image from a registry. For local development, setting imagePullPolicy to Never prevents remote pulls and makes the Pod use an image already available to the cluster. section 3.4.3
Use the Never policy when deploying a locally built image:
- Build or load the image into the cluster’s container runtime. section 3.4.3
- Reference the image by its local name and tag, such as timeserver:latest, without a repository URL. section 3.4.3
- Set imagePullPolicy: Never in the Deployment’s container specification. section 3.4.3
- Apply the updated Deployment with kubectl. section 3.4.3
Listing 3.5 Chapter03/3.4.3_LocalDevelopment/deploy.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: timeserver
spec:
replicas: 3
selector:
matchLabels:
pod: timeserver-pod
template:
metadata:
labels:
pod: timeserver-pod
spec:
containers:
- name: timeserver-container
image: timeserver:latest #1
imagePullPolicy: Never #2
#1 Reference to a locally available image
#2 Image pull policy prevents Kubernetes from attempting to fetch this local image remotely.
The Deployment example shows a local image reference alongside imagePullPolicy: Never. section 3.4.3

