Create a pod from registry running on the same cluster

1/30/2019

I am running Harbor Registry on my cluster and I have no problem pushing and pulling the images from outside of the cluster.

Now I'd like to be able to create a pod from that registry. Something like this:

.
kubectl run -i --tty --rm debug --image=harbor.harbor.svc.cluster.local/test/alpine:latest --restart=Never -- sh

.

Is this possible?

Update

If I try to access the registry by its service name harbor.harbor.svc.cluster.local it doesn't work because the host name is not found.

How can I reference my image?

-- arkadiy
harbor
kubernetes

3 Answers

1/30/2019

Yes it is possible. There is also concept of local registry which is part of cluster and you can pull images from their. Even OpenShift come with local registry.

-- Rajesh Deshpande
Source: StackOverflow

1/30/2019

Well, this is not a single setup invocation as the one you envisage. There are a set of steps (read as prerequisites) you must follow to get this sorted:

  1. Setup local registry on the node
  2. Setup of docker certificates - required for secure access to the local registry from your pod
  3. Setup of k8s secret which will be part of your deployment - required to access your local registry on the node
  4. Lastly, the deployment itself
-- Raunak Jhawar
Source: StackOverflow

1/30/2019

As @Rajesh mentioned in comment, you need to create NodePort type service if you are on same subnet with your nodes or if you are using some cloud for your cluster such as AWS, GKE, also you can create LoadBalancer type service and access through External Loadbalancer to your registry.

-- coolinuxoid
Source: StackOverflow