We first deploy two replicas of the "nginx" pods using the below command:

Below is the "deploy_1.yaml" file:

Exposing the pods through a service:

The deployment "nginxdeployment" creates two replicas of the pods running the "nginx" application.
To expose the application "nginx" running inside the pods to the rest of the cluster, we need to expose it using a "ClusterIP" service:

Displaying the service:

We display the service using the below command:

Displaying the deployment:

We can see that we have two ready pods for the "nginxdeployment" defined in the above "deploy_1.yaml" file.

Deleting a deployment:

When we delete a deployment, the pods creates by the deployment get also deleted.

Checking the pods:

We check the pods using the below command:

We can see the "Terminating" state of the pods.

Removing the services:

After deleting the deployment, which deleted the pods, we need to finish cleaning up by also removing the service we created.
To display the services, we use:

To delete the above service "deploy-service" we use the below command:

Brando Sabatini and Ikbal C ©. Powered by Blogger.