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

Adding Persistent Storage to Minishift / CDK 3 in Minutes

April 5, 2017
Alessandro Arrichiello
Related topics:
Developer toolsKubernetesContainersDevOps
Related products:
Developer ToolsetRed Hat OpenShift Container Platform

    Hi there! It's been a while since I last wrote an article. Today, I want to show you how to easily setup some persistent storage for your projects in minishift / CDK 3 (Red Hat's Containers Development Kit 3).

    Prerequisites

    First, let's start planning what you'll need:

    • A working minishift or CDK 3.

    That's all, I swear!

    I won't go deep into how to set up a minishift or CDK 3, there are many articles on the Internet to cover this. Anyway I'll recap some useful links below, just to make sure you'll get a working minishift/CDK3 before proceeding:

    https://developers.redhat.com/blog/2017/02/28/using-red-hat-container-development-kit-3-beta/

    Minishift Github page - https://github.com/minishift/minishift

    Let's start!

    Once you've successfully set up a working minishift/CDK3, you're now ready to move forward, creating the underlying storage for your Persistent Volumes (PVs).

    First of all, connect to your running minishift/CDK3:

    $ minishift ssh
    [docker@minishift ~]$ sudo -i
    [root@minishift ~]#

    Ok, now we're ready to create our first persistent volume backend directory for hosting Docker Registry files:

    [root@minishift ~]# mkdir -p /mnt/sda1/var/lib/minishift/openshift.local.volumes/pv
     [root@minishift ~]# mkdir /mnt/sda1/var/lib/minishift/openshift.local.volumes/pv/registry
     [root@minishift ~]# chmod 777 -R /mnt/sda1/var/lib/minishift/openshift.local.volumes/pv

    Perfect! We can now move to the PersistentVolume creation for our Docker Registry container.

    First, log out from your minishift/CDK3 vm and then log in to your Openshift via oc-client:

    $ oc login -u system:admin
    Logged into "https://192.168.42.58:8443" as "system:admin" using existing credentials.
    
    You have access to the following projects and can switch between them with 'oc project <projectname>':
    
     default
     kube-system
     * myproject
     openshift
     openshift-infra
    
    Using project "myproject".
    

    Let's switch to project "default":

    $ oc project default
    Now using project "default" on server "https://192.168.42.69:8443".

    Finally, create your first PersistentVolume:

    $ cat << PV | oc create -f -
    apiVersion: v1
    kind: PersistentVolume
    metadata:
     name: registry
    spec:
     capacity:
      storage: 5Gi
     accessModes:
      - ReadWriteOnce
     storageClassName: slow
     hostPath:
      path: /mnt/sda1/var/lib/minishift/openshift.local.volumes/pv/registry
    PV

    Pay attention to two things here:

    1. Storage capacity: it's not calculated automatically! You should care about disk size and free space.
    2. Usage of Volume type "hostPath", the storage is on the minishift/CDK3 virtual disk, you should take care of permissions!

    Ok, now we're ready to create our first PersistentVolumeClaim, to be bound with a PersistentVolume resource:

    $ cat << PVC | oc create -f -
    kind: PersistentVolumeClaim
    apiVersion: v1
    metadata:
     name: registryclaim
    spec:
     accessModes:
      - ReadWriteOnce
     resources:
      requests:
       storage: 5Gi
     storageClassName: slow
     selector:
      name: registry
    PVC

    As you can see from the PersistentVolumeClaim definition, we match the PersistentVolume by the name "registry".

    We can now look at the result by checking the output of the following commands:

    $ oc get pvc
    NAME          STATUS VOLUME   CAPACITY ACCESSMODES AGE
    registryclaim Bound  registry 5Gi      RWO         8s

    Finally, we can patch the current registry DeploymentConfig adding the just created storage:

    $ oc volume dc/docker-registry --add --name=registry-storage -t pvc --claim-name=registryclaim --overwrite
    deploymentconfig "docker-registry" updated
    

    That's all! You can repeat these steps as many times as you want! But, pay attention to your vm's free space!


    About Alessandro

    Alessandro Arrichiello is a Solution Architect for Red Hat Inc. He has a passion for GNU/Linux systems, that began at age 14 and continues today. He worked with tools for automating Enterprise IT: configuration management and continuous integration through virtual platforms. He’s now working on distributed cloud environment involving PaaS (OpenShift), IaaS (OpenStack) and Processes Management (CloudForms), Containers building, instances creation, HA services management, workflows build.


    Register to download the Red Hat Container Development Kit and accept the terms and conditions of the Red Hat Developer Program, which provides no-cost subscriptions for development use only.

    Last updated: April 6, 2017

    Recent Posts

    • Every layer counts: Defense in depth for AI agents with Red Hat AI

    • Fun in the RUN instruction: Why container builds with distroless images can surprise you

    • Trusted software factory: Building trust in the agentic AI era

    • Build a zero trust AI pipeline with OpenShift and RHEL CVMs

    • Red Hat Hardened Images: Top 5 benefits for software developers

    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.