1

I'm learning kubernetes via a LinkedIn learning course. A tutorial I'm doing runs this hello world application via kubectl and minikube. Everything appears in working order, but I cannot interact with the application using minikube service helloworld. The request keeps timing out.

The tutorial first asks to create a deployment using the command kubectl create -f helloworld.yaml then to expose the service via command kubectl expose deployment helloworld --type=NodePort and then it says interact with the app by doing minikube service helloworld. The diagnostics after create and expose show that everything on my end matches the tutorial's setup, but the last step fails for me whereas it launches the browser and shows the hello world app in the tutorial demo.

How would I go about debugging this error as an absolute beginner?

EDIT:

When I run kubectl describe services, I get the following output

$ kubectl describe services
Name:                     helloworld
Namespace:                default
Labels:                   <none>
Annotations:              <none>
Selector:                 app=helloworld
Type:                     NodePort
IP Family Policy:         SingleStack
IP Families:              IPv4
IP:                       10.96.6.203
IPs:                      10.96.6.203
Port:                     <unset>  80/TCP
TargetPort:               80/TCP
NodePort:                 <unset>  30433/TCP
Endpoints:                172.17.0.2:80
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   <none>

When I check the port 30433, by doing nc -zv <hostname> 30433, I get an error:

nc: connectx to <hostname> port 30433 (tcp) failed: Connection refused
nc: connectx to <hostname> port 30433 (tcp) failed: Network is unreachable
Wytrzymały Wiktor
  • 11,492
  • 5
  • 29
  • 37
DigitalEye
  • 1,456
  • 3
  • 17
  • 26
  • i searched but found `minikube service` is to expose service url.but in the github repo i don't find anywhere that require you run `minikube service`. so try access `http://localhost:TheNodePort` in browser directly. – Lei Yang Mar 01 '22 at 00:59
  • @LeiYang: My experiments show that ```minikube service --url``` is to get the service URL. But, if you omit ```--url```, it opens your web browser and connects to the port that the service is listening. – DigitalEye Mar 02 '22 at 08:54
  • have you solved your timeout issue? – Lei Yang Mar 02 '22 at 08:56
  • @LeiYang: No. There is something strange with the service, while kubectl shows the service as running, when I run a netcat and do a port scan, I don't see anything listening on that port. Any troubleshooting tips? – DigitalEye Mar 02 '22 at 09:02
  • i'm not sure, sorry. i use actual k8s clusters in azure in my work. never used `minikube`. – Lei Yang Mar 02 '22 at 09:07
  • @LeiYang: Fyi, I edited the question with output from kubectl and nc. – DigitalEye Mar 02 '22 at 09:07
  • @DigitalEye As per time out behavior, how exactly did you set up minikube and what is the version of it? What does `minikube logs` command show to you? – anarxz Mar 04 '22 at 01:04

1 Answers1

0

You can try to access your application with the help of this shortcut - it is used to fetch minikube IP and a service’s NodePort:

minikube service --url helloworld

The output of the command will display Kubernetes service URL in CLI, instead of trying to launch it in your default browser with minikube service helloworld command. Using this URL, you will be able to access the exposed service in the browser.

In general, you can check the list of all available services in your minikube cluster and their URLs by using minikube service list command.

anarxz
  • 817
  • 1
  • 14
  • 1
    what's root cause of OP's timeout do you think? how do you think your extra option `--url` will solve the timeout? – Lei Yang Mar 01 '22 at 02:28