last day (16 days later) » 

6:23 PM
0
Q: Kubernetes deployment failing due to Image pull failure

a aWhile trying to deploy my custom nginx image from local registry to kubernetes , I am seeing below error in kubernetes-dashboard - Failed to pull image "myapp": rpc error: code = Unknown desc = Error response from daemon: repository myapp not found: does not exist or no pull access This is the ...

 
a a
I just created that image in my cluster master node using docker build command. And when I execute docker images command, I can see it listed and I believe it is in my local registry?
 
With the describe output, I can see that it is pulling mynginx image, while at starting you mentioned you have made image in the name of myapp. So You have given wrong image tag while starting the deployment. Kindly check if you have given same image tag which is present on your local machine.
 
a a
so my question is without pushing the image to docker hub or GCR, is it possible to deploy it using kubectl? Because this approach worked with minikube in Katakoda but its not working in GKE in GCP :(
 
Yes it is possible with GKE as well. If you have image present on local machine(check using docker images) and you define imagePullPolicy as IfNotPresent, it will work. The reason it is failing because you haven't provided the right image name in GKE. You provided mynginx as image name to your deployment while you have image name as myapp
 
a a
No, that was my mistake in my 2nd post. I later modified myapp to mynginx. Sorry about that. But I again tried to deploy by making everything as mynginx. And still it is same.. Failed to pull image "mynginx": rpc error: code = Unknown desc = Error response from daemon: repository mynginx not found: does not exist or no pull access
 
6:23 PM
Could you please run docker images command on your node and paste output
 
a a
xxx@gke-standard-cluster-1-default-pool-1fa56e6c-xzp8:~$ docker images Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.27/images/json: dial unix /var/run/docker.sock: connect: permission denied
 
Hi
you are not able to connect to docker daemon
 
a a
hi
i am able to connect when i tried docker login
i was able to login succeed
 
okay
then output of docker images
 
a a
but it was in master
in node i am getting error
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.27/auth: dial unix /var/run/docker.sock: connect: permission denied
 
6:31 PM
gke-standard-cluster-1-default-pool-c7d671ed-br8j This is a worker node right?
and you don't have mynginx image on that worker node right?
 
a a
yes its worker node
 
When you're creating deployment the pod is going onto that worker node and doesn't find any mynginx image on that worker node and tried to pull it
 
a a
not sure if mynginx is there in worker node.. since docker images is failing
 
could you do sudo docker images
in worker node
 
a a
yeah that command worked but i am unable to see mynginx image
gopikrish_new@gke-standard-cluster-1-default-pool-1fa56e6c-xzp8:~$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
gcr.io/google_containers/kube-proxy v1.10.9-gke.5 885a83f80902 2 months ago 103 MB
k8s.gcr.io/kube-proxy v1.10.9-gke.5 885a83f80902 2 months ago 103 MB
k8s.gcr.io/event-exporter v0.2.3 d756cbf68e49 4 months ago 94.2 MB
 
6:34 PM
Yes it means that image is not present there
hence the issue.
 
a a
but how to fix it?
 
Now you can copy the docker image from master
docker save -o <path for generated tar file> mynginx
Run above command on master
it will generate a tar file
which you need to copy on worker node
 
a a
oh ok..
 
Then run the following command on the worker node:
sudo docker load -i <path to image tar file>
 
a a
and also.. when i try to delete image using below command its failing.. gcloud container images delete localhost:5000/mynginx --force-delete-tags
ERROR: (gcloud.container.images.delete) [localhost:5000/mynginx] digest must be of the form "sha256:<digest>".
how do i delete the local images?
gcloud container images delete mynginx --force-delete-tags
 
6:40 PM
Did it worked?
 
a a
just a second.. trying that
gopikrish_new@gke-standard-cluster-1-default-pool-1fa56e6c-xzp8:~$ sudo docker load -i /home/gopikrish_new
error during connect: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.27/images/load?quiet=0: read /home/gopikrish_new: is a directory
is showing that in worker node
i initially saved using.. sudo docker save -o /home/gopikrish_new mynginx
gopikrish_new@cloudshell:~ (involuted-ratio-227118)$ sudo docker save -o /home/gopikrish_new mynginx
rename /home/.docker_temp_135705770 /home/gopikrish_new: file exists
 
ls /home/gopikrish_new
in worker node
 
a a
gopikrish_new@gke-standard-cluster-1-default-pool-1fa56e6c-xzp8:~$ ls /home/gopikrish_new
gopikrish_new@gke-standard-cluster-1-default-pool-1fa56e6c-xzp8:~$
 
docker save -o /home/myfile.tar mynginx
 
a a
nothing displayed
ok
 
6:47 PM
you need to provide file name also
not just directory
and copy that file myfile.tar to the worker node
and then sudo docker load -i /home/myfile.tar
on worker node
 
a a
to copy that file to worker node.. should i use ssh ?
or any other way?
any command is there?
 
you can use scp
if you have key file then
scp -i <key>.pem /home/myfile.tar <user>@<ip>:/home/
 
a a
trying to manually download
there is an option in GKE
console
 
a a
but its showing Failed
dont know why
maybe size if that file is too big
of*
 
6:55 PM
7
Q: Copy files between two Google Cloud instances

user1865445I have two projects in Google Cloud and I need to copy files from an instance in one project to an instance in another project. I tried to using the 'gcloud compute copy-files' command but I'm getting this error: gcloud compute copy-files test.tgz --project stack-complete-343 instance-IP:/home/u...

 
a a
7:07 PM
gopikrish_new@cloudshell:~ (involuted-ratio-227118)$ gcloud compute copy-files myfile.tar --project involuted-ratio-227118 gke-standard-cluster-1-default-pool-1fa56e6c-xzp8:/home/gopikrish_new --zone us-east1-b
WARNING: `gcloud compute copy-files` is deprecated. Please use `gcloud compute scp` instead. Note that `gcloud compute scp` does not have recursive copy on by default. To turn on recursion, use the `--recurse` flag.
Warning: Permanently added 'compute.1437052542824193068' (ECDSA) to the list of known hosts.
ok i will figure this later.. do u know how to delete the local image ?
$ gcloud container images delete \
--quiet [HOSTNAME]/[PROJECT-ID]/[IMAGE]@DIGEST
i see it is mentioned to use hostname in that command. but how do i find hostname?
found it.. but when i execute still showing error..
gcloud container images delete --quiet cs-6000-devshell-vm-37ed1cd7-726d-48bc-85df-8ce82c65f035/involuted-ratio-227118/‌​mynginx@DIGEST
gopikrish_new@cloudshell:~ (involuted-ratio-227118)$ gcloud container images delete --quiet cs-6000-devshell-vm-37ed1cd7-726d-48bc-85df-8ce82c65f035/involuted-ratio-227118/mynginx@DIGEST
ERROR: (gcloud.container.images.delete) [cs-6000-devshell-vm-37ed1cd7-726d-48bc-85df-8ce82c65f035/involuted-ratio-227118/mynginx@DIGEST] digest must be of the form "sha256:<digest>".
 

  last day (16 days later) »