0

Sorry about a newbie question. I am trying to deploy an image into k3d (a dockerized version of k3s).

k3d image import -c my-cluster registry.gitlab.com/aaa/bbb/ccc/hello123

Now I can see the image on a node:

kubectl get node my-node -o json | grep hello123

However, the documentation doesn't say much about what "import" does. Is my image running? Is it allocated to a pod yet? Where can I find its logs?

If I knew what pod it's running in, I could do kubectl logs. The list of the cluster's pods doesn't show anything relevant.

I am beginning to think my image isn't running yet.

Edit: This if further confirmed by

kubectl get pods --all-namespaces -o jsonpath="{.items[*].spec.containers[*].image}" |\
tr -s '[[:space:]]' '\n' |\
sort |\
uniq -c

showing nothing relevant.

What's the next step?

Irina Rapoport
  • 1,404
  • 1
  • 20
  • 37

1 Answers1

1

You have just pulled the image to the cluster registry, the image has not been yet assigned to a pod.

Once you create a pod with the same image and image tag, it will try to pull from the local registry.

If you could ssh to the k8s node (kubectl get nodes -o wide and ssh user@nodeip), you can run the docker commands like:

docker images

You can expect to see the image that you pulled in the list.

If non of the pods are running the docker ps will return you an empty list.

Vishrant
  • 15,456
  • 11
  • 71
  • 120
  • Wow, that's the question I was going to ask next, thanks! How do I find user? My node only has an internal ip, I guess I'll need to give it an external one, how? – Irina Rapoport Sep 26 '22 at 04:05
  • you will have to connect with your admin to know what username and password are being used while creating these nodes, if you are creating the k3d cluster on your own, please google to know what are the default username and password. – Vishrant Sep 26 '22 at 04:11
  • I am the admin, this is a local installation. I think it's found in `~/.kube/config` under `contexts.context.user`. However, it times out, probably because the node needs a public IP? – Irina Rapoport Sep 26 '22 at 04:15
  • no, the node does not need a public IP, if you are within the network, you should be able to ssh using internal IP – Vishrant Sep 26 '22 at 04:16
  • I don't think I am. "By default, k3d creates a new (docker) network for every new cluster." – Irina Rapoport Sep 26 '22 at 04:20