Skip to main content

Building an image and testing it in Kind

With Podman Desktop, you can build an image with your container engine, and test it in your local Kind-powered Kubernetes cluster.

Prerequisites

Procedure

  1. Build your image:

    1. Open Images > Build an image.
    2. Containerfile path: select your Containerfile or Dockerfile.
    3. Build context directory: optionally, select a directory different from the directory containing your Containerfile or Dockerfile.
    4. Image Name: enter your image name my-custom-image.
    5. Click Build.
    6. Wait for the image build to finish.
    7. Click Done to get back to the images list.
  2. Push your image to your Kind cluster:

    1. Search images: enter your image name my-custom-image to find the image.
    2. Click > Push image to Kind cluster.
  3. Test your image by creating a container:

    1. Click to open the Create a container from image dialog.
    2. Container name: enter my-custom-image-container.
    3. Review the parameters that Podman Desktop has detected from your image definition.
    4. Click Start Container to start the container in your container engine.
  4. Test your image and container on your Kind cluster:

    1. Search containers: enter my-custom-image-container to find the running container.
    2. Click > Deploy to Kubernetes to open the Deploy generated pod to Kubernetes screen.
    3. Pod Name: keep the proposed value my-custom-image-container-pod.
    4. Use Kubernetes Services: select Replace hostPort exposure on containers by Services. It is the recommended way to expose ports, as a cluster policy might prevent to use hostPort.
    5. Expose service locally using Kubernetes Ingress: if your container is exposing at a port, select Create a Kubernetes ingress to get access to the ports that this pod exposes, at the default ingress controller location. Example: on a default Kind cluster created with Podman Desktop: http://localhost:9090. Requirements: your cluster has an ingress controller`.
    6. Optionally, if your container is exposing more than one port, select the port to expose.
    7. Kubernetes namespaces: select default.
    8. Click Deploy.
    9. Wait for the pod to reach the state: Phase: Running.
    10. Click Done.

Verification

  1. The Pods screen lists the running my-image-container-pod pod.
  2. Click on the pod name to view details and logs.
  3. Optionally, if your container is exposing a port, go to http://localhost:9090: your application is running.