Kubernetes 101 : Creating a single pod, and exposing it through a service



We have the below scenario :

A single "nginx" pod listening on targePort "80", and a cluster IP service "pointing" to it.

We access the service using its IP address "10.85.23.25", and its Port "3020":


We first start by creating the pod as below:


Then we check if the pod was created, using the below command:


Next, we create a clusterIP service as below - a clusterIP service is the entry point to the pods, requests going to the pods, go though a service - :


We could also create the same service using the below Yaml file and the "kubectl apply" command:


Remark:

The clusterIP  IP address is assigned by kubernetes, if we don't explicitly specify it.

Comments

Leave as a comment:

Archive