- Lab
-
Libraries: If you want this lab, consider one of these libraries.
- Core Tech
Managing Stateful Workloads and Docker Image Optimization
By default, storage on Kubernetes pods is ephemeral, which can put necessary data at risk of deletion when a pod is removed and recreated. In this hands-on lab, you will walk through a scenario in which you set up a service to deploy fleet-wide with persistent storage using StatefulSets, PersistentVolumes and PersistentVolumeClaims. Additionally, you will refactor the Dockerfile for the service to ensure it uses fewer resources, then clean up the internal Docker registry and used workstation, ensuring you’re leaving your working environment in a clean and secure state.
Lab Info
Table of Contents
-
Challenge
Configure a persistent storage solution for the backup tool
Create a PersistentVolume,
backup-archive-pv, and a matching PersistentVolumeClaim,backup-archive-pvc, for the backup tool. Ensure the claim mounts to the/backupslocation on the pod, then test the persistence by running the backup tool on the pod (backup-tool run) to create an archive and confirm its existence (backup-tool list). Delete and recreate the pod and confirm the backup is still there. -
Challenge
Enable dynamic volume provisioning for the backup tool
Create a StorageClass,
backup-storage, and an associated PersistentVolumeClaim,backup-archive-dynamic-pvc. Confirm Kubernetes provisioned a matching volume automatically when a pod is created. -
Challenge
Create a StatefulSet to deploy the backup tool across multiple servers
Deploy the backup tool as a StatefulSet,
backup-fleet, using a volumeClaimTemplate to ensure each replica gets its own storage solution. Scale the StatefulSet up and confirm a new PVC was created. Test replica isolation by setting one replica's mode to ReadWriteOnce and attempting to mount it to another pod. -
Challenge
Refactor the Dockerfile for the backup tool to leverage a multi-stage build
Refactor the Dockerfile for the backup tool to use a multi-stage build and verify the size difference. Tag the push the image to the provided
10.0.1.104:5000registry, and remove outdated image tags. -
Challenge
Clean up the workstation for unused Docker resources
Remove unused Docker containers, images, volumes, and other resources from your workstation
About the author
Real skill practice before real-world application
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.
Learn by doing
Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.
Follow your guide
All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.
Turn time into mastery
On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.