We will use the below Yaml file "dep1.yaml" to create our deployment resource that creates two replicas of the "nginx" pods:
We can create the deployment "nginxdeployment" that creates two replicas of the pods (nginx):
Displaying the pods:
We display the pods created by our deployment using the below command:
Deleting one of the replica pods:
We delete one of the replica pods:
We see below that kubernetes redeployed another pod with another name: "nginxdeployment-5b9fb7b7d9-jwkbq ", so that the number of replicas is always two, matching the number of replicas in the above deployment Yaml file.