Using Storage in Docker Kubernetes Service

30 minutes
  • 4 Learning Objectives

About this Hands-on Lab

Kubernetes has the ability to provide external storage for your containerized applications. In this lab, you will be able to work with Kubernetes storage hands-on, designing your own solution to a real-world problem using Kubernetes features. This will help you familiarize yourself with Kubernetes features, such as volumes, and PersistentVolumes.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Create a Persistent Volume
  1. Create a PersistentVolume with a type of hostPath that stores data at the path /etc/output on the host.
  2. Set the capacity to 1Gi.

Note: that you will need to create and use a custom StorageClass that supports volume resizing since you will need to resize the PersistentVolumeClaim later. For this exercise, you can use the provisioner kubernetes.io/no-provisioner.

Create a Persistent Volume Claim.
  1. Create a PersistentVolumeClaim that will bind to the PersistentVolume. Give it a capacity of 100Mi.
Create a Pod That Will Output Data to the Persistent Volume
  1. Create a pod that uses the image busybox and sends a response to output.log.
    sh -c while true; do echo "Successfully written to log." >> /output/output.log; sleep 10; done
    1. Mount the PersistentVolumeClaim, so that the data written to /output/output.log by the container shows up in the persistent volume storage.
Resize the Persistent Volume Claim
  1. Increase the size of the PersistentVolumeClaim to 200Mi.

Additional Resources

Your company is exploring using Docker Enterprise to manage containers with Docker Kubernetes Service. Your developers would like to experiment with running an application that requires persistent storage. They also want to know how their application will behave if the storage volume size is increased in the future.

Your task is to create a PersistentVolume and a Pod which uses that PersistentVolume's storage resources. You will need to create a PersistentVolume, and a PersistentVolumeClaim, then create a Pod that mounts the PersistentVolumeClaim, and outputs some data to it. Finally, you will need to increase the size of the PersistentVolumeClaim after the Pod is already using it.

Note: You can access UCP at https://<UCP_MANAGER_PUBLIC_IP>. You can log in to the UCP using the username admin and the randomly-generated password associated with any of the lab servers.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


$2,495.00

Checkout
Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!