I tried to deploy kubernetes using minikube using both from local docker image and from docker hub. But both doesn't work.
method-1: Using save and load the tar file, created the image and it is available to kubectl.
root@arun-desktop-e470:/var/local/dprojects/elasticsearch# kubectl get pods --all-namespaces -o jsonpath="{..image}" |tr -s '[[:space:]]' '\n' |sort |uniq -c|grep elk
2 elk/elasticsearch:latest
Execute below commands to create the deployment:
kubectl run elastic --image=elk/elasticsearch:latest --port=9200
kubectl expose deployment elastic --target-port=9200 --type=NodePort
minikube service elastic --url
From kubectl describe pod command,
Warning Failed 122m (x4 over 124m) kubelet, minikube Failed to pull image "elk/elasticsearch:latest": rpc error: code = Unknown desc = Error response from daemon: pull access denied for elk/elasticsearch, repository does not exist or may require 'docker login'
Method-2: I did pushed the image to my docker hub repository, (https://hub.docker.com/r/get2arun/elk/tags) and then login to docker hub in the terminal and created the deployment again.
pushed to docker hub like below and hence I have permission to push and pull the images to my docker hub account. I have checked the "collaborators" under manage repositories and it has my docker hub id.
root@arun-desktop-e470:~# docker push get2arun/elk:elasticsearch_v1
The push refers to repository [docker.io/get2arun/elk]
19b7091eba36: Layer already exists
237c06a69e1c: Layer already exists
c84fa0f11212: Layer already exists
6ca6c301e2ab: Layer already exists
76dd25653d9b: Layer already exists
602956e7a499: Layer already exists
bde76be259f3: Layer already exists
2333287a7524: Layer already exists
d108ac3bd6ab: Layer already exists
elasticsearch_v1: digest: sha256:6f0b981b5dedfbe3f8e0291dc17fc09d32739ec3e0dab6195190ab0cc3071821 size: 2214
kubectl run elasticsearch-v2 --image=get2arun/elk:elasticsearch_v1 --port=9200
From kubectl describe pods command:
Normal BackOff 21s kubelet, minikube Back-off pulling image "get2arun/elk:elasticsearch_v1"
Warning Failed 21s kubelet, minikube Error: ImagePullBackOff
Normal Pulling 7s (x2 over 24s) kubelet, minikube Pulling image "get2arun/elk:elasticsearch_v1"
Warning Failed 4s (x2 over 21s) kubelet, minikube Failed to pull image "get2arun/elk:elasticsearch_v1": rpc error: code = Unknown desc = Error response from daemon: pull access denied for get2arun/elk, repository does not exist or may require 'docker login'
I removed the proxy settings and tried from open wifi account but still seeing permission denied.
This error message is not sufficient to identify the issue and hoping there should be some way to narrow down these kind of issues.
In method-1, as the image is not pushed to the repository, you have to use the imagePullPolicy.
imagePullPolicy: Never
imagePullPolicy: IfNotPresent
I think IfNotPresent is ideal, if you want to use local image / repository. Use as per your requirement.
kubectl run elastic --image=elk/elasticsearch:latest --port=9200 --image-pull-policy IfNotPresent