Open aliwatters opened 3 years ago
hi @aliwatters, thanks for opening this issue. I was able to reproduce this issue using your provided repo on MacOS as well. I'll look into this and see if I can find what's up :)
Hey again @aliwatters, I used this microk8s documentation to solve this issue: https://microk8s.io/docs/registry-images
What is happening is that microk8s doesn't by default know about the image built by your local docker daemon, so you'll have to import it into microk8s. I was able to do so using the following commands:
docker save aliwatters/dkc-multi-server > aliwatters-dkc-multi-server.tar
multipass transfer aliwatters-dkc-multi-server.tar microk8s-vm:aliwatters-dkc-multi-server.tar
microk8s ctr image import aliwatters-dkc-multi-server.tar
I also had to run microk8s enable dns
, however you might have done that already.
Please let me know if this helps!
Essentially the issue is that we don't have special logic to handle loading images into microk8s clusters like we do with kind and k3d currently. I don't think our team will be able to prioritize this right now, but if you'd like to potentially contribute to the project I can give some pointers!
Most of the logic that handle this special casing can be found here
and here
we'd essentially just have to add some more helper functions to detect microk8s clusters and then helper functions to load the images into microk8s :)
Thank you Marlon!
Yes -- this worked -- and I now understand what is happening!
ali@stinky:~/git/dkc-multi-k8s (feature-skaffold-minimal)$ docker save aliwatters/dkc-multi-server > aliwatters-dkc-multi-server.tar
ali@stinky:~/git/dkc-multi-k8s (feature-skaffold-minimal)$ multipass transfer aliwatters-dkc-multi-server.tar microk8s-vm:aliwatters-dkc-multi-server.tar
transfer failed: instance "microk8s-vm" does not exist
ali@stinky:~/git/dkc-multi-k8s (feature-skaffold-minimal)$ microk8s ctr image import aliwatters-dkc-multi-server.tar
[sudo] password for ali:
unpacking docker.io/aliwatters/dkc-multi-server:1dc48c4 (sha256:5a28a5bb0010b1e296d496b0fe3563aea263e8abad2152c9c64bdf16956d1a3f)...done
unpacking docker.io/aliwatters/dkc-multi-server:7b9b7d87ab81483cdb9b1227780d68dec815fe271aea2f9fe3a0e65090d90909 (sha256:5a28a5bb0010b1e296d496b0fe3563aea263e8abad2152c9c64bdf16956d1a3f)...done
unpacking docker.io/aliwatters/dkc-multi-server:90d1283 (sha256:5a28a5bb0010b1e296d496b0fe3563aea263e8abad2152c9c64bdf16956d1a3f)...done
unpacking docker.io/aliwatters/dkc-multi-server:e9d99b8 (sha256:5a28a5bb0010b1e296d496b0fe3563aea263e8abad2152c9c64bdf16956d1a3f)...done
unpacking docker.io/aliwatters/dkc-multi-server:f450a07 (sha256:5a28a5bb0010b1e296d496b0fe3563aea263e8abad2152c9c64bdf16956d1a3f)...done
ali@stinky:~/git/dkc-multi-k8s (feature-skaffold-minimal)$ skaffold dev
Listing files to watch...
- aliwatters/dkc-multi-server
Generating tags...
- aliwatters/dkc-multi-server -> aliwatters/dkc-multi-server:f450a07
Checking cache...
- aliwatters/dkc-multi-server: Found Locally
Tags used in deployment:
- aliwatters/dkc-multi-server -> aliwatters/dkc-multi-server:7b9b7d87ab81483cdb9b1227780d68dec815fe271aea2f9fe3a0e65090d90909
Starting deploy...
- service/server-cluster-ip-service created
- deployment.apps/server-deployment created
Waiting for deployments to stabilize...
- deployment/server-deployment: Failed: Error: secret "pgpasswd" not found
- pod/server-deployment-85c475cf6b-krzmz: Failed: Error: secret "pgpasswd" not found
... # Note: app errors -- all expected and good
cleanup
I pasted the multipass command blindly and transfer failed: instance "microk8s-vm" does not exist
-- so would just have to adjust that. But skaffold dev
worked at that point.
Images are in my local docker repository
ali@stinky:~/git/dkc-multi-k8s (feature-skaffold-minimal)$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
...
localhost:32000/dkc-multi-server 7b9b7d87ab81483cdb9b1227780d68dec815fe271aea2f9fe3a0e65090d90909 7b9b7d87ab81 7 days ago 131MB
aliwatters/dkc-multi-server 7b9b7d87ab81483cdb9b1227780d68dec815fe271aea2f9fe3a0e65090d90909 7b9b7d87ab81 7 days ago 131MB
...
I would love to contribute to this -- but I'm right at the very edge of my skill set in this area. I'll play around though.
Raised a draft PR -- is the general approach correct?
https://github.com/GoogleContainerTools/skaffold/pull/5340
(need to fix a config bug, add tests and confirm the internal command used by microk8s to import)
Thanks so much! The general approach looks good :) We can move our discussion to your PR for now
Friendly ping, I see that the fix for this Issue - #5340 is in progress. Replying here to see if if there is anything that we can do to provide some assistance.
Unfortunately, we closed #5340 due to inactivity. Any one interested in pursuing this?
Unfortunately, we closed #5340 due to inactivity. Any one interested in pursuing this?
I got similar issue using Kubeadm https://github.com/GoogleContainerTools/skaffold/issues/8235
Expected behavior
Image should be pulled/available and everything should work
Actual behavior
deployment fails -- is this user error?
https://github.com/aliwatters/dkc-mutli-k8s/tree/feature-skaffold-minimal (minimal branch)
Information
I'm hitting this error on a unbuntu 20.04 installation, with microk8s and skaffold.
I'm logged into docker.
Full error is
All the relevant files;
And the microk8s config
Versions
Steps to reproduce the behavior
skaffold dev
Additonal info
I posted on stackoverflow -- and received a comment suggest I run through the private image steps https://stackoverflow.com/questions/65964535/skaffold-and-microk8s-container-server-is-waiting-to-start-image-cant-be?noredirect=1#comment116673535_65964535
https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/#create-a-pod-that-uses-your-secret -- seems like a red herring as the image is not in a private registry.
Added
to the end of my
k8s/server-deployment.yaml
-- made no difference.Thanks for looking!
Added: https://github.com/GoogleContainerTools/skaffold/issues/5334 - related?