From the course: Certified Kubernetes Administrator (CKA) Cert Prep

Fixing application access problems

- So the next type of trouble that we need to be able to fix is application access problems. Let's try to understand how that works. In fact, you should already know it. So to access applications that are running in the Pods, Surfaces as well as Ingress are used, normally you need both of them. The least you need is a Surface. So the Surface resource uses a selector label to connect to Pods with the matching label and the Ingress resource connects to a Surface and picks up its selector label to connect to the backend Pods directly. And the main troubleshooting is to check the labels in all of these resources if it doesn't work. So let me demonstrate how this works. I'm going to start with the kubectl and get ing, where we can see my app. So I'm going to use curl to myapp.io and what do I get? I'm getting nothing. Now, troubleshooting part one, can we ping it? So I'm using ping on myapp.io and there we can see, aha, myapp.io. It's coming with some weird IP address, which means that this is not doing what it needs to be doing. So let's fix that problem by using sudo vim on etc hosts. And where are we going to direct it to? Well, I am going to use myapp.io Now what is the ping test doing? The ping test is showing my local host 127.0.0.1. So let me try the curl again. And what is curl telling me? curl is telling me couldn't connect to server. Oh boy, couldn't connect to server. Well, let's figure out what might be wrong. I would say let's check on the Ingress resource. So kubectl describe ing, myapp. Now look at that. All of this is looking good. What I'm looking for is myapp.io and myapp.io is showing that it has a service backend, myapp:80 and most important, it has a couple of pulled backends and these pulled backends are sufficient proof that it should be running. Now what I would be interested in is the Surface backend. So kubectl get svc. So we have a problem on Ingress. I want to know if the Surface is doing it. Now to Surface myapp is ClusterIP, but I happen to be on the control note. So curl to 10.103.60.138 should work. And yeah, it works. It's telling me welcome to nginx. So the problem is in the Ingress resource, the problem is not in the configuration. The problem is not in the API. Aha. Do you remember? Ingress resource kubectl get pods - n kube system. Do we have any Ingress that is running here? Well, I don't see anything that looks like Ingress right here. And kubectl get ns. Maybe it has its own namespace. And oh, I do see an Ingress, nginx namespace. So now I'm using kubectl get all - n, ingress nginx and uh-oh. No resources found in the Ingress nginx namespace. So we have identified the problem and the problem is that apparently there is no Ingress controller running here.

Contents