Search⌘ K

Services and External Access

Explore the challenges of accessing Kubernetes applications using Services alone and understand why fixed ports create issues. Learn how to configure and validate Ingress to enable user-friendly external access with standard HTTP and HTTPS ports, including managing SSL certificates for secure communication.

Only Services won’t suffice

We cannot explore solutions before we know what the problems are. Therefore, we’ll recreate a few objects using the knowledge we’ve already gained. This will let us see whether Kubernetes Services satisfy all the needs that the users of our applications might have. To be more clear, we’ll explore which features we’re missing when making our applications accessible to users.

We’ve already discussed that it is not recommended to publish fixed ports through Services. This method is likely to result in conflicts or, at the very least, create the additional burden of carefully keeping track of which port belongs to which Service. We already discarded that option before and we won’t change it now.

Shell
kubectl create -f go-demo-2-deploy.yml
kubectl get -f go-demo-2-deploy.yml

The output of the get command is as follows:

Shell
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/go-demo-2-db 0/1 1 0 2m15s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/go-demo-2-db ClusterIP 10.111.211.179 <none> 27017/TCP 2m15s
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/go-demo-2-api 0/3 3 0 2m15s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/go-demo-2-api NodePort 10.103.180.226 <none> 8080:30753/TCP 2m15s

As we can see, these are the same Services and Deployments we previously created.

Before we move on, we should wait until all the Pods are up and running.

Shell
kubectl get pods

The output is as follows:

Shell
NAME READY STATUS RESTARTS AGE
go-demo-2-api-68df567fb5-8qcmv 1/1 Running 0 3m
go-demo-2-api-68df567fb5-k55d4 1/1 Running 0 3m
go-demo-2-api-68df567fb5-ws9cj 1/1 Running 0 3m
go-demo-2-db-dd48b7dfc-hdxbz 1/1 Running 0 3m

If, in your case, some of the Pods are not yet running, please wait a few moments and re-execute the kubectl get pods command. We’ll continue once they’re ready. ...