- Lab
- A Cloud Guru
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.
Path 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
nginx
pod.Perform the following tasks:
- Check for existing pods and containers.
- Create a Podman pod named
test-pod
with port80
published to8080
. - Start the
nginx
container:- Put it in the
test-pod
pod. - Set
restart
toalways
. - Set the name to
test-nginx
. - Use the
nginx
short name for the container image.
- Put it in the
- Check again for pods and containers.
- Test the
nginx
pod withcurl
and a web browser.
-
Challenge
Generate a Kubernetes YAML File
Use the
podman generate kube
command to generate your Kubernetes YAML file.Perform the following tasks:
- Check again for pods and containers.
- Create a YAML file from your
test-pod
pod.- Name the file
test-pod.yml
.
- Name the file
- Examine the
test-pod.yml
file. - 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.yml
file.Perform the following tasks:
- Check for existing pods and containers.
- Run the pod from your
test-pod.yml
YAML file. - Check again for pods and containers.
- Test the
nginx
pod withcurl
and 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_user
home 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 thatsnapd
can 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
nginx
pod using thetest-pod.yml
YAML file.Perform the following tasks:
- Check to see if you have any Kubernetes pods.
- Create your
nginx
pod using yourtest-pod.yml
file. - Check again to see if you have any Kubernetes pods.
- Get more information on the details and status of your pod.
- Test the
nginx
pod withcurl
and a web browser. - Remove your
test-pod
pod. - Check again to see if you have any Kubernetes pods.
What's a lab?
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.
Provided environment for hands-on practice
We will provide the credentials and environment necessary for you to practice right within your browser.
Guided walkthrough
Follow along with the author’s guided walkthrough and build something new in your provided environment!
Did you know?
On average, you retain 75% more of your learning if you get time for practice.