如何使用 Minikube 设置 imagePullPolicy
How do I set the imagePullPolicy with Minikube
我是 Kubernetes 新手。我正在尝试按照 this tutorial 指导我如何使用 minikube 设置本地服务。我能够从教程中获得 运行 $ kubectl run hello-minikube --image=k8s.gcr.io/echoserver:1.10 --port=8080
服务。万岁!
现在我想 运行 一个带有本地标记和构建 Docker 图像的服务器。根据 ,我需要做的就是告诉我的计算机使用 minikube docker 守护进程,构建我的映像,并将 imagePullPolicy
设置为从不。
如何以及在哪里设置 imagePullPolicy
和 minikube
?我四处搜索,虽然有很多结果,但我在 K8 上的 "babe in the woods" 状态导致信息过载。 (即你的答案越简单越好)
您必须编辑 Deployment(kubectl run
创建部署)。规范看起来像这样:
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
编辑:
$ kubectl edit deployment hello-minikube
我是 Kubernetes 新手。我正在尝试按照 this tutorial 指导我如何使用 minikube 设置本地服务。我能够从教程中获得 运行 $ kubectl run hello-minikube --image=k8s.gcr.io/echoserver:1.10 --port=8080
服务。万岁!
现在我想 运行 一个带有本地标记和构建 Docker 图像的服务器。根据 imagePullPolicy
设置为从不。
如何以及在哪里设置 imagePullPolicy
和 minikube
?我四处搜索,虽然有很多结果,但我在 K8 上的 "babe in the woods" 状态导致信息过载。 (即你的答案越简单越好)
您必须编辑 Deployment(kubectl run
创建部署)。规范看起来像这样:
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
编辑:
$ kubectl edit deployment hello-minikube