You might have gone past what can be done with the command line. See Creating a Deployment for how to specify a deployment in a yaml file.
The imagePullPolicy
is part of the Container definition.
You can get the yaml for any kubectl
command by adding -o yaml --dry-run
to the command. Using your example deployment:
kubectl create deployment first-k8s-deploy \
--image="laxman/nodejs/express-app" \
-o yaml \
--dry-run
Gives you:
apiVersion: apps/v1
kind: Deployment
metadata:
creationTimestamp: null
labels:
app: first-k8s-deploy
name: first-k8s-deploy
spec:
replicas: 1
selector:
matchLabels:
app: first-k8s-deploy
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
app: first-k8s-deploy
spec:
containers:
- image: laxman/nodejs/express-app
name: express-app
resources: {}
Then add the imagePullPolicy
property into a container in the list:
spec:
containers:
- image: laxman/nodejs/express-app
name: express-app
resources: {}
imagePullPolicy: Never
The yaml file you create can then be deployed with the following command
kubectl apply -f <filename>