Unable to start service

I use kubernetes with ubuntu and regular internet connection.

I created and exposed a deployment with the following properties:
tesb-node:
[ pod ip: 172.17.0.21 ]
[ service ip: 10.99.98.201 ]
[ port: 84 ]
[ service: 192.168.99.108:30178 ]

On the terminal I typed the following command:
minikube service tesb-node

The output from google chrome is:

This site can’t be reached192.168.99.108 refused to connect.
Search Google for 192 168 108 30178
ERR_CONNECTION_REFUSED

How do I resolve or fix this issue?

Is Ubuntu running directly on your laptop/pc or inside a VM?

Ubuntu is running directly on laptop

Can you give the output of:

kubectl get service
minikube service list

And then SSH to minikube VM and run netstat:

minikube ssh
netstat -nal | grep 30178

Can you get output of the above commands?

Kind regards,
Stephen

kubectl get service

output:
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
hello-node LoadBalancer 10.111.212.202 8080:32744/TCP 148d
helo-svc NodePort 10.97.34.53 82:31647/TCP 159d
kubernetes ClusterIP 10.96.0.1 443/TCP 165d
my-service LoadBalancer 10.106.216.4 8080:32734/TCP 158d
my-service2 LoadBalancer 10.102.195.192 8080:32241/TCP 154d
tesb-node LoadBalancer 10.99.98.201 84:30178/TCP 147d
tesc-node NodePort 10.101.248.109 85:31107/TCP 109d

minikube service list

output:
|-----------------|-----------------------|-----------------------------|

NAMESPACE NAME URL
default hello-node http://192.168.99.108:32744
default helo-svc http://192.168.99.108:31647
default kubernetes No node port
default my-service
default my-service2
default tesb-node http://192.168.99.108:30178
default tesc-node
kube-system default-http-backend
kube-system elasticsearch-logging No node port
kube-system heapster No node port
kube-system kibana-logging
kube-system kube-dns No node port
kube-system kubernetes-dashboard No node port
kube-system logviewer
kube-system metrics-server No node port
kube-system monitoring-grafana
kube-system monitoring-influxdb No node port
kube-system registry No node port
storage-gluster heketi No node port
----------------- ----------------------- -----------------------------

minikube ssh

output:
_ _
_ _ ( ) ( )
___ ___ () ___ ()| |/’) _ _ | |_ __
/’ _ _| |/’ _ \| || , < ( ) ( )| '_\ /’\ | ( ) ( ) || || ( ) || || |\\ | () || |) )( /
(
) (
) (
)()() ()()() ()\___/'(_,__/'_
_)

$ netstat -nal | grep 30178
tcp 0 0 :::30178 :::* LISTEN

Is the app inside testb-node configured to listen on port 84?
Because if it’s not then that would explain why you get connection refused when trying to connect.
K8s is routing the request all the way to the pod but the pod is not listening on port 84.
Just specifying in the YAML isn’t enough, the actual app needs to listen on the correct port also.

Kind regards,
Stephen

How do I configure the app and pod to listen on the correct port to avoid refused connection?

That depends on your application.
If you coded it yourself then whatever language or framework you used should have details for changing the port.
If its an off the shelf software then the documentation for the software should have instructions.

It is a simple vs code application. What are the steps to configure a vs code application to listen to correct port after it is already exposed on Kubernetes? Or before?

Well vs code is a code editor, not a language.
Is it a simple hello world type application?

My current vs code app no longer works somehow. So I tried a Hello world vs code app and then exposed it to kubernetes. The result is still the same.

from google chrome:

This site can’t be reached192.168.99.108 refused to connect.
Try:
Checking the connection
Checking the proxy and the firewall
ERR_CONNECTION_REFUSED

from firefox:

Unable to connect
Firefox can’t establish a connection to the server at 192.168.99.108:30714.
The site could be temporarily unavailable or too busy. Try again in a few moments.
If you are unable to load any pages, check your computer’s network connection.
If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web.

How do I make configuration for this app to listen to the correct port?

Can you share the hello world code here?

Here are some of the codes:

.dockerignore:
bin
obj\

dockerfile:
FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build-env
WORKDIR /app

(# Copy csproj and restore as distinct layers)
COPY *.csproj ./
RUN dotnet restore

(# Copy everything else and build)
COPY . ./
RUN dotnet publish -c Release -o out

(# Build runtime image)
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT [“dotnet”, “myapp4.dll”]

myapp4.csproj:

Exe netcoreapp2.2

Program.cs:
using System;

namespace myapp4
{
class Program
{
static void Main(string args)
{
Console.WriteLine(“Hello World!”);
}
}
}

If this is not enough what else do I need to include?

That’s a command line application, not a web service.
I’m not familiar with dotnet so I would suggest you look for some example dotnet web services and try to get a web service running locally on your Ubuntu laptop.
Once you can get it working on your laptop you could then try to get it working on minikube.

Kind regards,
Stephen

Do you know any example dotnet web services that I can try and use with minikube?

No, I don’t know much about dotnet so can’t really give any recommendations.

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)