How do I expose a registry hosted in Minikube?

4/22/2020

I have started a Kubernetes cluster with Minikube. I used a simple deployment file to create a deployment that runs the Registry container:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: registry
  labels:
    app: registry
spec:
  replicas: 3
  selector:
    matchLabels:
      app: registry
  template:
    metadata:
      labels:
        app: registry
    spec:
      containers:
      - name: registry
        image: registry:latest
        ports:
        - containerPort: 80

After this, I expose the deployment using a service:

$ kubectl expose deployment/registry --type="LoadBalancer" --port 5000  
$ minikube service registry 

This exposes my registry to the host machine. I can navigate to http://172.17.174.88:31826/v2/_catalog in my browser and see there's no repositories yet. I have an image running an ASP.Net WebApi project called WeatherApp on my host machine's docker. I run these commands:

$ docker tag 0a259f7ce186 172.17.174.88:31412/weatherapp
$ docker push 172.17.174.88:31412/weatherapp

This causes the following error:

The push refers to repository [172.17.174.88:31412/weatherapp] Get https://172.17.174.88:31412/v2/: dial tcp 172.17.174.88:31412: connect: no route to host

I think the problem is that my docker client is trying to connect to the registry over HTTPS, which will not work. How can I force my docker client to use HTTP to push the image to my registry?

-- yesman
kubernetes

1 Answer

4/22/2020

I‘m afraid that you will have no chance to fall back to just http. You are forced to use https. You need to configure insecure registries in your docker client. This might help: https://docs.docker.com/registry/insecure/

-- Michael Johann
Source: StackOverflow