Im trying to create a replication Controller based on an image that I created locally. But when I try to create the rc it gives error ImagePullBackOff
. I have created a cluster locally using minikube
Here is my .yaml
file:
apiVersion: v1
kind: ReplicationController
metadata:
name: example
spec:
replicas: 1
selector:
app: ayonAppserver
template:
metadata:
name: example.com
labels:
app: ayonAppserver
spec:
containers:
- name: something
image: nktest:10
resources:
limits:
cpu: 500m
memory: 1024Mi
Command that I run to create the rc:
kubectl create -f <file>
When Im running docker images
I see the image in the list
REPOSITORY TAG IMAGE ID CREATED SIZE
nktest 10 e60b3c9c3bc6 10 hours ago 425 MB
when I run kubectl get pods
NAME READY STATUS RESTARTS AGE
example-gr9v2 0/1 ImagePullBackOff 0 2m
I have tried to run the docker image locally, and it runs fine
docker run -d --name="testAyonApp1" nktest:10
Can anyone help to solve this?
So thanks to @BMW for helping me with the issue. The problem was that I was thinking since I created the cluster using minikube
(locally) every image that I create in my local machine will be visible to minikube cluster. But an image is visible only when its present inside the node. Thats why every time I wanted to build it, it was looking for downloading the image.
I have now created a dockerhub account and pushed the image in the hub. And now things are working just fine.