Kubernetes ImagePullPolicy is not working

5/20/2020

My kubernetes deploy file and error as below. I'm trying to grab an already built docker image which exist in my local machine while initiating the Kubernetes deployment. when i execute the deployment file at the bottom, it is giving me the below error. Could someone please help?

Failed to pull image "shan:v.0.0.1": rpc error: code = Unknown desc = Error response from daemon: pull access denied for shanservice, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: shanservice
  namespace: dev
  labels:
    app: astec
spec:
  replicas: 2
  selector:
    matchLabels:
      name: shanservice
      app: astec
  template:
    metadata:
      name: shanservice
      namespace: dev
      labels:
        name: shanservice
        app: astec
    spec:
      containers:
        - image: shan:v.0.0.1
          name: shanservice
          imagePullPolicy: IfNotPresent
          ports:
            - containerPort: 8080
-- ShanWave007
continuous-integration
deployment
docker
kubernetes

1 Answer

5/20/2020

I've fount out what the issue was. My architecture was server A as master and server B as worker node. So when i initiate the deployment files from server A, it is creating the pods in server B which is worker node and then the pods are searching the necessary images in worker node (server B) only. so what I've done was, I've built the images in the server B and then it worked. Thank you very much for your kind help and advises.

-- ShanWave007
Source: StackOverflow