I am new to Kubernetes, and would like to access my ASP.Net MVC web application service, but it just gets timed-out when I curl
the external IP address generated by the Metallb load balancer from microk8s. However, when I describe the service created, the endpoint is generated correctly as shown below.
Name: sensory-service-loadbalancer
Namespace: default
Labels: <none>
Annotations: <none>
Selector: app=sensory-aromalab
Type: LoadBalancer
IP Family Policy: SingleStack
IP Families: IPv4
IP: 10.152.183.141
IPs: 10.152.183.141
LoadBalancer Ingress: 10.64.140.44
Port: <unset> 81/TCP
TargetPort: 8080/TCP
NodePort: <unset> 30243/TCP
Endpoints: 10.1.136.170:8080
Session Affinity: None
External Traffic Policy: Cluster
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal nodeAssigned 84s (x215 over 17h) metallb-speaker announcing from node "tihg-nbg-test-1" with protocol "layer2"
The home HTML page is displayed when I type curl 10.1.136.170
(the endpoint address), but the connection gets refused when I try to curl
the IP and LoadBalancer Ingress addresses.
This issue doesn’t happen to other applications whose frontend and backend services are deployed separately, which means I can curl
them locally with no issue, but the timed-out problem or the connection being refused issue is happening to this ASP.Net Core application.
My yaml files for the deployment and service are as mentioned below. It would be great to hear any suggestions to this issue.
deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: sensory-deploy
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: sensory-aromalab
template:
metadata:
labels:
app: sensory-aromalab
spec:
containers:
- name: aromalabweb
image: ewptih/sensoryaroma
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
service.yaml
apiVersion: v1
kind: Service
metadata:
name: sensory-service-loadbalancer
namespace: default
spec:
type: LoadBalancer
selector:
app: sensory-aromalab
ports:
- protocol: TCP
port: 81
targetPort: 8080