Closed chiangandy closed 2 years ago
I found the solution by my self, let me explain... Since deployment pull container by docker which is out of k8s DNS network, so that is why service name cannot be reach. so we cannot use service name.
the solution is ... append following in KinD config file.
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
containerdConfigPatches:
- |-
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."localhost:5000"]
endpoint = ["http://${host_name}:5000"]
${host_name} is local machine host name, it can be found via "uname -a" to get. After KinD lunch ready, then install docker registry in KinD and also use forward port to 5000 as below:
kubectl port-forward --namespace default svc/docker-registry 5000:5000
if port-forward is not prefer, it need to open port 5000 in KinD and use ingress to expose 5000 mapping to registry service.
then using localhost:5000/${container_name}:${tag_name} for deployment.
kubectl run test-pod --image=localhost:5000/${container_name}:${tag_name} --restart=Never
then everything is corrected.
Thanks.
I got issue for registry host name reach... When I use this docker-registry in KinD 3 clusters(1 control plane and two worker).
and push image from local via...(I map registry 5000 port to registry.k8s.com via ingress)
It is successfully and check repository
So image is existed.
and my registry vervice is
and I want to run this images as pod...
kubectl run test-pod --image=my-docker-registry:5000/grpc-server:V1.2 --restart=Never
Then I got fail for deployment
Then I check pod logs...
It look like service name cannot be reach in deploy process. I did something wrong? or do I need to config more from this?
Any information will be appreciated.