Environment Verification
Start by checking how many pods exist on the system with the command:describe output include:
The image “busybox888” does not exist, which is why the pods are not becoming ready. Verify and update your image name as needed.
Creating a Deployment Using a YAML Definition
The next task is to create a new deployment using a YAML file. In your root directory, verify the YAML file presence:apps/v1, the kind is mistakenly written in lowercase. The kind field is case sensitive and must start with an uppercase letter.
Below is the corrected YAML definition:
kind field, save the file and run:
Creating a Deployment via the Command Line
An alternative method is to create a deployment directly from the command line by specifying the name, image, and number of replicas. For example, to create an HTTP frontend deployment with three replicas using a specific image, run:http-frontend deployment listed, and eventually, the pods should transition to a ready state.
Summary
This lesson demonstrated how to:- Check the environment for existing pods, ReplicaSets, and deployments.
- Troubleshoot a deployment issue caused by an incorrect image.
- Correctly create a deployment using a YAML definition.
- Create a deployment directly from the command line.
Ensuring correct syntax and case sensitivity in your Kubernetes YAML files is crucial to avoid deployment errors.