0

I'm developing a physical cluster with Load Balancer, Ingress and Ingress Controller for academic purposes using single-board computers (Raspberry Pi and Orange Pi) with K3s. The deployment and service are working as expected, but I'm stuck in the final part because I don't know if the kind of Ingress configuration is enough to access my application with the custom url "cluster.example.com" or if I need to change all configuration files.

The final purpose of this cluster project is to add a simple website, accessed through "cluster.example.com" from another local machine in the same network. As I own 4 single-boards I believe that I need to create some Ingress Controller for solve this question together with an Ingress configuration, but I'm not sure.

Meanwhile, I did these steps:

  • K3s installation on the server and workers disabling Traefik;

  • Create a deployment file and apply it to the cluster;

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: front-app
  name: front-app
spec:
  revisionHistoryLimit: 2
  replicas: 3
  selector:
    matchLabels:
      app: front-app
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
  template:
    metadata:
      labels:
        app: front-app
    spec:
      containers:
      - image: my_user/frontend_app:latest
        name: front-app
        ports:
        - containerPort: 80
          name: server
  • Create a service file and apply it to the cluster;
apiVersion: v1
kind: Service
metadata:
  name: front-app-service
  labels:
    app: front-app
spec:
  ports:
  - name: http
    port: 80
    targetPort: 80
  selector:
    app: front-app
  type: NodePort
  • I don't know if it's correct, but I've copied an Ingress Controller configuration file from the Ingress Nginx official repository on Github.

  • To finish my configurations, I've created an ingress configuration file.

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: front-app-ingress
  annotations:
spec:
  ingressClassName: nginx
  rules:
  - host: cluster.example.com
    http:
      paths:
      - path: "/"
        pathType: Exact
        backend:
          service:
            name: front-app-service
            port:
              number: 80

As a final step, I applied all configuration files, and unfortunately, I cannot access my cluster with a custom address from another computer in the same local network.

Is there a way to fix this?

  • You said you disabled Traefik. What are you using as an Ingress controller in its place? Or what are you using to provide the LoadBalancer service? – larsks Jul 02 '23 at 20:09
  • I'm using Nginx as a load balancer. I'm trying to create some configuration for an Ingress controller, but without success. – Ronaldo Mendes Jul 02 '23 at 21:18
  • The details here are a bit vague. I was working on an answer that looks at the difference between Ingress controllers and Load Balancers, but then I realized I was effectively reproducing answers to [this question](https://stackoverflow.com/questions/45079988/ingress-vs-load-balancer), so I would start there and see if that helps. – larsks Jul 03 '23 at 00:37
  • I was looking for something to solve my problem, and I think I understood what I still needed to add to my cluster. I believe I also need an ingress-controller and an ingress-controller admission. That's it? – Ronaldo Mendes Jul 08 '23 at 15:37

0 Answers0