Exploring Podman and Kubernetes Interoperability on RHEL

1 hour
  • 5 Learning Objectives

About this Hands-on Lab

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.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

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 port 80 published to 8080.
  • Start the nginx container:
    • Put it in the test-pod pod.
    • Set restart to always.
    • Set the name to test-nginx.
    • Use the nginx short name for the container image.
  • Check again for pods and containers.
  • Test the nginx pod with curl and a web browser.
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.
  • Examine the test-pod.yml file.
  • Clean up all Podman pods, containers, and images before proceeding.
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 with curl and a web browser.
  • Clean up all Podman pods, containers, and images before proceeding.
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, then microk8s_2.sh, and finally microk8s_3.sh. The first 2 scripts need to be run with sudo. The third must be run without sudo. Wait a minute between scripts 1 and 2 so that snapd can fully initialize.

Note: You will need to log out of the lab server after script 2, and then log back in.

Execute Your Podman-Generated Kubernetes YAML File Using MicroK8s

Use MicroK8s to create your nginx pod using the test-pod.yml YAML file.

Perform the following tasks:

  • Check to see if you have any Kubernetes pods.
  • Create your nginx pod using your test-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 with curl and a web browser.
  • Remove your test-pod pod.
  • Check again to see if you have any Kubernetes pods.

Additional Resources

Let's have a play date with Podman and Kubernetes!

We're going to explore Podman and Kubernetes interoperability by using Podman to create an nginx pod and generate a Kubernetes YAML configuration file using our pod. We're going to then examine running a pod from that YAML file with both Podman and MicroK8s, a lightweight Kubernetes distribution.

Let's go!

When the lab starts, open an SSH connection to your lab instance. Replace PUBLIC_IP_ADDRESS with either the Public IP or DNS of the instance:

ssh cloud_user@<PUBLIC_IP_ADDRESS>

The cloud_user password has been provided with the credentials and instance information within the hands-on lab.

Good luck and enjoy!

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!