Creating K8s Resources
In order to create a K8s deployment, we’ll need a Docker image. Let’s add the following lines to our Dockerfile
:
The steps in our Docker file:
We can now build the image and push to the hub:
The K8s deployment is simple. It consists of a deployment and a service:
The deployment defines two replicas of the pod that will be running the container that’s built from the image specified in the image attribute.
The service is of type ClusterIP
(the default Kubernetes service). It gives us a service inside our cluster that other apps can access.
Creating the resources in your cluster:
The resources can be visualized as follows:
This content was originally published here.