k8s: Get access to pods

1/28/2020

I newbie question related with k8s. I've just installed a k3d cluster.

I've deployed an this helm chart:

$ helm install stable/docker-registry

It's been installed and pod is running correctly.

Nevertheless, I don't quite figure out how to get access to this just deployed service.

According to documentation, it's listening on 5000 port, and is using a ClusterIP. A service is also deployed.

$ kubectl get services                                                                                                                                    
NAME                         TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)    AGE
kubernetes                   ClusterIP   10.43.0.1      <none>        443/TCP    42h
docker-registry-1580212517   ClusterIP   10.43.80.185   <none>        5000/TCP   19m

EDIT

I've been able to say to chard creates an ingress:

$ kubectl get ingresses.networking.k8s.io -n default                                                                                                                                                                                                                                                                     
NAME                         HOSTS                 ADDRESS      PORTS   AGE
docker-registry-1580214408   chart-example.local   172.20.0.4   80      10m

Nevertheless, I'm still without being able tp push images to registry:

$ docker push 172.20.0.4/feedly:v1                                                                                                                                                                                                                                                                                       
The push refers to repository [172.20.0.4/feedly]
Get https://172.20.0.4/v2/: x509: certificate has expired or is not yet valid
-- Jordi
kubernetes

1 Answer

1/28/2020

Since the service type is ClusterIP, you can't access the service from host system. You can run below command to access the service from your host system.

kubectl port-forward --address 0.0.0.0 svc/docker-registry-1580212517 5000:5000 &

curl <host IP/name>:5000
-- Subramanian Manickam
Source: StackOverflow