question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Help needed] Can’t access Endpoint of Springboot webservice from ingress

See original GitHub issue

Hi Everyone,

I tried to set up a quick microK8s cluster on my local machine to introduce Kubernetes in a meetup on my company. So I create a little helloworld webservice with Springboot with 2 entrypoints and some actuator entrypoints

I deployed my app on my microk8s cluster with some resources yaml files:

This is my microk8s configuration:

microk8s.kubectl version
Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.1", GitCommit:"b7394102d6ef778017f2ca4046abbaa23b88c290", GitTreeState:"clean", BuildDate:"2019-04-08T17:11:31Z", GoVersion:"go1.12.1", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.1", GitCommit:"b7394102d6ef778017f2ca4046abbaa23b88c290", GitTreeState:"clean", BuildDate:"2019-04-08T17:02:58Z", GoVersion:"go1.12.1", Compiler:"gc", Platform:"linux/amd64"}
microk8s.status --yaml
microk8s:
  running: true
addons:
  jaeger: disabled
  fluentd: disabled
  gpu: disabled
  storage: disabled
  registry: disabled
  ingress: enabled
  dns: enabled
  metrics-server: disabled
  prometheus: disabled
  istio: disabled
  dashboard: enabled

And my app configuration:

  • Ingress
microk8s.kubectl describe ingress hello-world-ingress
Name:             hello-world-ingress
Namespace:        default
Address:          
Default backend:  default-http-backend:80 (<none>)
Rules:
  Host       Path  Backends
  ----       ----  --------
  localhost  
             /*   hello-world-service:81 (10.1.1.19:8080,10.1.1.20:8080)
Annotations:
  kubectl.kubernetes.io/last-applied-configuration:  {"apiVersion":"networking.k8s.io/v1beta1","kind":"Ingress","metadata":{"annotations":{"ingress.kubernetes.io/rewrite-target":"/*","kubernetes.io/ingress.class":"nginx-int"},"name":"hello-world-ingress","namespace":"default"},"spec":{"rules":[{"host":"localhost","http":{"paths":[{"backend":{"serviceName":"hello-world-service","servicePort":81},"path":"/*"}]}}]}}

  kubernetes.io/ingress.class:           nginx-int
  ingress.kubernetes.io/rewrite-target:  /*
Events:                                  <none>
  • Service
microk8s.kubectl describe service hello-world-service
Name:              hello-world-service
Namespace:         default
Labels:            app=hello-world
Annotations:       kubectl.kubernetes.io/last-applied-configuration:
                     {"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"labels":{"app":"hello-world"},"name":"hello-world-service","namespace":"...
Selector:          app=hello-world
Type:              ClusterIP
IP:                10.152.183.140
Port:              hello-world  81/TCP
TargetPort:        8080/TCP
Endpoints:         10.1.1.19:8080,10.1.1.20:8080
Session Affinity:  None
Events:            <none>
  • Deployment
microk8s.kubectl describe deployment hello-world-deployment
Name:                   hello-world-deployment
Namespace:              default
CreationTimestamp:      Wed, 29 May 2019 10:52:07 +0200
Labels:                 <none>
Annotations:            deployment.kubernetes.io/revision: 5
                        kubectl.kubernetes.io/last-applied-configuration:
                          {"apiVersion":"apps/v1","kind":"Deployment","metadata":{"annotations":{},"name":"hello-world-deployment","namespace":"default"},"spec":{"r...
Selector:               app=hello-world
Replicas:               3 desired | 3 updated | 3 total | 2 available | 1 unavailable
StrategyType:           RollingUpdate
MinReadySeconds:        0
RollingUpdateStrategy:  1 max unavailable, 0 max surge
Pod Template:
  Labels:  app=hello-world
           env=prod
           version=0.2.0-SNAPSHOT
  Containers:
   hello-world:
    Image:      winael/hello-world:0.2.0-SNAPSHOT
    Port:       8080/TCP
    Host Port:  0/TCP
    Limits:
      cpu:     500m
      memory:  200Mi
    Requests:
      cpu:        100m
      memory:     100Mi
    Liveness:     http-get http://:8080/actuator/health delay=120s timeout=1s period=10s #success=1 #failure=3
    Readiness:    http-get http://:8080/actuator/health delay=120s timeout=1s period=10s #success=1 #failure=3
    Environment:  <none>
    Mounts:       <none>
  Volumes:        <none>
Conditions:
  Type           Status  Reason
  ----           ------  ------
  Available      True    MinimumReplicasAvailable
  Progressing    True    NewReplicaSetAvailable
OldReplicaSets:  <none>
NewReplicaSet:   hello-world-deployment-899dffddb (3/3 replicas created)
Events:          <none>

When I call an endpoint to the webservice using the IP defined in the service resource (10.152.183.140) on port 81, it’s working fine, but when I try to call it from localhost on port 80 as it is defined on Ingress, I have a default backend - 404

I suppose I didn’t set correctly my ingress but don’t understand what’s happening. Can someone help me on this ?

Regards, Winael

inspection-report-20190604_101612.tar.gz

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
balchuacommented, Jun 4, 2019

You can have a cluster with multiple nginx ingress controllers. Each serving different tenants.
But frankly, i have not tried running multilple nginx ingress controllers.😁

Since microk8s does not specify the ingress-class in the ingress.yaml, then you dont need to specify the ingress-class annotation as well. That’s why removing the annotation works.

1reaction
balchuacommented, Jun 5, 2019

@winael you’re most welcome! 😁

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't access Endpoint of Springboot webservice from ingress
Hi Everyone, I tried to set up a quick microK8s cluster on my local machine to introduce Kubernetes in a meetup on my...
Read more >
Angular cannot connect to Spring Boot Web Services in a ...
I have a spring boot web services. One called "issuer web services" is running on port "30001". I am running both apps using...
Read more >
Repeatly found and lost a service endpoints. #3060 - GitHub
If nodes status is "NodeNotReady", all pods status of this node is false, the endpoints will be lost. then ingress will generate a...
Read more >
Liveness and Readiness Probes with Spring Boot
The Liveness state of an application tells whether the internal state is valid. If Liveness is broken, this means that the application ...
Read more >
Can you expose your services with an API gateway in ...
A Kubernetes Ingress routes the external traffic to your services and Pods inside the cluster. You could have an Ingress that is also...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found