Creating a deployment resource:

A deployment is a kubernetes resource used for deploying pods.
Below is the Yaml file describing our deployment:

The above Yaml file is used to deploy two replicas of a pod using the "nginx" image.

Exposing the deployment:

To expose pods, making them reachable either from inside or from outside the kubernetes cluster we use a service.
A service is an entry point to pods in kubernetes.

By exposing a deployment resource using a service, we expose the pods mentioned in the deployment Yaml file.
The below command exposes the deployment "deploy-service" and its pods:

We can then check the service using the below command:


The application running inside the pods, will be accessible through the internal service (ClusterIP service)

ClusterIP, the default service:

Because we didn't mention the type of the service, the default one "ClusterIP" is created.
The ClusterIP service is accessible only from within the kubernetes cluster.

Brando Sabatini and Ikbal C ©. Powered by Blogger.