我使用docker-desktop for mac进行了简单的设置,并附带了Kubernetes集群。
每次我使用skaffold dev运行imagePullPolicy: Never时,都会创建一个镜像,但是将脏镜像部署到Kubernetes集群时,仍然会出现错误:

ErrImageNeverPull: Container image "user/test:bf13343a4b431df2b7df84f58ede9229bd3d868a4b10147fff04eae8a7adc0cd" is not present with pull policy of Never
谁能帮我调试一下吗?我不知道如何进一步调查。但是skaffold不会将我的脏镜像部署到Kubernetes集群中。每个人都建议将imagePullPolicy: Never添加到我的deployment.yaml中,但这不能解决任何问题
skaffold.yml内容:
apiVersion: skaffold/v2beta5
kind: Config
metadata:
  name: test
build:
  artifacts:
  - image: user/test
deploy:
  kubectl:
    manifests:
    - kube/postgres/postgres-configmap.dev.yaml
    - kube/redis/redis-configmap.secret.yaml
    - kube/web/web-configmap.dev.yaml
    - kube/elasticsearch/elasticsearch-storage.dev.yaml
    - kube/postgres/postgres-storage.dev.yaml
    - kube/cable/cable-service.yaml
    - kube/dashboard.yaml
    - kube/cable/cable-deployment.yaml
    - kube/nginx/load-balancer.dev.yaml
    - kube/redis/redis-storage.yaml
    - kube/sidekiq/sidekiq-deployment.yaml
    - kube/web/web-deployment.yaml
    - kube/web/web-service.dev.yaml
    - kube/web/web-migration.yaml
    - kube/web/web-seed.yaml

最佳答案

我唯一能想到的是您的skaffold.yaml与图片名称不匹配:

apiVersion: skaffold/v2beta5
kind: Config
build:
  artifacts:
  - image: user/test 👈 does this match?
deploy:
  kubectl:
    manifests:
      - deployment.yaml
否则,您的docker + K8s实例可能已损坏。你可以试试:
  • 在Docker中启用/禁用K8
  • 使用KinD
  • 10-08 04:09