Using Init Containers in Kubernetes

30 minutes
  • 2 Learning Objectives

About this Hands-on Lab

Init containers are a great way to customize container startup. This lab will allow you to test your knowledge of init containers by using them to solve problems in an existing Kubernetes cluster.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Create a Sample Pod That Uses an Init Container to Delay Startup

You will find a simple pod descriptor on the control plane server at /home/cloud_user/pod.yml. Modify this pod descriptor to add an init container that will delay startup if shipping-svc cannot be located using nslookup. Then, create the pod.

Test Your Setup by Creating the Service and Verifying the Pod Starts Up

Apply the deployment descriptor for the shipping-svc found at /home/cloud_user/shipping-svc.yml. Watch the status of your pod. If you set it up correctly, you should see the pod complete startup once the service becomes available.

Additional Resources

You are working for BeeBox, a company that provides regular shipments of bees to customers. The company is in the process of deploying a shipping status application to the cluster.

The developers are building an application component designed to run in a Kubernetes pod. This component depends on a Kubernetes service called shipping-svc, and they would like their application container to delay startup when this service is not available in the cluster. Once the service becomes available, the main application container should proceed with startup.

Your task is to build a proof-of-concept showing how a pod can be designed that will delay startup of application containers until the service becomes available.

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.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?