k8s-imagePullPolicy拉取策略

本文深入探讨了Kubernetes中imagePullPolicy属性的三种设置:Always、IfNotPresent和Never,解释了它们如何影响容器镜像的拉取行为。文章强调了预拉取镜像作为注册表认证替代方案的重要性,并指出所有集群节点必须拥有相同的预拉取镜像,以确保可靠性和速度。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

kubernetes官网参考imagePullPolicy

imagePullPolicy

Always

总是拉取 pull

imagePullPolicy: Always

IfNotPresent

默认值,本地有则使用本地镜像,不拉取

imagePullPolicy: IfNotPresent

Never

只使用本地镜像,从不拉取

imagePullPolicy: Never

Pre-pulling Images
Note: If you are running on Google Kubernetes Engine, there will already be a .dockercfg on each node with credentials for Google Container Registry. You cannot use this approach.
Note: This approach is suitable if you can control node configuration. It will not work reliably on GCE, and any other cloud provider that does automatic node replacement.
By default, the kubelet will try to pull each image from the specified registry. However, if the imagePullPolicy property of the container is set to IfNotPresent or Never, then a local image is used (preferentially or exclusively, respectively).

If you want to rely on pre-pulled images as a substitute for registry authentication, you must ensure all nodes in the cluster have the same pre-pulled images.

This can be used to preload certain images for speed or as an alternative to authenticating to a private registry.

All pods will have read access to any pre-pulled images
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值