I'm setting up a k8s cluster using a scaleway machine (4cpu & 8g memory) using microk8s with following add-on:
microk8s is running
high-availability: no
addons:
enabled:
dns # CoreDNS
helm3 # Helm 3 - Kubernetes package manager
registry # Private image registry exposed on localhost:32000
storage # Storage class; allocates storage from host directory
metallb # Loadbalancer for your Kubernetes cluster
I used helm to deploy a nodejs express API, and I tested it using kubectl port forward
Now, I'm trying to use metallb to be able to access it from an nginx, so I deployed a service & then I get the following:
my-api-service LoadBalancer 10.152.183.14 10.64.140.43 8080:32668/TCP 34m
But when I tried to access it via the service :
- With metallb addon disabled: i can access it via the clusterIp
- With metallb addon enabled: I can access it via the externalIp, but sometimes the connection is reset:
greg@sd-69380:~$ curl 10.152.183.15:8080/
{"statusCode":404,"error":"Not Found","message":"Not Found"} # The API return a 404, excepted behavior
greg@sd-69380:~$ curl 10.152.183.15:8080/
{"statusCode":404,"error":"Not Found","message":"Not Found"}
greg@sd-69380:~$ curl 10.152.183.15:8080/
{"statusCode":404,"error":"Not Found","message":"Not Found"}
greg@sd-69380:~$ curl 10.152.183.15:8080/
curl: (7) Failed to connect to 10.152.183.15 port 8080: Connection refused # This is the problem
{"statusCode":404,"error":"Not Found","message":"Not Found"}
greg@sd-69380:~$ curl 10.152.183.15:8080/
{"statusCode":404,"error":"Not Found","message":"Not Found"}
greg@sd-69380:~$ curl 10.152.183.15:8080/
{"statusCode":404,"error":"Not Found","message":"Not Found"}
greg@sd-69380:~$ curl 10.152.183.15:8080/
So, when I tried to make request using nginx, sometimes I got 502 because nginx is not able to access the API.
I've got not problem when I use port-forward, so the problem is not on the API side.
I'd appreciate any help you could give me!