Can't access SpringBoot-Application running on Kubernetes-Pi-Cluster from outside

8/10/2020

I created a Kubernetes-cluster with a deployment + service (LoadBalancer) for a SpringBoot-Java-App. If I want to access the Web-App via the external IP, I get a timeout error. Does anybody now how to fix this?

LoadBalancerService.yml:

apiVersion: v1
kind: Service
metadata:
  creationTimestamp: null
  labels:
    app: webapp
  name: webapp
spec:
  ports:
  - name: 8080-8080
    port: 8080
    protocol: TCP
    targetPort: 8080
  selector:
    app: webapp
  type: LoadBalancer

Deployment.yml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: webapp
  labels:
    app: webapp
spec:
  replicas: 4
  selector:
    matchLabels:
      app: webapp
  template:
    metadata:
      labels:
        app: webapp
    spec:
      containers:
        - name: webapp-container
          image: skrivutenliv/raspi_stress:latest
          ports:
        - containerPort: 8080

Cluster overview:

NAME                            READY   STATUS    RESTARTS   AGE
pod/svclb-webapp-5gs9s          1/1     Running   1          120m
pod/svclb-webapp-qfkzn          1/1     Running   1          120m
pod/nginx-app-b8b875889-272nw   1/1     Running   2          6h26m
pod/webapp-ffb868dbb-nw9bw      1/1     Running   1          121m
pod/webapp-ffb868dbb-4gv8d      1/1     Running   1          121m
pod/webapp-ffb868dbb-8j8ld      1/1     Running   1          121m
pod/svclb-webapp-zsvbf          1/1     Running   1          120m
pod/webapp-ffb868dbb-nps6s      1/1     Running   1          121m

NAME                 TYPE           CLUSTER-IP      EXTERNAL-IP                   PORT(S)          AGE
service/kubernetes   ClusterIP      10.43.0.1       <none>                        443/TCP          7d4h
service/webapp       LoadBalancer   10.43.216.123   192.168.0.233,192.168.0.235   8080:30313/TCP   120m

NAME                          DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR   AGE
daemonset.apps/svclb-webapp   3         3         3       3            3           <none>          120m

NAME                        READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/nginx-app   1/1     1            1           5d1h
deployment.apps/webapp      4/4     4            4           121m

NAME                                  DESIRED   CURRENT   READY   AGE
replicaset.apps/nginx-app-b8b875889   1         1         1       5d1h
replicaset.apps/webapp-ffb868dbb      4         4         4       121m

Cluster-Nodes

NAME          STATUS   ROLES    AGE     VERSION        INTERNAL-IP     EXTERNAL-IP   OS-IMAGE                         KERNEL-VERSION   CONTAINER-RUNTIME
knode2        Ready    <none>   7d      v1.18.6+k3s1   192.168.0.233   <none>        Raspbian GNU/Linux 10 (buster)   5.4.51-v7l+      containerd://1.3.3-k3s2
knode1        Ready    <none>   7d      v1.18.6+k3s1   192.168.0.232   <none>        Raspbian GNU/Linux 10 (buster)   4.19.118-v7l+    containerd://1.3.3-k3s2
kmasternode   Ready    master   7d21h   v1.18.6+k3s1   192.168.0.231   <none>        Raspbian GNU/Linux 10 (buster)   4.19.118-v7l+    containerd://1.3.3-k3s2
-- skrivutenliv
docker
k3s
kubernetes
raspberry-pi
spring-boot

1 Answer

8/18/2020

Solution: disable the Firewall ;)

-- skrivutenliv
Source: StackOverflow