I am new to Kubernetes. I am trying to follow this tutorial that instructs me on how to use minikube to setup a local service. I was able to get things running with the $ kubectl run hello-minikube --image=k8s.gcr.io/echoserver:1.10 --port=8080
service from the tutorial. Huzzah!
Now I want to run a server with a locally tagged-and-built Docker image. According to this post all I need to do is tell my computer to use the minikube docker daemon, build my image, and set the imagePullPolicy
to never.
How and where do I set the imagePullPolicy
with minikube
? I've googled around and while there's plenty of results, my "babe in the woods" status with K8 leads to information overload. (i.e. the simpler your answer the better)
You have to edit your Deployment (kubectl run
creates a deployment). The spec would look something like this:
spec:
progressDeadlineSeconds: 600
replicas: 1
revisionHistoryLimit: 2
selector:
matchLabels:
run: hello-minikube
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
creationTimestamp: null
labels:
run: hello-minikube
spec:
containers:
- image: k8s.gcr.io/echoserver:1.10 <-- change to the right image
imagePullPolicy: IfNotPresent <-- change to Always
name: hello-minikube
ports:
- containerPort: 8080
protocol: TCP
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
Edit with:
$ kubectl edit deployment hello-minikube
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With