I create kubernetes services and deployments via kubectl create -R -f ./kubernetes
I use Google Cloud Builder to build docker image and push to GCR repository
Here's my (incomplete) Deployment file
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
annotations:
kompose.cmd: C:\ProgramData\chocolatey\lib\kubernetes-kompose\tools\kompose.exe
convert
kompose.version: 1.14.0 (fa706f2)
creationTimestamp: null
labels:
io.kompose.service: web
name: web
spec:
replicas: 1
strategy: {}
template:
metadata:
labels:
io.kompose.service: web
spec:
containers:
- name: web
image: gcr.io/abc/node-node:latest
I have a build step which creates an Image and uploads to GCR.
What I want is for Kubernetes to automatically deploy latest image once its uploaded to registry.
I'm missing imagePullPolicy: "Always"
from my deployment and how to use this command?
kubectl set image deployment/web web=gcr.io/abc/node-node:latest
Add this to yaml file
spec:
containers:
- image: gcr.io/{your_project}/{name}:$version
imagePullPolicy: Always
name: {name}