You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

MicroK8s环境下Kubernetes重复拉取指定标签镜像问题求助

问题:MicroK8s中指定IfNotPresent拉取策略仍重复拉取镜像

我用MicroK8s进行Kubernetes部署,涉及的镜像已打标签,理论上应采用IfNotPresent拉取策略。已将目标镜像拉取至本地Docker中,但删除并重新创建Deployment后,Kubernetes仍持续拉取该镜像。通过命令行创建Pod时指定--image-pull-policy=IfNotPresent,同样出现重复拉取的情况。


一、使用的Deployment配置

apiVersion: apps/v1
kind: Deployment
metadata:
  name: lh-graphql
  labels:
    app: lh-graphql 
spec:
  selector:
    matchLabels:
      app: lh-graphql
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: lh-graphql
    spec:
      containers:
      - image: hasura/graphql-engine:v2.13.2.cli-migrations-v3 
        name: lh-graphql 
        ports:
        - containerPort: 8080
          name: lh-graphql        
        env:
        - name: HASURA_GRAPHQL_DATABASE_URL  
          value: postgresql://postgres:postgres@$(ORCH_POSTGRES_IP):5432/lh

二、本地Docker镜像列表

light@siddhalok:~$ docker image ls
REPOSITORY                                                   TAG                         IMAGE ID       CREATED        SIZE
postgres                                                     12                          3d6880d04326   2 weeks ago    373MB
hasura/graphql-engine                                        v2.13.2.cli-migrations-v3   4cd490369623   2 months ago   570MB

三、Deployment重建后的事件信息

Events:
  Type    Reason     Age   From               Message
  ----    ------     ----  ----               -------
  Normal  Scheduled  112s  default-scheduler  Successfully assigned default/lh-graphql-6db75544cf-j65wp to siddhalok
  Normal  Pulling    112s  kubelet            Pulling image "hasura/graphql-engine:v2.13.2.cli-migrations-v3"

四、命令行创建Pod的测试情况

创建命令

microk8s kubectl run det2 --image=registry.dev.mpksoft.ru/lighthouse/lh-detector/lh-detector:current --image-pull-policy=IfNotPresent

对应本地镜像列表

light@siddhalok:~$ docker image ls
REPOSITORY                                                   TAG                         IMAGE ID       CREATED        SIZE
postgres                                                     12                          3d6880d04326   2 weeks ago    373MB
lh-develop.img                                               latest                      f26c3c667fbe   5 weeks ago    2.82GB
dpage/pgadmin4                                               latest                      4d5afde0a02e   6 weeks ago    361MB
detector                                                     latest                      e6f7e6567b73   7 weeks ago    3.81GB
lh-detetctor.img                                             latest                      e6f7e6567b73   7 weeks ago    3.81GB
registry.dev.mpksoft.ru/lighthouse/lh-detector/lh-detector   current                     e6f7e6567b73   7 weeks ago    3.81GB

内容的提问来源于stack exchange,提问作者noname7619

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.02 04:15:37