Skip to main content
Redhat Developers  Logo
  • AI

    Get started with AI

    • Red Hat AI
      Accelerate the development and deployment of enterprise AI solutions.
    • AI learning hub
      Explore learning materials and tools, organized by task.
    • AI interactive demos
      Click through scenarios with Red Hat AI, including training LLMs and more.
    • AI/ML learning paths
      Expand your OpenShift AI knowledge using these learning resources.
    • AI quickstarts
      Focused AI use cases designed for fast deployment on Red Hat AI platforms.
    • No-cost AI training
      Foundational Red Hat AI training.

    Featured resources

    • OpenShift AI learning
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

    Red Hat AI Factory with NVIDIA

    • Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.
    • Explore the solution
  • Learn

    Self-guided

    • Documentation
      Find answers, get step-by-step guidance, and learn how to use Red Hat products.
    • Learning paths
      Explore curated walkthroughs for common development tasks.
    • Guided learning
      Receive custom learning paths powered by our AI assistant.
    • See all learning

    Hands-on

    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.
    • Interactive labs
      Learn by doing in these hands-on, browser-based experiences.
    • Interactive demos
      Click through product features in these guided tours.

    Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics

    Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
  • Build

    Get started

    • Red Hat build of Podman Desktop
      A downloadable, local development hub to experiment with our products and builds.
    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.

    Download products

    • Access product downloads to start building and testing right away.
    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset

    References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
  • Community

    Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions

    Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github

    Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

    Join the Red Hat Developer program

    • Download Red Hat products and project builds, access support documentation, learning content, and more.
    • Explore the benefits

Deploying an internal container registry with Minikube add-ons

July 11, 2019
Kamesh Sampath
Related topics:
ContainersKubernetes
Related products:
Red Hat OpenShift Container Platform

    Minikube has a feature called add-ons, which help in adding extra components and features to Minikube’s Kubernetes cluster.

    The registry add-on will deploy an internal registry, which can then be used to push and pull Linux container images. But at times, we might wish to mimic push and pull to different registries (i.e., using aliases for container registry). In this article, I will walk you through the steps required to achieve the same.

    What do we need?

    • Minikube, preferred version is v1.1.1
    • Git to clone the sources
    • kubectl
    • kubens
    • tkn CLI

    What we will do?

    As part of this exercise we will:

    • Enable registry via Minikube add-on.
    • Update the Minikube node’s etc/hosts for the domains dev.local, example.com to resolve to the internal registry.
    • Update CoreDNS to rules that will allow pods to push images( typical case of CI/CD) to the registry using aliases.

    Deploy container registry

    As described previously, we can use Minikube add-ons to deploy and enable the internal registry. The internal registry by default gets deployed in kube-system namespace.

    minikube profile demo
    minikube start -p demo --memory=8192 --cpus=6 --disk-size=50g

    Note: If you like to use cri-o, then adjust the above command to be like:

    minikube profile demo
    minikube start -p demo --memory=8192 --cpus=6 --container-runtime=crio
    

    With Minikube running, the next step is to deploy the registry.

    minikube addons enable registry

    Once the registry is enabled, you will see a registry pod kubectl -n kube-system get pod and a corresponding service kubectl -n kube-system get svc in the kube-system namespace.

    The minkube-helper repo in GitHub has the sources along with the example application to test the configuration. Clone the sources and navigate to the registry sub-folder. For easier reference, we will call the sources folder as $PROJECT_HOME:

    git clone https://github.com/kameshsampath/minikube-helpers && \
    cd minikube-helpers/registry

    Create aliases ConfigMap

    The alias names that we want to use for the registry are configured via the ConfigMap, called registry-aliases:

    apiVersion: v1
    data:
      # Add additonal hosts seperated by new-line
      registryAliases: >-
        dev.local
        example.com
      # default registry address in minikube when enabled via minikube addons enable registry
      registrySvc: registry.kube-system.svc.cluster.local
    kind: ConfigMap
    metadata:
      name: registry-aliases
      namespace: kube-system
    
    kubectl apply -f registry-aliases-config.yaml

    Update Minikube /etc/hosts file

    To make the aliases resolve to the registry service in kube-system namespace, we need to add the aliases entries in the Minkube VM’s /etc/hosts file. We will use DaemonSet to update the etc/hosts file inside the Minikube VM.

    kubectl apply -f node-etc-hosts-update.yaml

    As it will take few minutes for the DaemonSet to be running, you can watch the status using the command:

    kubectl -n kube-system get pods --watch

    Once the DaemonSet is successfully running, you can check the Minkube VM's /etc/hosts file, which will now be updated to point to CLUSTER-IP of the registry service.

    minikube ssh -- cat /etc/hosts

    Tips

    • You can use CTRL+C to terminate the watch.
    • You can check the CLUSTER-IP of the registry service using the command kubectl -n kube-system get svc registry -o jsonpath='{.spec.clusterIP}'.

    Patch CoreDNS

    The configurations and other settings we applied in the previous section are good enough for the container runtime to push and pull the images. A typical CI/CD scenario will be something like a Kubernetes pod doing a build, e.g., Jenkins, Tekton and pushing the container image to the registry post as part of the pipeline.

    To make the pod resolve the aliases like dev.local, example.com, we need to have the CoreDNS rules configured. For our alias configuration to work, we will use the CoreDNS rewrite rules.

    Running the following command will have the CoreDNS patched with the rewrite rules.

    ./patch-coredns.sh

    The CoreDNS patch can be queried to see the updates. A successful update will show output for the command kubectl -n kube-sytem configmap coredns -oyaml as shown below:

    apiVersion: v1
    data:
      Corefile: |-
        .:53 {
            errors
            health
        rewrite name dev.local  registry.kube-system.svc.cluster.local
        rewrite name example.com  registry.kube-system.svc.cluster.local
            kubernetes cluster.local in-addr.arpa ip6.arpa {
               pods insecure
               upstream
               fallthrough in-addr.arpa ip6.arpa
            }
            prometheus :9153
            forward . /etc/resolv.conf
            cache 30
            loop
            reload
            loadbalance
        }
    kind: ConfigMap
    metadata:
      name: coredns
      namespace: kube-system

    Test the configuration

    I found the real need of this registry hack was when I was trying to deploy Tekton pipelines. Tekton is Kubernetes' native way of declaring CI/CD pipelines.

    As part of my pipeline (see example), I want to build and deploy a simple Hello World application.

    Deploy Tekton pipelines

    kubectl apply --filename https://storage.googleapis.com/tekton-releases/latest/release.yaml

    The status of Tekton pipelines can be watched using:

    kubectl get pods --namespace tekton-pipelines -w

    Deploy application pipeline

    kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/master/golang/build.yaml \
      --filename example/build.yaml

    As it will take some time for the pipeline to complete, you can watch the status using the command:

    tkn taskrun logs -f -a hello-world

    A successful pipeline build will have the Hello World application deployed. You can use the following Minikube shortcut:

    curl $(minikube service helloworld --url)

    to call the service, which returns a “Hello World” as the response.

    Note: When you see tkn logs -f -a hello-world showing a blank screen, it might be that it's pulling the required images. To know what's happening, you can use kubectl get events -w.

    I hope this article will help with similar development environment use cases that you might have. Next time, we will take a deep dive into Tekton. Until then, happy Kubernetes hacking!

    Last updated: February 11, 2024

    Recent Posts

    • MCP servers vs. skills: Choosing the right context for your AI

    • How to route external and local LLMs with Models-as-a-Service

    • Protect data offloaded to GPU-accelerated environments with OpenShift sandboxed containers

    • Case study: Measuring energy efficiency on the x64 platform

    • How to prevent AI inference stack silent failures

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Build

    • Developer Sandbox
    • Developer tools
    • Interactive tutorials
    • API catalog

    Quicklinks

    • Learning resources
    • E-books
    • Cheat sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site status dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2026 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Chat Support

    Please log in with your Red Hat account to access chat support.