- Lab
-
Libraries: If you want this lab, consider one of these libraries.
- Cloud
Exploring Podman and Kubernetes Interoperability on RHEL
Podman can be used to capture the configuration of local containers and pods and export them to a Kubernetes YAML file. In this lab, we’re going to examine how interoperability between Podman and Kubernetes works by using Podman to generate a YAML configuration file. We'll use both Kubernetes and Podman to run the pod defined in our YAML file. Upon completion of this lab, you will have a solid understanding of how Podman interoperates with Kubernetes.
Lab Info
Table of Contents
-
Challenge
Create an nginx Podman Pod
Before you can create a YAML file, you need a pod and some containers. First, create an
nginxpod.Perform the following tasks:
- Check for existing pods and containers.
- Create a Podman pod named
test-podwith port80published to8080. - Start the
nginxcontainer:- Put it in the
test-podpod. - Set
restarttoalways. - Set the name to
test-nginx. - Use the
nginxshort name for the container image.
- Put it in the
- Check again for pods and containers.
- Test the
nginxpod withcurland a web browser.
-
Challenge
Generate a Kubernetes YAML File
Use the
podman generate kubecommand to generate your Kubernetes YAML file.Perform the following tasks:
- Check again for pods and containers.
- Create a YAML file from your
test-podpod.- Name the file
test-pod.yml.
- Name the file
- Examine the
test-pod.ymlfile. - Clean up all Podman pods, containers, and images before proceeding.
-
Challenge
Execute Your Podman-Generated Kubernetes YAML File Using Podman
Use Podman to run the pod defined in your
test-pod.ymlfile.Perform the following tasks:
- Check for existing pods and containers.
- Run the pod from your
test-pod.ymlYAML file. - Check again for pods and containers.
- Test the
nginxpod withcurland a web browser. - Clean up all Podman pods, containers, and images before proceeding.
-
Challenge
Install and Start MicroK8s
Before you can try to run your YAML file, you need to install and start MicroK8s. 3 scripts have been provided to do this in the
cloud_userhome directory. Run them in the following order:microk8s_1.sh, thenmicrok8s_2.sh, and finallymicrok8s_3.sh. The first 2 scripts need to be run withsudo. The third must be run withoutsudo. Wait a minute between scripts 1 and 2 so thatsnapdcan fully initialize.Note: You will need to log out of the lab server after script 2, and then log back in.
-
Challenge
Execute Your Podman-Generated Kubernetes YAML File Using MicroK8s
Use MicroK8s to create your
nginxpod using thetest-pod.ymlYAML file.Perform the following tasks:
- Check to see if you have any Kubernetes pods.
- Create your
nginxpod using yourtest-pod.ymlfile. - Check again to see if you have any Kubernetes pods.
- Get more information on the details and status of your pod.
- Test the
nginxpod withcurland a web browser. - Remove your
test-podpod. - Check again to see if you have any Kubernetes pods.
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.